First Steps with the Arduino-UNO R3 and NANO | Maker, MakerED, Coding | RFID RC522 Tag-Card Reader with LCD1602-I2C

Authors

.

RFID-RC522-LCD1602-I2C

 

.


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

LCD1602-Wiring with Arduino

.

I2C Bus connections on Arduino UNO

.

I2C LCD1602 PINOUT on Arduino UNO

.

I2C Bus connections on Arduino NANO

.

I2C LCD1602 PINOUT-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.

.

RFID-RC522-PINOUT

.

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.

.

 

1ibdy1vf6wghd-n05dgl-attenzionearchitettofr01Make sure to connect the RFID-RC522 to 3,3 Volts and NOT to 5 Volts, you will fry the device otherwise!!

.

.

 

 

Connections-RFID-ARDUINO

Click PIC , please, to enlarge.

.

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!

.

LCD-I2C-PINOUT-ARDUINO

.

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:

 

ERROR-1

Click image, please, to enlarge

.

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:.

 

I2C-ADDRESS-SCAN

Click image, please, to enlarge.

.

I2C-ADDRESS-SCAN-2

Click image, please, to enlarge.

.

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! 

.

I2C Addresses on LCD1602

Click image, please, to enlarge.

.


Resolving the ERROR message

Coming back to resolve our ERROR-message and how to resolve it:

Please check the PIC below:

.

ERROR-1-Changing some code for working

Click the image, please, to enlarge.

.

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 Start Display

Click image, please, to enlarge.

Access Control Invalid card/tag

 

Access Control Invalid Card/Tag

Click image, please, to enlarge.

 

Access Control-Access granted

Access granted

Click image, plese, to enlarge.

 

 

 

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 😉

 


.

GUST-AVRIL2014-800px-2L’auteur Gust MEES est Formateur andragogique / pédagogique TIC, membre du “Comité Conseil” de “Luxembourg Safer Internet” (LuSI), appelé maintenant BEESECURE, partenaire officiel (consultant) du Ministère de l’éducation au Luxembourg du projet  ”MySecureIT“, partenaire officiel du Ministère du Commerce au Luxembourg du projet ”CASES” (Cyberworld Awareness and Security Enhancement Structure). L’auteur était aussi gagnant d’un concours en électronique en 1979 ( Pays germaniques ) et voyait son projet publié dans le magazine électronique “ELO”.


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,

.

.

.

.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.