The purpose of this exercise is to build a prototype that can recognize different users and display personal messages. To achieve this we used and RFID shield for Arduino to read the ID of different RFID cards, and later displayed them on a 7 segment display. Above you can see a video demonstrating the result.
To follow this tutorial, you will need the following:
- Arduino Uno
- FRC522 RFID shield
- RFID cards
- 7 segment display
- 220 Ohm Resistor
- A bunch of wires
(This project was an exercise for a university course: TfCD)
Step 1: RFID Shield - Hardware
If your RFID shield doesn't have connectors attached, you will have to solder them on first. The model we used is the RC522 model.
Unfortunately the pins do not line up with the ones on the Arduino Uno, so you will need to connect them manually through a breadboard and wires. Connect the pins as following:
- Pin 5 --> Reset
- Pin 10 --> SDA
- Pin 11 --> MOSI
- Pin 12 --> MISO
- Pin 13 --> SCk
- GND --> GND
- 3.3v --> 3.3v
Once the shield is wired up, an LED should light up to indicate proper power supply.
Step 2: RFID Shield - Software
We can now test the RFID shield. For the software component, we used the code found below, obtained from Grant Gibson at grantgibson.co.uk, who in turn got it from B2CQ Shop (credit where credit is due). The code works great, but since we're doing something relatively simple there may be a lot of unneccessary bits (like writing data for example). All the comments are there, so you may choose to take it out, but leaving it as is doesn't hurt. After uploading the code to your Arduino, the Serial Monitor should now print a message along with (a.o.) the card's ID whenever you hold an RFID card over the RFID shield. You may notice some of it is in binary, we will modify that a bit later on.
Step 3: 7 Segment Display - Hardware
The card ID can now be used to identify users and display a personal message. For demonstration purposes we went with something simple: the ID itself. It's now time to wire up your 7segment display. You can see a wiring diagram in the enclosed pictures. Before you wire the whole thing, you might want to test each segment separately. First connect the middle cathodes (both top and bottom) to ground, through a 220 Ohm resistor. Grab a wire and plug in the 5V pin on the arduino, and briefly connect it to each segment. Each time the corresponding segment should light up. It's easiest (code wise) to wire segments A through F on the display (see image) to pins 2 through 8 on the arduino respectively (we don't need the dot segment), but since pin 5 is already taken by the shield, we'll make an exception and wire it to pin 9 instead. This is important as it will specifically have to be coded in as well.
Step 4: 7 Segment Display - Software
Below you will find the same code, with added functionality of showing the card ID on the display (this time we wrote it ourselves). If you'd like to alter the display, method of displaying, or the displayed message, look for the vairable digits and the functions DisplayWrite and SevenSegWrite. We also changed the ID from binary to decimal.
Now the display should flash all the numbers of the card ID in order everytime you present it to the RFID shield.