This circuit integrates an Arduino UNO microcontroller with an RFID-RC522 module, a servo motor, and an LCD I2C display. The Arduino UNO serves as the central processing unit, controlling the RFID reader for scanning tags, driving the servo motor, and displaying information on the LCD. The RFID-RC522 module is used for reading RFID tags, the servo motor is controlled based on the RFID scans, and the LCD display provides a user interface to display the scanned tag's UID.
3.3V
connected to RFID-RC522 VCC (3.3V)5V
connected to Servo VCC and LCD I2C Display SDAGND
connected to RFID-RC522 GND, Servo GND, and LCD I2C Display SCLA4
connected to LCD I2C Display VCCA5
connected to LCD I2C Display GNDD13
connected to RFID-RC522 SCKD12
connected to RFID-RC522 MISOD11
connected to RFID-RC522 MOSID10
connected to RFID-RC522 SDAD9
connected to RFID-RC522 RSTD3
connected to Servo pulseVCC (3.3V)
connected to Arduino UNO 3.3VRST
connected to Arduino UNO D9GND
connected to Arduino UNO GNDIRQ
(Not connected)MISO
connected to Arduino UNO D12MOSI
connected to Arduino UNO D11SCK
connected to Arduino UNO D13SDA
connected to Arduino UNO D10vcc
connected to Arduino UNO 5Vgnd
connected to Arduino UNO GNDpulse
connected to Arduino UNO D3GND
connected to Arduino UNO A5VCC
connected to Arduino UNO A4SDA
connected to Arduino UNO 5VSCL
connected to Arduino UNO GND/*RFID tag scan code
* https://srituhobby.com
*/
#include <LiquidCrystal_I2C.h>
#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN 9
#define SS_PIN 10
byte readCard[4];
byte a = 0;
LiquidCrystal_I2C lcd(0x27, 16, 2);
MFRC522 mfrc522(SS_PIN, RST_PIN);
void setup() {
Serial.begin(9600);
lcd.init();
lcd.backlight();
while (!Serial);
SPI.begin();
mfrc522.PCD_Init();
delay(4);
mfrc522.PCD_DumpVersionToSerial();
lcd.setCursor(2, 0);
lcd.print("Put your card");
}
void loop() {
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return 0;
}
if ( ! mfrc522.PICC_ReadCardSerial()) {
return 0;
}
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Scanned UID");
a = 0;
Serial.println(F("Scanned PICC's UID:"));
for ( uint8_t i = 0; i < 4; i++) { //
readCard[i] = mfrc522.uid.uidByte[i];
Serial.print(readCard[i], HEX);
Serial.print(" ");
lcd.setCursor(a, 1);
lcd.print(readCard[i], HEX);
lcd.print(" ");
delay(500);
a += 3;
}
Serial.println("");
mfrc522.PICC_HaltA();
return 1;
}
This code is designed to run on the Arduino UNO and uses the RFID-RC522 module to scan RFID tags. When a tag is scanned, its UID is displayed on the LCD and printed to the serial monitor. The LiquidCrystal_I2C
library is used to control the LCD display via the I2C bus, and the MFRC522
library is used to interface with the RFID module. The code initializes the RFID reader and the LCD display in the setup()
function and continuously checks for new RFID tags in the loop()
function. When a tag is detected, its UID is read, displayed, and printed.