Circuit Documentation
Summary of the Circuit
This circuit integrates an Arduino UNO microcontroller with an RFID-RC522 module and a 20x4 LCD display with an I2C interface. The Arduino UNO serves as the central processing unit, controlling the RFID reader for scanning RFID tags and displaying relevant information on the LCD screen. The RFID-RC522 module is used for reading RFID tags, and the LCD display provides a user interface to display messages such as prompts and the status of the RFID scans.
Component List
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Purpose: Acts as the central controller for the circuit, interfacing with the RFID module and the LCD display.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0-A5, SCL, SDA, AREF, D0-D13.
RFID-RC522
- Description: An RFID reader/writer module.
- Purpose: To read RFID tags and communicate the tag information to the Arduino UNO.
- Pins: VCC (3.3V), RST, GND, IRQ, MISO, MOSI, SCK, SDA.
LCD Display 20x4 I2C
- Description: A 20x4 character LCD display with an I2C interface.
- Purpose: To display information and messages to the user.
- Pins: SCL, SDA, VCC, GND.
Wiring Details
Arduino UNO
- 3.3V connected to RFID-RC522 VCC (3.3V)
- 5V connected to LCD Display VCC
- GND connected to RFID-RC522 GND and LCD Display GND
- A4 (SDA) connected to LCD Display SDA
- A5 (SCL) connected to LCD Display SCL
- D13 (SCK) connected to RFID-RC522 SCK
- D12 (MISO) connected to RFID-RC522 MISO
- D11 (MOSI) connected to RFID-RC522 MOSI
- D10 (SS) connected to RFID-RC522 SDA
- D9 (RST_PIN) connected to RFID-RC522 RST
RFID-RC522
- VCC (3.3V) connected to Arduino UNO 3.3V
- RST connected to Arduino UNO D9
- GND connected to Arduino UNO GND
- IRQ (Not connected)
- MISO connected to Arduino UNO D12
- MOSI connected to Arduino UNO D11
- SCK connected to Arduino UNO D13
- SDA connected to Arduino UNO D10
LCD Display 20x4 I2C
- SCL connected to Arduino UNO A5
- SDA connected to Arduino UNO A4
- VCC connected to Arduino UNO 5V
- GND connected to Arduino UNO GND
Documented Code
Arduino UNO Code
#include <SPI.h>
#include <MFRC522.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
// Set the LCD I2C address and dimensions
LiquidCrystal_I2C lcd(0x27, 20, 4);
void setup() {
Serial.begin(9600); // Initialize serial communications with the PC
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522 card
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0); // Set the cursor to the top-left position
lcd.print("SCAN ID TO LOGIN!");
//Serial.println("Scan a MIFARE Classic card");
}
void loop() {
// Look for new cards
if (!mfrc522.PICC_IsNewCardPresent() || !mfrc522.PICC_ReadCardSerial()) {
delay(50);
return;
}
// Show UID on serial monitor
Serial.print("Card UID:");
for (byte i = 0; i < mfrc522.uid.size; i++) {
Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
Serial.print(mfrc522.uid.uidByte[i], HEX);
}
Serial.println();
lcd.print("Welcome!");
// Halt PICC
mfrc522.PICC_HaltA();
// Stop encryption on PCD
mfrc522.PCD_StopCrypto1();
}
LCD Display 20x4 I2C Code
The LCD display is controlled through the Arduino UNO using the I2C protocol. The code for the LCD display is integrated into the Arduino UNO's sketch, as shown above.
