Arduino UNO RFID Smart Trolley Billing System with I2C LCD Display
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to interface an Arduino UNO with an RFID-RC522 module, an I2C LCD 16x2 screen, and multiple pushbuttons. The purpose of the circuit is to create a smart trolley billing system that can add or remove items from a bill using RFID tags and display the total bill on the LCD screen. The pushbuttons are used to control the addition and removal of items and to reset the billing amount.
Component List
Arduino UNO
- Microcontroller board based on the ATmega328P
- It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button.
RFID-RC522
- A radio frequency identification (RFID) module that operates at 13.56 MHz
- It is used for contactless communication and can read and write to RFID tags.
Pushbutton (x3)
- A simple switch mechanism for controlling some aspect of a machine or a process.
- Buttons are typically made out of hard material, usually plastic or metal.
Resistor (x3)
- A passive two-terminal electrical component that implements electrical resistance as a circuit element.
- In this circuit, each resistor has a value of 200 Ohms.
I2C LCD 16x2 Screen
- A liquid crystal display capable of displaying 16 characters per line and 2 lines.
- It uses the I2C communication protocol for interfacing with the Arduino.
Wiring Details
Arduino UNO
- 5V to Pushbuttons (Pin 1) and I2C LCD Screen (VCC)
- 3.3V to RFID-RC522 (VCC)
- GND to I2C LCD Screen, RFID-RC522, and Pushbuttons (Pin 2)
- Digital Pins:
- D2 to Pushbutton (Pin 4) through Resistor
- D3 to Pushbutton (Pin 4) through Resistor
- D4 to Pushbutton (Pin 4) through Resistor
- D9 to RFID-RC522 (RST)
- D10 to RFID-RC522 (SDA)
- D11 to RFID-RC522 (MOSI)
- D12 to RFID-RC522 (MISO)
- D13 to RFID-RC522 (SCK)
- I2C Pins:
- SCL to I2C LCD Screen (SCL)
- SDA to I2C LCD Screen (SDA)
RFID-RC522
- VCC (3.3V) from Arduino UNO
- RST to Arduino UNO (D9)
- GND to Arduino UNO (GND)
- IRQ (Not connected)
- MISO to Arduino UNO (D12)
- MOSI to Arduino UNO (D11)
- SCK to Arduino UNO (D13)
- SDA to Arduino UNO (D10)
Pushbuttons (x3)
- Pin 1 (in) to Arduino UNO (5V)
- Pin 2 (in) to Arduino UNO (GND)
- Pin 3 (out) (Not connected)
- Pin 4 (out) to Arduino UNO (D2, D3, D4) through Resistor
Resistor (x3)
- pin1 to Pushbutton (Pin 4)
- pin2 (All resistors connected together)
I2C LCD 16x2 Screen
- SCL to Arduino UNO (SCL)
- SDA to Arduino UNO (SDA)
- VCC (5V) from Arduino UNO
- GND to Arduino UNO (GND)
- Other pins (VDD, VO, RS, RW, E, D0-D7, BLA, BLK) are not connected in this circuit.
Documented Code
/****************************************************
* Code Designed By : Rahul Jadhav Youtube Channel
****************************************************/
/******************RFID Connection:*********************
RFID PIN ARDUINO PIN
SDA 10
SCK 13
MOSI 11
MISO 12
GND GND
RST 9
3.3v 3.3v
******************************************************/
/***** LCD Connection ***********************************
LCD PIN ARDUINO PIN
SCL SCL (Arduino Last pin)
SDA SDA (Arduino Second last pin)
VCC 5v
GND GND
******************************************************/
/***** Button Connection ***********************************
Button PIN ARDUINO PIN
Remove_Button 2
Add_button 3
Reset_button 4
VCC 5v
GND GND
*****************************************************/
#include <SPI.h>
#include <MFRC522.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const int remove_button = 2;
const int add_button = 3;
const int reset_button = 4;
// const int buzzer_Pin = 5;
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.
struct item
{
String item_name;
String item_number;
int item_price;
};
const int number_of_item = 4;
const item item_list[number_of_item]=
{
//Item Name Item RFID Number Item Price
{"Tata salt", "B3 23 E4 11", 100},
{"Milk Powder", "A3 51 A0 0D", 50},
{"Bournvita", "13 1F A3 0D", 20},
{"Ball_Pen", "E3 68 DC 12", 10},
};
int bill_amount = 0;
int remove_buttonState = 0;
int add_buttonState = 0;
int reset_buttonState = 0;
int add_item_flag = 1;
int remove_item_flag = 0;
void setup()
{
pinMode(remove_button, INPUT);
pinMode(reset_button, INPUT);
pinMode(add_button, INPUT);
// pinMode(buzzer_Pin, OUTPUT);
Serial.begin(9600); // Initiate a serial communication
SPI.begin(); // Initiate SPI bus
mfrc522.PCD_Init(); // Initiate MFRC522
Serial.println("Approximate your card to the reader...");
Serial.println();
// digitalWrite(buzzer_Pin, LOW);
lcd.init();
// Turn on the Backlight
lcd.backlight();
lcd.clear();
// Set cursor (Column, Row)
lcd.setCursor(0, 0);
lcd.print("Smart Trolley");
lcd.setCursor(0,1);
lcd.print("Billing System");
delay(2000);
lcd.clear();
// Set cursor (Column, Row)
lcd.setCursor(0, 0);
lcd.print("Start purchasing");
lcd.setCursor(0,1);
lcd.print("your item");
delay(100);
}
void loop()
{
remove_buttonState = digitalRead(remove_button);
add_buttonState = digitalRead(add_button);
reset_buttonState = digitalRead(reset_button);
if(remove_buttonState)
{
add_item_flag = 0;
remove_item_flag = 1;
lcd.clear();
// Set cursor (Column, Row)
lcd.setCursor(0, 0);
lcd.print("You Can now");
lcd.setCursor(0,1);
lcd.print("Remove your item");
delay(2000);
}
else if(add_buttonState)
{
add_item_flag = 1;
remove_item_flag = 0;
lcd.clear();
// Set cursor (Column, Row)
lcd.setCursor(0, 0);
lcd.print("You Can now");
lcd.setCursor(0,1);
lcd.print("add your item");
delay(2000);
}
else if(reset_buttonState)
{
lcd.clear();
// Set cursor (Column, Row)
lcd.setCursor(0, 0);
lcd.print("Resetting");
lcd.setCursor(0,1);
lcd.print("Trolley data");
delay(2000);
lcd.clear();
// Set cursor (Column, Row)
lcd.setCursor(0, 0);
lcd.print("Start Purchasing");
lcd.setCursor(0,1);
lcd.print("Your item");
delay(2000);
bill_amount = 0;
}
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent())
{
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial())
{
return;
}
//Show UID on serial monitor