Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO-Based RFID Inventory System with Coin Dispenser and LCD Display

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based RFID Inventory System with Coin Dispenser and LCD Display

Circuit Documentation

Summary

This circuit is designed to interface an Arduino UNO with multiple RFID-RC522 modules, a 20x4 I2C LCD, a coin hopper, and a buck converter powered by a 12V 200Ah battery. The Arduino UNO reads RFID tags, updates the LCD display, and controls the coin hopper to dispense coins based on the detected RFID tags.

Component List

  1. Arduino UNO

    • Description: A microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. RFID-RC522

    • Description: A low-cost RFID reader module.
    • Pins: SDA, SCK, MOSI, MISO, IRQ, GND, RST, 3.3V
  3. Buck Converter

    • Description: A DC-DC converter that steps down voltage.
    • Pins: IN+, IN-, OUT+, OUT-
  4. 12V 200Ah Battery

    • Description: A high-capacity battery for powering the circuit.
    • Pins: GND, 12V
  5. LCD 20x4 I2C

    • Description: A 20x4 character LCD with I2C interface.
    • Pins: GND, 5V, SCA, SCL
  6. Coin Hopper

    • Description: A device for dispensing coins.
    • Pins: VCC, SIGNAL, GND, P, N

Wiring Details

Arduino UNO

RFID-RC522

Buck Converter

12V 200Ah Battery

LCD 20x4 I2C

Coin Hopper

Code Documentation

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <MFRC522.h>

#define RST_PIN_1 7
#define SS_PIN_1 10
#define RST_PIN_2 6
#define SS_PIN_2 9
#define RST_PIN_3 5
#define SS_PIN_3 8
#define COIN_HOPPER_PIN 4

LiquidCrystal_I2C lcd(0x27, 20, 4);
MFRC522 rfid1(SS_PIN_1, RST_PIN_1);
MFRC522 rfid2(SS_PIN_2, RST_PIN_2);
MFRC522 rfid3(SS_PIN_3, RST_PIN_3);

int plates = 0;
int spoons = 0;
int forks = 0;
int glasses = 0;

void setup() {
  Serial.begin(9600);
  SPI.begin();
  rfid1.PCD_Init();
  rfid2.PCD_Init();
  rfid3.PCD_Init();
  lcd.begin();
  lcd.backlight();
  pinMode(COIN_HOPPER_PIN, OUTPUT);
  digitalWrite(COIN_HOPPER_PIN, LOW);
}

void loop() {
  if (detectRFID(rfid1)) {
    plates++;
    dispenseCoin();
    updateLCD("Plates", plates);
  }
  if (detectRFID(rfid2)) {
    spoons++;
    forks++;
    dispenseCoin();
    updateLCD("Spoons and Forks", spoons, forks);
  }
  if (detectRFID(rfid3)) {
    glasses++;
    dispenseCoin();
    updateLCD("Glasses", glasses);
  }
  delay(1000);
}

bool detectRFID(MFRC522 &rfid) {
  if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) {
    return false;
  }
  rfid.PICC_HaltA();
  return true;
}

void dispenseCoin() {
  digitalWrite(COIN_HOPPER_PIN, HIGH);
  delay(1000); // Adjust the delay as needed to dispense one coin
  digitalWrite(COIN_HOPPER_PIN, LOW);
}

void updateLCD(String utensil, int count) {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print(utensil + ": ");
  lcd.print(count);
  if (count >= 10) {
    lcd.setCursor(0, 1);
    lcd.print("Compartment Full");
  }
}

void updateLCD(String utensil1, int count1, String utensil2, int count2) {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print(utensil1 + ": ");
  lcd.print(count1);
  lcd.setCursor(0, 1);
  lcd.print(utensil2 + ": ");
  lcd.print(count2);
  if (count1 >= 10 || count2 >= 10) {
    lcd.setCursor(0, 2);
    lcd.print("Compartment Full");
  }
}

This code initializes the RFID readers, LCD, and coin hopper. It continuously checks for RFID tags, updates the count of detected items, displays the count on the LCD, and dispenses a coin for each detected item.