
Metro smart automated systems always look cool to us. You can scan and rescan to travel just using a MetroCard. No need for special personnel or anything—just recharge the card, and you’re ready to travel.
Here, we will design our own version of this technology.
Our Smart Metro System aims to create a smart ticketing solution using RFID technology. This system allows passengers to use RFID cards for metro rides, automatically deducting fares and updating the card balance accordingly.
It consists of two main components: the RFID card reader/writer and the web server interface for monitoring card balances and transactions.
Two different machines are made: one is the RFID Card Balance Writer, controlled by the manager at the metro station, where you pay cash, and your card gets recharged with the paid amount. The other is the RFID Metro Station Entry/Exit Device, where you scan the card at entry to board the metro and scan again at exit.
The amount on the card is deducted and updated, and the same is displayed wirelessly to the metro station staff. The machine itself keeps a record of each entry and exit, and the scanned card balance and UUID are displayed to you as well on a screen via a webpage opened by that device.

Bill of Materials
In this design, we use a small development board, specifically the IndusBoard Coin, and an RFID reader/writer module, the RC522 reader/writer. If you use just one setup, you can employ a single IndusBoard Coin and RC522 reader/writer module.
First, configure it to recharge the card, then reupload the code and reconfigure the same circuit for the station entry/exit system. Alternatively, you can use two separate setups: one for the metro entry and exit system and another for the recharge module. The complete list of components is provided in the table below.
Components | Quantity |
IndusBoard Coin | 2 |
Servo Motor | 1 |
RC522 RFID READER WRITER | 2 |
RFID Tag/card | 1 |
Code for RFID-based Metro Station System
Here, we need two codes: one for the recharge device and another for the metro card scan system for entry and exit. In both cases, we use the RFID read and write functions.
For the recharge device, we first read the card and then recharge it with the amount the user pays. For the metro entry and exit scan system, we read the card at entry, and at exit, we deduct the balance for the travel and update the card with the new balance.
First, we’ll create the recharge code.
Recharge Code
Start by installing the RFID reader library “MFRC522” using the Library Manager. Then, configure and define the SPI pins in the code based on your connection with the IndusBoard.
Next, check for a card scan on the RFID reader/writer. When a card is detected and scanned, create the code to delete the data in the card’s blocks and update it with the new data from the Serial Monitor. This data is the recharge amount.
For example, if a person wants to recharge with 150 rupees, we send “150” via the Serial Monitor, and the new card balance amount will be updated in the card’s storage.


Metro Card Scan Code
Now we will make the scan code that will allow the person to enter the metro or subway, and then on exit, automatically deduct the balance from the card and update it with the new balance.
Here, we first check the scanned card’s UUID and then determine if it’s an entry or an exit, deduct the balance from the card, and update the same balance.
Then, display the same wirelessly in a record using an IoT dashboard for each scan, with the UUID and its current balance. The Wi-Fi credentials need to be configured in the code to get the device connected to Wi-Fi for real-time display of each scan entry and exit, and amount update on the card.

Circuit Connection
The connections remain the same for both devices, except that the servo motor is not needed for the recharge device and should be removed. Connect the components as per the circuit diagram. You can also change the pins and define the SPI pins in the code based on your connection.

Testing

Power the recharge device and scan the RFID card. Keep the card on the reader until the recharge is complete. Send the amount (e.g. 150 rupees) via the Serial Monitor to update the card’s balance.
For the entry/exit device, power the scan device, connect to WiFi, and scan the card at entry to log the UUID and timestamp. Scan again at exit to deduct the fare (e.g., 30 rupees), update the balance, and move the servo to open the gate. Check the IoT dashboard to confirm the UUID, entry/exit times, and updated balance are displayed wirelessly.