An IoT-based automated toll collection system using RFID technology, Arduino Uno, Node.js, MongoDB, and Servo Motor. Designed to reduce traffic congestion and manual errors at toll plazas by enabling seamless, cashless, and real-time toll payments.
saimongu007-rfid_acces_control_system/
├── arduino.cpp # Arduino firmware controlling hardware logic
├── balanceManager.js # Handles balance deduction & management
├── db-connect.js # MongoDB connection utility
├── index.html # Optional UI (if applicable)
├── package.json # Node.js project metadata
├── script.js # Client-side JavaScript
├── server.js # Main Node.js server handling RFID and API
├── style.css # Styling for web interface
└── data/
└── balances.json # Stores card balances (fallback to DB)
- Arduino Uno
- MFRC522 RFID Reader
- RFID Tags (Cards)
- Servo Motor (Barrier Gate)
- LCD (I2C, 16x2)
- Buzzer
- Jumper Wires & Breadboard
- Real-time RFID tag detection
- Balance check and automatic toll deduction
- Gate control with servo motor
- Feedback via LCD display and buzzer
- Backend with REST API for admin use
- MongoDB for transaction & UID logging
-
Clone the repo:
git clone https://github.com/your-username/saimongu007-rfid_acces_control_system.git cd saimongu007-rfid_acces_control_system
-
Install dependencies:
npm install
-
Create a
.env
file:MONGO_URI=mongodb://localhost:27017/rfid_db COM_PORT=COM3
-
Run the server:
node server.js
Ensure Arduino is connected to the COM port specified in .env
.
- Upload
arduino.cpp
to the Arduino Uno using the Arduino IDE. - Make sure the correct COM port is selected.
- Power the hardware and monitor the LCD and servo action.
http://localhost:3000
- URL:
/api/uid
- Method:
GET
- Response:
{
"latestUID": {
"uid": "UID: 4A 3B 2C 1D",
"timestamp": "2025-04-21T14:05:00.000Z",
"access": "granted",
"balance": 40,
"message": "Access granted. Toll deducted."
},
"serialConnected": true
}
- URL:
/api/logs
- Method:
GET
- Response: Array of last 50 RFID scan records
- URL:
/api/balances
- Method:
GET
- Response:
{
"UID_1": 60,
"UID_2": 100
}
- URL:
/api/balance/:uid
- Method:
GET
- Response:
{
"uid": "4A3B2C1D",
"balance": 60
}
- URL:
/api/balance/add
- Method:
POST
- Body:
{
"uid": "4A3B2C1D",
"amount": 50
}
- Response:
{
"uid": "4A3B2C1D",
"balance": 110,
"message": "Balance added successfully"
}
- URL:
/api/toll
- Method:
GET
- Response:
{
"amount": 10
}
{
"error": "Error message describing the issue."
}
- Ensure the
.env
file contains correctMONGO_URI
andCOM_PORT
- MongoDB must be running locally or on cloud
- Server listens to serial data from Arduino and responds accordingly
- RFID logs are stored in
rfid_logs
collection in MongoDB - Balances are handled through both
balances.json
and MongoDB
- Add user-facing dashboard with login/authentication
- SMS/Email notifications on successful toll deduction
- Vehicle type-based dynamic toll rates
- Cloud-based remote admin panel
This project is open-source and free to use for educational purposes.
Developed by Badhan Das , Saimongu Marma & Prantika Chowdhury
IoT Based Project Development (CSE 342)
East Delta University, Bangladesh