Secure Access using MFRC522 RFID Reader with Arduino

www.pdf24.org    Send article as PDF   
This Article shows a simple example on how to use the MFRC522 RFID reader, with a quick overview of the specifications, and a demonstration project using an Arduino.

Description

RFID means radio-frequency identification, and uses electromagnetic fields to transfer data over short distances. RFID is useful to identify people, to make transactions, etc…

You can use an RFID system to open a doors, identify people, etc. For example, only the person with the right information on his card is allowed to enter.

An RFID system uses the following:

  • tags attached to the object to be identified, in this example we have a keychain and an electromagnetic card. Each tag has his own unique identification (UID).

tags

  • two-way radio transmitter-receiver, or the reader, that sends a signal to the tag in order to read its response.

reader

Specifications

  • Input voltage: 3.3V
  • Price: 4$ on eBay
  • Frequency: 13.56MHz

Library download

You will need the following library for this project:

  1. Download the RFID library here created by miguelbalboa
  2. Unzip the RFID library
  3. Install the RFID library in your Arduino IDE
  4. Restart the Arduino IDE

Pin Wiring

 

 

RFID Reader Pin Wiring to Arduino Uno
SDA Digital 10
SCK Digital 13
MOSI Digital 11
MISO Digital 12
IRQ unconnected
GND GND
RST Digital 9
3.3V 3.3V

Caution: You must power this device to 3.3V!

Circuit

Mifare_bb

Reading Data from a RFID tag

After connecting up the circuit, go to File > Examples > MFRC522 > DumpInfo, and upload the code. This code will be available in the Arduino IDE (after installing the RFID library).

Next, open the serial monitor. You should see something like in the figure below:

serial monitor1

Place the RFID card or the keychain above the reader. Move the tag closer until the reader displays all the information like below.

serial monitor2

The information that you read from the card includes the card UID that is highlighted in yellow. This information is stored in the memory that is divided into segments and blocks as you can shown in the previous picture.

There is a total of 1024 bytes of data storage, divided into 16 sectors, with each sector being protected by two different keys, A and B.

Write down the UID of the card because you’ll need it later.

Next upload the following code to the Arduino.

Arduino Code

 

 

 

In the code above, you will need to change the if (content.substring(1) == REPLACE WITH YOUR UID) and type the UID card you’ve written down previously.

Demonstration

Now, upload the code to your Arduino and open the IDE’s serial monitor.

Place the card you’ve chosen to give access above the Reader and you should see:

serial monitor3

If you place another tag with another UID over the Reader, the denial message will show up:

serial monitor4

Previous Post
Double-Leaf Bascule Bridge

EVShield Controlled Double-Leaf Bascule Railway Bridge

I have started work on another Bridge for my LEGO Railway layout, but this time I have built a Dual Track (Line), Double-Leaf Bascule Railway Bridge. This does mean I ... Read more

Next Post

ESP8266 Web Server using Arduino IDE

In this project you’ll create a standalone web server with an ESP8266 Wi-Fi Module that can toggle two LEDs. Where to buy? You can click here to get this module ... Read more

Short URL: http://tinyurl.com/hck67re

Leave a Reply

Your email address will not be published. Required fields are marked *



Do NOT follow this link or you will be banned from the site!
error: Content is protected !!