Premium

RFID Smart Parking System

A reader does not report one tap — it reports a burst of reads, and only the database's own toggle can say what actually happened.

  • Arduino
  • RFID
  • MySQL

About this project

An Arduino at the gate reads an RFID tag with an MFRC522 module, opens a barrier LED, and prints every single read over serial as CSV. bridge.py reads that stream — live, or from a bundled sample log if you have no hardware at all — and turns it into correct ENTER/EXIT records and a live occupancy count in MySQL.

An RFID reader does not report "a card was presented once." It reports "a card is in range," over and over, for as long as a human hand holds it near the antenna — one tap is a burst of reads, not one event. A naive handler that treats every read as one event can flip a car's own status back and forth mid-swipe. This project fixes it two ways: a debounce keyed per UID, so a chattering burst collapses to exactly one event without also swallowing a different car that arrives a millisecond later, and a toggle driven by what the database currently believes rather than what the Arduino's own un-debounced local guess says. Occupancy itself is a COUNT() of live rows, and the README proves — with a real run, not a claim — exactly how a running counter kept alongside it quietly drifts the first time anyone corrects a row by hand.

What you will learn

  • Debounce a stream of sensor reads keyed per entity, not with one blanket ignore window
  • Drive a status toggle from durable database state instead of trusting a device's local guess
  • Compute a live count with COUNT() and prove, by actually running it, why a running counter drifts
  • Parse a real serial CSV stream and handle a torn or malformed line without crashing
  • Read an SPI protocol from a datasheet and reason through timing with no toolchain to compile against

Before you start

  • Comfortable with Python and basic SQL
  • MySQL installed and reachable — any recent version
  • Optional hardware: an Arduino UNO and an MFRC522 RFID module

New to Arduino? The free Arduino course covers everything this project assumes.

Academic integrity notice

These projects are provided for learning, experimentation and reference. Understand the code, modify it for your own requirements, and acknowledge external work according to your institution’s academic policies. Priodemy does not supply work to be submitted as your own.