Automated Toll Collection System using RFID
Automated toll collection system using RFID introduces the Automatic Smart Toll Tax Collection System, employing an RFID Module and Arduino. With the increasing congestion at toll plazas, the system aims to streamline the toll tax payment process. The objective is to automatically recognize the RFID tag associated with a vehicle, display the corresponding toll amount, and allow passage upon payment. Failure to pay will result in the gate remaining blocked, optimizing traffic flow, and saving time for commuters. This guide provides a comprehensive, step-by-step approach to help you navigate the construction, programming, and fine- tuning phases of your voice-controlled wheelchair. Here’s a step-by-step guide to get you started.
Materials required for Automated toll collection system using RFID
• Arduino Uno: The Arduino Uno is a microcontroller board based on the ATmega328P. It serves as the brain of the project, executing the programmed code and controlling the connected hardware components.
• RFID Module (e.g., MFRC522): The RFID module is used for reading RFID tags. In this case, the MFRC522 module is a common RFID reader/writer module that communicates using SPI (Serial Peripheral Interface) protocol. It can read RFID tags within its proximity.
• SG90 Servo Motors: Servo motors are used for controlling the movement of physical objects. The SG90 servo motors are commonly used in small-scale projects. In this case, they are employed to simulate the opening and closing of the toll gate.
• Red and Green LEDs: Light-emitting diodes (LEDs) are used as visual indicators. A red LED is used to indicate that the gate is closed or an invalid RFID tag, while a green LED indicates that the gate is open, or a valid RFID tag is detected.
• Resistors: Resistors are used to limit the current flowing through the LEDs, preventing them from burning out. The specific resistor values depend on the LED specifications and the desired brightness.• Breadboard and Jumper Wires: The breadboard provides a platform for easily connecting and prototyping electronic circuits without soldering. Jumper wires are used to establish connections between different components on the breadboard.
• Power Supply: The Arduino Uno can be powered through USB or an external power supply. Make sure that the power supply can provide sufficient power for both the Arduino and the connected components.
Hardware Assembly
• Initialization: The Arduino Uno initializes and sets up the RFID module, servo motors, and LEDs.
• RFID Tag Detection: The system constantly checks if a new RFID card is presented to the RFID module.
• RFID Card Reading: When an RFID card is detected, the system reads the unique identifier (UID) of the card using the RFID module.
• RFID Tag Validation: The Arduino compares the read RFID tag’s UID with a predefined value in the code (in this case, “YOUR_RFID_TAG”).
• If the RFID tag is valid, the system proceeds to open the toll gate; otherwise, it indicates an invalid card.
• Gate Operation: If the RFID tag is valid, the Arduino commands the servo motor to open the gate by moving to a specified angle (e.g., 0 degrees). The green LED is turned on to indicate that the gate is open.
• Delay: After a specified delay (e.g., 5 seconds), the Arduino commands the servo motor to close the gate by moving to another angle (e.g., 90 degrees).
• Gate Closing: The red LED is turned on to indicate that the gate is closed.
• Repeat: The system returns to monitoring for a new RFID card, and the process repeats
Working
• The servo motors simulate the physical opening and closing of the toll gate. You may need to adjust the servo angles in the code to match your specific gate mechanism.
• The delay after opening the gate is included to simulate a vehicle passing through. You can adjust this delay based on your desired system behavior.
• The code provided is a basic example, and depending on your specific requirements, you might want to add more features such as logging transactions, connecting to a database, or integrating with a display for user feedback.• Ensure that the RFID tag specified in the code matches the actual RFID tag you intend to use for testing. Replace “YOUR_RFID_TAG” with the correct value.
• Carefully handle electronic components, and ensure that the power supply is appropriate for the components used.
• Test the system in a controlled environment, and troubleshoot if necessary by checking connections, code, and component functionality. Adjust parameters in the code as needed.
Circuit Diagram of Automated Toll Collection System using RFID
Pin Connection
• Connect the MFRC522 RFID module SDA-SCK-MOSI-MISO-GND-RST-3.3V to Digital pins 10-13-11-12-GND-9-5V of Arduino Uno R3:
• Connect the SG90 servo motors 5V-GND-Servo signal to 5V-GND-Digital 5 of Arduino Uno R3:
• Connect the Red and Green LEDs Connect the anode (longer leg) of the Red LED to Digital Pin 7 through a resistor. Connect the cathode (shorter leg) of the Red LED to GND.Connect the anode (longer leg) of the Green LED to Digital Pin 6 through a resistor.Connect the cathode (shorter leg) of the Green LED to GND.• Power Supply: Connect the Arduino Uno to a power source using the USB cable connected to your computer or an external power supply.
• Ensure that the external power supply provides enough power for the Arduino Uno and the connected components.
Software Programming
• Set Up Arduino IDE
• Download and install the Arduino IDE (Integrated Development Environment) from the official Arduino website: Arduino Software.
• Open the Arduino IDE and make sure your Arduino board is selected under the “Tools” menu. Choose the appropriate board type (e.g., Arduino Uno) and the port your board is connected to laptop.
• Install the necessary libraries (MFRC522 and Servo) in the Arduino IDE.
• Connect the components based on the circuit diagram.
• Upload the code to your Arduino Uno.
• Make sure to replace “YOUR_RFID_TAG” with the actual RFID tag you want to use for testing. Adjust the servo angles and delay values as needed for your specific setup.
• This is a basic example, and you may need to refine and expand it based on your specific requirements and the capabilities of your components.
Code for Automated Toll Collection System using RFID
#include <Servo.h>
#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);
Servo gateServo;
const int redLed = 7;
const int greenLed = 6;
void setup() {
Serial.begin(9600);
SPI.begin();
mfrc522.PCD_Init();
gateServo.attach(5);
pinMode(redLed, OUTPUT);
pinMode(greenLed, OUTPUT);
closeGate();
}
void loop() {
if (mfrc522.PICC_IsNewCardPresent() && mfrc522.PICC_ReadCardSerial()) {
String rfid = "";
for (byte i = 0; i < mfrc522.uid.size; i++) {
rfid += String(mfrc522.uid.uidByte[i] < 0x10 ? "0" : "");
rfid += String(mfrc522.uid.uidByte[i], HEX);
}
rfid.toUpperCase();
Serial.println("RFID Tag: " + rfid);
if (rfid == "YOUR_RFID_TAG") {
openGate();
delay(5000);
closeGate();
} else {
Serial.println("Invalid RFID");
flashRedLed();
}
mfrc522.PICC_HaltA();
delay(1000);
}
}
void openGate() {
gateServo.write(0);
digitalWrite(greenLed, HIGH);
digitalWrite(redLed, LOW);
}
void closeGate() {
gateServo.write(90);
digitalWrite(greenLed, LOW);
digitalWrite(redLed, HIGH);
}
void flashRedLed() {
for (int i = 0; i < 3; i++) {
digitalWrite(redLed, HIGH);
delay(500);
digitalWrite(redLed, LOW);
delay(500);
}
}
Conclusion
• Power up the Arduino Uno using the power supply.
• Hold an RFID tag close to the RFID module. Ensure that the RFID tag matches the one specified in the code.
• Observe the behavior of the servo motors and LEDs. The gate should open for a valid RFID tag and close after a specified delay. The LEDs should indicate the status of the gate or the validity of the RFID tag. This was all about the project automated toll collection system using RFID.