
.
.
RFID RC522 Tag-Card Reader with LCD1602-I2C
We were already playing around with LCD’s in our previous tutorial <===> First Steps with the Arduino-UNO R3 | Maker, MakerED, Coding | Super Starter Kit UNO R3 Project | LCD and Sensors Project <===> but there we used the SPI-Bus, meaning: connecting 12 wires (Potentiometer connections included…)!! With the I2C Bus we need ONLY to connect 4 wires!!
Check PICs below please to see the difference:
SPI Bus connections
.
I2C Bus connections on Arduino UNO
.
.
I2C Bus connections on Arduino NANO
.
.
SO, as you can see there is a BIG difference in cabling 😉 Especially beginners in Coding would appreciate this I2C version with ONLY 4 wires!
Learn more:
.
Check this video tutorial which explains very well about I2C:
.
.
Let us NOW first watch the video tutorial to see about WHAT this tutorial is…
.
.
The video and the code description in the Sketch are in Portuguese, BUT DON’T worry, I will give you later some screenshots with English text which you will need to change in the code; there are anyway some lines of code to add (change…) to make it working correctly! But let us FIRST have a look on the PINOUT of the RFID RC522 to see WHAT we have to connect.
.
.
So, let us now connect the RFID-RC522 to the Arduino UNO or the Arduino NANO, I used a Arduino NANO and its working perfectly! Check the translated (Google translate) wiring instructions.
.
Make sure to connect the RFID-RC522 to 3,3 Volts and NOT to 5 Volts, you will fry the device otherwise!!
.
.
.
As we can see from the bove there are 7 wires to connect from 8 possible connections on the RFIF RC522 device; the “interrupt pin (IRQ)” isn’t needed! SO, lets connect these pins to the Arduino UNO, or as I did to the Arduino NANO; it works on both! Next step is to connect the LCD1602 I2C to the Arduino, it’s pretty simple, check below please. ONLY 4 wires!
.
.
The wiring done, NOW we can download the code (Sketch) and upload it to our Arduino UNO, or NANO through the Arduino IDE, please find the download link below:
Once uploaded (compiling) the code there could be some errors happening, it happens to me… please check PIC below:
.
Well I made some searches on the internet and I found the right answer on a forum about this error, which sais that one should scan the I2C Address of the device and replace the “lcd.init();” by “lcd.begin (0x3F,16,2);” whereby “0x3F” is the I2C Address of my LCD1602/I2C module. I scanned to find out the I2C Addess with this sketch, please check here:
I bought 3 from Amazon (Germany) delivered from “AZ Delivery” <===> https://www.amazon.de/gp/product/B079T1BW6T <===> and they should have had ALL the I2C-Address “0X27” as explained in their FREE eBook <===> https://bibliothek.az-delivery.de/wp-content/uploads/2018/01/11-AZ-Delivery_16x2LCD-I2C-Display-Bundle_Startertutorial.pdf <===> but ONLY 1 had this address and two others the I2C-Address “0X3F”!! BTW: AZ Delivery has very GOOD stuff for reasonable prices!
Here below the results of the scan of the I2C-Address, shown in the Serial-Monitor of the Arduino IDE:.
.
.
SO, make sure to FIRST scan the I2C-Address through the above mentioned Sketch, will save you a lot of stress! 😉
TIP: Use a DYMO, print out the I2C-Addresses and glue them on the backside of the LCD1602 Display, so you know for next projects WHAT I2C-Address the module has! 😉 In a couple of weeks you wouldn’t remind it anymore!
.
.
Resolving the ERROR message
Coming back to resolve our ERROR-message and how to resolve it:
Please check the PIC below:
.
.
Check the lines marked with ***************************, in my case it is lines 36 and 40-52! Change it as it is displayed above, save it and upload it; it should work correctly now!
Please check the PICs below to see different interactions of the reader and the display:
.
Access Control Start Display |
Access Control Invalid card/tag
|
|
Access Control-Access granted
|
Prices of the used material: |
|
For those interested in to know a bit theory about NFC, RFID, please check below:
Check also this video, please:
Have fun learning with PracTICE and stay tuned for next adventures of learning 😉
.
![]() The author Gust MEES is ICT Course Instructor, ”Member of the Advisory Board” from “Luxembourg Safer Internet” (LuSI), BEESECURE, Official Partner (Consultant) from the Ministry of Education in Luxembourg, project “MySecureIT“, Official Partner from the Ministry of Commerce in Luxembourg, project “CASES” (Cyberworld Awareness and Security Enhancement Structure). The author was also a winner of an electronics contest (Germanic countries) in 1979 and got his project published in the “Electronics Magazine ELO”. |
Keywords necessary for me to create this blog post: Arduino UNO R3, Arduino NANO, LCD 1602, I2C Bus, RFID, RC522,Tag, Card Reader, Tag Reader, Access Control, coding, learning to learn, learning by doing, trouble shooting, I2C scan, LCD160/I2C,
.
.
.
.