A real-time seat occupancy monitoring system built with an ESP32 microcontroller, FSR pressure sensors, Firebase Realtime Database, and a vanilla JS web dashboard.
- FSR sensors under each seat detect pressure via a voltage divider circuit
- ESP32 reads sensor values every 300ms and compares against a threshold (ADC > 500)
- On state change, ESP32 pushes the update to Firebase (
/seats/A1/state) - Web dashboard listens to Firebase in real time and updates the seat map instantly
- Alert banner triggers automatically when occupancy exceeds 85%
├── index.html # Dashboard UI and seat map
├── style.css # Styling and seat state visuals
├── main.js # Firebase listener and occupancy logic
├── config.js # Firebase config (not committed — see below)
├── config.example.js # Template for Firebase config
├── FSR.ino # ESP32 Arduino firmware
└── secrets.h # WiFi and Firebase credentials (not committed — see below)
- Create a Firebase project at firebase.google.com
- Enable Realtime Database
- Set database rules to allow read/write (restrict appropriately for production)
- Copy
config.example.js→config.js - Fill in your Firebase project credentials
- Open
index.htmlin a browser or deploy as a static site
- Open
FSR.inoin Arduino IDE - Install dependencies:
FirebaseESP32libraryWiFilibrary (bundled with ESP32 board package)
- Create a
secrets.hfile in the same folder asFSR.inowith the following contents:
// secrets.h — DO NOT COMMIT
#define WIFI_SSID "your_wifi_ssid"
#define WIFI_PASSWORD "your_wifi_password"
#define FIREBASE_HOST "your-project-default-rtdb.your-region.firebasedatabase.app"
#define FIREBASE_AUTH "your_firebase_auth_key"- Flash
FSR.inoto your ESP32 board
| Component | ESP32 Pin |
|---|---|
| FSR Seat A1 | G32 |
| FSR Seat A2 | G33 |
| FSR Seat A3 | G34 |
| FSR Seat A4 | G35 |
| LED A1 | G13 |
| LED A2 | G27 |
| LED A3 | G14 |
| LED A4 | G25 |
Each FSR is wired as a voltage divider with a 10kΩ resistor. All FSRs use ADC1 pins to avoid interference from the Wi-Fi module, which disables ADC2 when active.
- Live seat status updates with under 2 second latency
- Per-seat LED indicators that work offline
- Occupancy percentage and count summary
- High-density alert banner at 85% occupancy
- Responsive web dashboard for desktop and mobile
- Change-only Firebase writes to minimize network usage
- Fixed ADC threshold of 500 may need tuning depending on seat type, cushion thickness, or user weight
- Dashboard requires active Wi-Fi and Firebase connection to reflect live data
- One ESP32 handles up to 4 ADC1-connected sensors; additional seats require additional boards
- Static objects on seats such as bags will register as occupied
config.js contains your Firebase API key and secrets.h contains your WiFi and Firebase credentials. Neither file should ever be committed. Both are listed in .gitignore. Use config.example.js as the committed reference template for the frontend config. For the firmware, manually create secrets.h locally using the template provided above.
- Hardware: ESP32, FSR pressure sensors, LEDs
- Firmware: C++ via Arduino IDE
- Backend: Firebase Realtime Database
- Frontend: HTML5, CSS3, Vanilla JavaScript, Firebase Web SDK
| Name |
|---|
| Akilan V S |
| Subash Venkat |
| Abhishek Prabakar |