Skip to the content
2 layers150 × 110 mmLab, the printed circuit board in 3D

University EE labs share 10 workbenches between many student groups. Today, a lab staff member must physically walk to each table to switch power on or off, and there is no record of who used which table, when, or for…

Size
150 × 110 mm
Copper layers
2
Thickness
1.6 mm
Parts
48
Nets
59
Pads
164
Tracks, vias
221, 0
Pours
1
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
11 May 2026
Updated
11 May 2026

Overview

Lab is an open-source printed circuit board by Yashwanth786, from the Yashwanth786/Centralized_Power_Distribution_System repository on GitHub. It is a 2-layer board of 150 × 110 mm with 48 parts on 59 nets, routed with 221 tracks and 0 vias.

It is built around the HLK-PM01, MT3608 and TP4056-42-ESOP8, with the ULN2003A, XIAO ESP32C3 and SS34 among its other parts. Its parts include 10 resistors, 8 connectors, 5 capacitors, 5 diodes and 5 switches. It belongs with the ESP32 and RISC-V boards of this library.

Main components

7

README

README.md

Centralized Power Distribution System

IIT Hyderabad — Electrical Engineering Laboratory

An IoT-based smart power management system for EE lab workbenches. Students request table power through a web portal by entering their roll number; lab staff monitor and control all 10 tables in real time from a central dashboard — powered by ESP32-C3 microcontrollers, Firebase Realtime Database, and automatic 18650 Li-Ion battery backup.


System Overview


Hardware [blocked] Firmware [blocked] Frontend [blocked]


Table of Contents

  1. Introduction & Overview
  2. Features
  3. System Architecture
  4. How It Works
  5. Hardware Design
  6. Software Design & Frameworks
  7. Repository Structure
  8. Setup & Workflow
  9. How to Run
  10. Portal Walkthrough — Screenshots
  11. Demo Video
  12. Applications
  13. Challenges Faced
  14. Future Improvements
  15. Team

1. Introduction & Overview

University EE labs share 10 workbenches between many student groups. Today, a lab staff member must physically walk to each table to switch power on or off, and there is no record of who used which table, when, or for how long. Power is sometimes left ON after students leave, equipment runs unattended, and there is no centralized emergency cut-off.

The Centralized Power Distribution System (CPDS) eliminates this entirely. A custom PCB at each table drives three relay-controlled socket outlets under the control of a cloud-connected Seeed Studio XIAO ESP32-C3. A React + Firebase web portal provides two portals in one URL — a Student Portal where students type their roll number and choose an available table, and a Staff Dashboard where one instructor sees all 10 tables live and can cut any session in one click.

Communication flows through Firebase Realtime Database — the portal writes isOn: true to a table's path, the ESP32 there reads it within 2 seconds and closes the relays, and the sockets go live. All events are logged with timestamps. A built-in 18650 Li-Ion battery automatically takes over if mains power is lost, and a physical emergency button on each table cuts power instantly without needing a network round-trip.


2. Features

FeatureDescription
Manual Roll Number EntryStudents type their roll number in the portal — no QR scan, no app install, works on any browser
Live Table AvailabilityStudent portal dropdown shows only currently available (unoccupied) tables in real time
3-Hour Session TimerEach table allocation runs for 3 hours; staff dashboard shows live countdown per table
Staff DashboardLive grid of all 10 tables: status badge, student roll, session start time, countdown, power source, and action button
Firebase Real-Time SyncPortal ↔ ESP32 changes propagate in under 2 seconds via Firebase onValue listeners
Mains / Battery Auto-FailoverADC on GPIO D0 monitors mains via voltage divider; AO3401A P-MOSFET switches to 18650 + MT3608 boost when mains drops
Physical Emergency ButtonNO push button on each table — immediately cuts all 3 relays and writes to Firebase without waiting for a network response
Bi-Color LED IndicatorGreen = mains present & running; Red = battery mode / error / boot
10-Second HeartbeatEach ESP32 writes lastSeen every 10 s; dashboard shows 🔴 Offline if heartbeat stops
Activity Log PanelEvery session start, end, expiry, emergency, and power event is logged to Firebase with a human-readable timestamp
All-Off Emergency ButtonStaff button with confirmation modal cuts power to all 10 tables simultaneously
Session Auto-ExpiryDashboard Countdown component auto-calls deallocateTable() when a 3-hour session reaches zero
Recent Allocations TableStudent roll-entry page shows the last 5 active allocations live — helps students see if their table is already taken

3. System Architecture

text
┌──────────────────────────────────────────────────────────────────────┐
│                          Firebase Cloud                              │
│                                                                      │
│   Realtime Database                    Firebase Hosting              │
│   ────────────────                     ────────────────              │
│   tables/T-XX/isOn          ◄──────    React Web Portal             │
│   tables/T-XX/studentRoll              ├── Student Portal            │
│   tables/T-XX/starttimeLabel  ──────►  │   Roll number entry         │
│   tables/T-XX/sessionEnd               │   Table selection           │
│   power/T-XX/source         ◄──────    │   Confirmation screen       │
│   power/T-XX/lastSeen                  └── Staff Dashboard           │
│   logs/{id}                                All 10 tables live        │
│   logCount                                 End Session / All Off     │
└──────────────────────┬───────────────────────────────────────────────┘
                       │  Wi-Fi  IEEE 802.11 b/g/n
         ┌─────────────┼──────────────┐
         │             │              │
   ┌─────▼──────┐ ┌────▼───────┐ ┌──▼──────────┐
   │  Table T-01│ │ Table T-02 │ │  Table T-10  │
   │ XIAO ESP32 │ │ XIAO ESP32 │ │  XIAO ESP32  │
   │ Custom PCB │ │ Custom PCB │ │  Custom PCB  │
   │ ULN2003APG │ │ ULN2003APG │ │  ULN2003APG  │
   │ 3× Relays  │ │ 3× Relays  │ │  3× Relays   │
   │ HLK-PM01   │ │ HLK-PM01   │ │  HLK-PM01    │

Data flow summary:

  • Student submits roll number → allocateTable(id, roll) → Firebase tables/T-XX/isOn = true
  • ESP32 polls Firebase every 2 s → reads isOn = true → setRelays(true) → sockets live
  • ESP32 writes power/T-XX/lastSeen every 10 s → dashboard flags Offline if missed
  • Staff clicks End Session → deallocateTable(id) → Firebase isOn = false → ESP32 reads → relays open

4. How It Works

Student Flow

text
Student opens web portal on any browser
              │
              ▼
Home Page  →  clicks "Student Portal" card
              │
              ▼
Roll Number Entry page (StudentScanPage):
  - Text input: type roll number e.g. "EE22BTECH11001"  →  press Next / Enter
  - Recent Allocations table shows last 5 active sessions live from Firebase
              │
              ▼
Table Selection page (StudentSelectPage):
  - Dropdown populated in real time with ONLY unoccupied tables
  - Occupied tables are excluded automatically
  - If all tables are full → yellow warning banner appears
  - Student selects table  →  "Allocate Table"
              │
              ▼
allocateTable("T-03", "EE22BTECH11001") writes to Firebase:
     tables/T-03/isOn            = true
     tables/T-03/studentRoll     = "EE22BTECH11001"
     tables/T-03/starttimeLabel  = "07/05/2026, 03:45:12 pm"
     tables/T-03/sessionEnd      = <epoch ms + 3 hours>
     tables/T-03/sessionEndLabel = "07/05/2026, 06:45:12 pm"

Staff Flow

text
Staff opens portal  →  "Technical Staff Portal"  →  Password entry
              │
              ▼
StaffLoginPage:
  - Password compared against hardcoded STAFF_PASSWORD
  - Correct  →  sessionStorage.setItem("staffAuth","true")  →  navigate to dashboard
  - Wrong    →  inline error message, password cleared
              │
              ▼
StaffDashboardPage (auth guard: redirects if staffAuth not set):
  - Three Firebase listeners started on mount:
      subscribeToTables  →  setTables state
      subscribeToPower   →  setPower  state
      subscribeToLogs    →  setLogs   state
  - Cleanup: all three unsubscribed on unmount
              │
              ▼
Dashboard header shows live stats chips: "3 Occupied  |  6 Available  |  1 Offline"

Dashboard table row per T-01…T-10:
  [Table ID] [Status badge] [Student Roll] [Start Time] [Countdown] [Power badge] [Action]
              │
              ▼
Staff clicks "⛔ End Session" on T-03:

Emergency Button (Hardware)

text
Student presses NO push button on table edge (GPIO D1, INPUT_PULLUP)
              │
              ▼
ESP32 loop: digitalRead(PIN_EMERG_BTN) = LOW
50 ms debounce elapsed, btnWasPressed was false
              │
              ▼
emergTripped = true
setRelays(false) IMMEDIATELY — no Firebase wait
D4, D3, D2 → LOW  →  relay contacts open  →  sockets DEAD
              │
              ▼
Firebase writes (best-effort):
  firebaseDeallocate("emergency_button")  →  tables/T-XX/isOn = false
  firebaseAddLog("Emergency button pressed — relays OFF", "emergency")
Red LED ON
              │
              ▼
Button released: btnWasPressed=false, emergTripped=false (auto-reset latch)
Table ready for next student

Mains Failure & Battery Failover

text
Mains power drops  →  HLK-PM01 output falls
              │
              ▼
ADC on GPIO D0 reads voltage divider:  analogRead(PIN_MAINS_ADC) < 500
mains (bool) becomes false, lastMailsState was true → change detected
              │
              ▼
updateLED(false): Green OFF, Red ON
firebaseSetPower("battery"):
  power/T-XX/source   = "battery"
  power/T-XX/lastSeen = <readable time>
              │
              ▼
If relays were ON when mains dropped:
  setRelays(false)
  firebaseDeallocate("mains_lost")
  firebaseAddLog("Mains power lost — relays turned OFF", "power")
              │
              ▼
AO3401A P-MOSFET hardware path (automatic, no firmware needed):
  HLK-PM01 rail drops  →  MOSFET gate control switches
  18650 Li-Ion  →  MT3608 boost converter  →  5V rail maintained
  ESP32 and relays stay powered
              │

5. Hardware Design

PCB Overview

Custom 2-layer PCB designed in KiCad 9. One board per lab table — 10 boards total.

PCB 3D Render

ParameterValue
Design ToolKiCad 9.x
Layers2 — F.Cu (signal + power) / B.Cu (High Voltage AC Power)
Min trace width0.3 mm signal / 1.5 mm mains
Mains isolation3 mm creepage gap + PCB slot (Edge.Cuts)
Surface finishHASL
Board thickness1.6 mm
Copper weight1 oz (35 µm)

Schematic

Schematic

PCB Layout

PCB Front

Pin Map — XIAO ESP32-C3

LabelGPIODirectionFunction
D02INPUT (ADC 12-bit)Voltage divider output — mains sense, threshold 500
D13INPUT (INPUT_PULLUP)Emergency button — NO contact, active LOW
D24OUTPUTULN2003 I3 → Relay 3 — HIGH = relay energised = socket ON
D35OUTPUTULN2003 I2 → Relay 2
D46OUTPUTULN2003 I1 → Relay 1
D57OUTPUTGreen LED — HIGH = mains present, no error
D1010OUTPUTRed LED — HIGH = battery mode / error / boot

Power Architecture

text
230V AC Mains
     │
 [Varistor MOV]   ← surge protection
     │
 [HLK-PM01]       ← isolated SMPS, 230VAC → 5V DC
     │
     ├──────────── 5V Rail ─────────────────────────────────────┐
     │                                                          │
     │         [TP4056 charger] ←─── charges 18650 from 5V     │
     │                │                                         │
     │           [18650 Li-Ion]                                 │
     │                │                                         │
     │           [MT3608 Boost] → 5V                            │
     │                │                                      [AO3401A P-MOSFET]
     │                └─────────────────────────────────────────┘
     │                                                          │
     └──────────────────────────── 5V Supply Rail ─────────────┘
                                         │
                              [ESP32-C3 + ULN2003 + 3× Relays]
  • Normal: HLK-PM01 supplies the 5V rail; AO3401A gate held high → MOSFET OFF → battery path blocked
  • Mains failure: HLK-PM01 drops; AO3401A switches → MT3608 boosts 18650 → 5V rail sustained
  • Charging: TP4056 charges 18650 from the 5V mains rail while mains is present
  • Protection: SS34 Schottky diodes on all relay flyback paths; Varistor on AC input for surge events

Bill of Materials (BOM)

#ComponentDescriptionMPNPrice (Rs.)Qty
1Seeed Studio XIAO ESP32-C3Wi-Fi microcontroller, USB-C, castellatedGeneric6001
25V 1-Channel Relay ModuleSRD-05VDC-SL-C coil, 10A contactsSRD-05VDC-SL-C333
3ULN2003APG (Toshiba)50V / 500mA 7-ch Darlington array — relay driverULN2003APG191
4Momentary Push SwitchNO contact, active-low emergency buttonTSD001B07018A201
5Hi-Link HLK-PM01230VAC → 5V / 3W isolated SMPSHLK-PM012001
618650 Li-Ion Battery3.7V, 2500mAh backup cellINR18650-25P811
718650 Battery HolderSMD/SMT single cell1042P331
8TP4056 Charging ModuleAdjustable 1A Li-Ion chargerTP4056141
9MT3608 Boost Converter2A max DC-DC step-up moduleMT3608361
10Bi-Color LED5mm Red/Green dual indicatorXL-A524SURSYGW31
116-Pin DPDT Self-Lock SwitchLatching power switch—61
12AO3401A MOSFETP-channel SOT-23, mains/battery path switchAO3401A41
133-Pin Screw Terminal3.5mm pitch — mains & load connectionsXY302V-3.5-3P124
14SS34 Schottky Diode3A / 40V — relay flyback + path blocking—74
1522µH Inductor SMDMT3608 boost converter inductorASPI-0630LR-220M-T15701
16Varistor D15.5mm P7.5mmMOV surge protection on AC input561KD10J141
17PCBTotal PCB manufacturing cost—29361

Total cost = Rs. 4211 /- per Table.

Component Footprints

ComponentKiCad FootprintLibrary
XIAO ESP32-C3SeeedStudio_XIAO_ESP32C3Custom (castellated pads)
Relay ModuleRelay_THT:HF41FStandard
ULN2003APGPackage_DIP:DIP-16_W7.62mmStandard
Momentary Push SwitchButton_Switch_THT:SW_PUSH_6mmStandard
HLK-PM01Converter_ACDC:HLK-PM01Standard
18650 Battery HolderBatteryHolder_THT:BatteryHolder_Keystone_1042PStandard
TP4056 ModuleModule_TP4056Custom
MT3608 Boost ModuleModule_MT3608Custom
AO3401A MOSFETmosfet.pretty:SOT23-3Custom — included in kicad/mosfet.pretty/
Bi-Color LEDLED_THT:LED_D5.0mm_2pinStandard
3-Pin Screw TerminalTerminalBlock_Phoenix:MKDS_3-3.5Standard
100µF Cap DIPCapacitor_THT:CP_Radial_D8.0mm_P3.50mmStandard
22µF Cap DIPCapacitor_THT:CP_Radial_D6.3mm_P2.50mmStandard
SS34 Schottky DiodeDiode_THT:D_DO-201ADStandard
22µH Inductor SMDInductor_SMD:L_Bourns_SRR1260Standard
All THT ResistorsResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mmStandard
VaristorVaristor_THT:RV_D15.5mm_P7.5mmStandard

Note: The mosfet.pretty/ folder is included in kicad/ as a relative-path library. The project will open without missing footprint errors on any machine as long as the folder structure is kept intact.


6. Software Design & Frameworks

Tech Stack

LayerTechnologyDetails
FrontendReact 18.2create-react-app scaffold
RoutingReact Router DOM v6.21BrowserRouter + Routes + Route
DatabaseFirebase Realtime Database v10.7Real-time onValue listeners + set / update writes
AuthSession-based (hardcoded password)sessionStorage.setItem("staffAuth","true")
HostingFirebase HostingDeployed via firebase deploy
FirmwareArduino / C++ on ESP32-C3Firebase_ESP_Client by Mobizt, ArduinoJson by Blanchon

Page Map

RouteComponentWhat it does
/HomePageLanding — two hover cards: Technical Staff Portal & Student Portal
/student/scanStudentScanPageRoll number text input + Enter key support + recent allocations live table
/student/selectStudentSelectPageLive dropdown of available tables + "Allocate Table" button + loading state
/student/confirmStudentConfirmPageSuccess card — roll, table (large green), "power is ON", 5-second countdown redirect
/staff/loginStaffLoginPagePassword input with show/hide toggle — stores auth in sessionStorage
/staff/dashboardStaffDashboardPageFull dashboard — 3 Firebase listeners, 10-table grid, logs panel, ALL OFF modal

Firebase Database Schema

json
{
  "tables": {
    "T-01": {
      "isOn": true,
      "studentRoll": "EE22BTECH11001",
      "starttimeLabel": "07/05/2026, 03:45:12 pm",
      "sessionEnd": 1715079912000,
      "sessionEndLabel": "07/05/2026, 06:45:12 pm"
    }
  },
  "power": {
    "T-01": {
      "source": "mains",
      "lastSeen": "07/05/2026, 03:50:00 pm"
    }
  },
  "logs": {
    "1": {
      "message": "Table T-01 allocated to student EE22BTECH11001",
      "tableId": "T-01",
      "type": "session_start",
      "timestamp": "07/05/2026, 03:45:12 pm"
    }
  },
  "logCount": 1
}

Key Functions — database.js

FunctionDescription
subscribeToTables(cb)onValue on tables/ — returns Firebase unsubscribe fn; called in useEffect cleanup
subscribeToPower(cb)onValue on power/ — same pattern
subscribeToLogs(cb, limit)onValue on logs/ with orderByKey + limitToLast(100), sorted newest-first
allocateTable(id, roll)Writes isOn=true, roll, start time label, sessionEnd epoch + label; adds session_start log
deallocateTable(id, reason)Writes isOn=false, lastUsed; adds session_end or expire log based on reason
allTablesOff()Promise.all over all 10 table deallocations; adds single staff log
clearLogs()Sets logs and logCount to null/0
clearAllData()Called on App.js mount — resets all tables to isOn:false and power to offline
addLog({message, tableId, type})Reads logCount, increments, writes to logs/{n} with human timestamp
toReadable(ms)Formats epoch ms → "DD/MM/YYYY, HH:MM:SS am/pm" (matches ESP32 output)

ESP32 Firmware — Timing Constants

#defineValuePurpose
MAINS_THRESHOLD500 (ADC counts)12-bit ADC reading below this = mains lost
DEBOUNCE_MS50 msEmergency button software debounce window
FIREBASE_POLL_MS2000 msInterval between Firebase getBool reads for isOn
HEARTBEAT_INTERVAL_MS10000 msInterval between lastSeen + power source writes

App.js — Startup Behaviour

On every portal load, App.js calls clearAllData() in a useEffect. This resets all 10 tables to isOn: false and all power entries to source: "offline" — ensuring a clean slate each time staff open the portal.


7. Repository Structure

text
centralized-power-distribution/
│
├── README.md                              ← This file
├── PCB.pdf                                ← Hardware reference (schematic, BOM, footprints, gerbers)
├── .gitattributes
│
├── kicad/                                 ← All KiCad design files
│   ├── lab.kicad_pro                      ← Open this in KiCad 7 to load the full project
│   ├── lab.kicad_sch                      ← Complete schematic
│   ├── lab.kicad_pcb                      ← PCB layout with copper pours and component placements
│   ├── lab.kicad_prl                      ← Project-level layer/render preferences
│   ├── New_Library.kicad_sym              ← Custom schematic symbols library
│   ├── mosfet.kicad_sym                   ← AO3401A schematic symbol
│   ├── mosfet.pretty/
│   │   └── SOT23-3.kicad_mod              ← Custom AO3401A PCB footprint (SOT-23-3, 0.95mm pitch)
│   ├── sym-lib-table                      ← Symbol library path references
│   ├── fp-lib-table                       ← Footprint library path references
│   └── lab_output/                        ← Gerber files — ZIP this folder and send to manufacturer
│       ├── lab-F_Cu.gbr                   ← Front copper traces
│       ├── lab-B_Cu.gbr                   ← Back copper ground plane
│       ├── lab-F_Mask.gbr                 ← Front solder mask
│       ├── lab-B_Mask.gbr                 ← Back solder mask
│       ├── lab-F_Silkscreen.gbr           ← Front silkscreen labels
│       ├── lab-B_Silkscreen.gbr           ← Back silkscreen

8. Setup & Workflow

Prerequisites

  • Node.js ≥ 16 and npm
  • Arduino IDE 2.x
  • KiCad 9.x (for PCB files)
  • A Firebase project with Realtime Database enabled

Step 1 — Firebase Project

  1. Go to console.firebase.google.com → Create project
  2. Enable Realtime Database — choose Asia Southeast 1 for lowest latency from India
  3. Set temporary development rules:
    json
    { "rules": { ".read": true, ".write": true } }
  4. Copy your Web API Key from Project Settings → General
  5. Copy your Database URL from the Realtime Database panel
  6. Create a Legacy Database Secret from Project Settings → Service Accounts → Database Secrets — this is needed by the ESP32

Step 2 — Web Portal

bash
cd web-portal/
npm install
File 1 — Firebase credentials

Open web-portal/src/firebase/config.js and replace the values directly:

js
const firebaseConfig = {
  apiKey:            "YOUR_WEB_API_KEY",
  authDomain:        "YOUR_PROJECT_ID.firebaseapp.com",
  databaseURL:       "https://YOUR_PROJECT_ID-default-rtdb.asia-southeast1.firebasedatabase.app",
  projectId:         "YOUR_PROJECT_ID",
  storageBucket:     "YOUR_PROJECT_ID.appspot.com",
  messagingSenderId: "YOUR_SENDER_ID",
  appId:             "YOUR_APP_ID"
};
File 2 — Staff password

Open web-portal/src/pages/StaffLoginPage.jsx and find line near the top:

js
const STAFF_PASSWORD = "your_chosen_password";

Step 3 — ESP32 Firmware

Install Arduino libraries (Tools → Manage Libraries):

  • Firebase ESP Client by Mobizt
  • ArduinoJson by Benoit Blanchon

Add XIAO board package — File → Preferences → Additional Boards Manager URLs:

text
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

Then install esp32 by Espressif Systems in Boards Manager.

Edit the 5 marked lines at the top of lab_controller_v3.ino:

cpp
#define WIFI_SSID         "YOUR_WIFI_SSID"        // your Wi-Fi network name
#define WIFI_PASSWORD     "YOUR_WIFI_PASSWORD"     // your Wi-Fi password
#define TABLE_ID          "T-01"                   // change per board: T-01 … T-10
#define FIREBASE_API_KEY  "YOUR_WEB_API_KEY"       // from Firebase Project Settings → General
#define DATABASE_URL      "YOUR_DATABASE_URL"      // from Firebase Realtime Database panel

Also update the legacy token:

cpp
config.signer.tokens.legacy_token = "YOUR_DATABASE_SECRET"; // from Project Settings → Service Accounts → Database Secrets

Arduino IDE board settings:

SettingValue
BoardXIAO_ESP32C3
Upload Speed921600
USB CDC On BootEnabled

Flash each of the 10 boards with a unique TABLE_ID (T-01 through T-10). After flashing, open Serial Monitor at 115200 baud — first lines should be:

text
=== IIT-H EE Lab ESP32 v3.0 ===
Table: T-01
[WiFi] Connecting to YOUR_SSID
[Firebase] Connected OK
[Boot] Ready.

9. How to Run

Web Portal — Development

bash
cd web-portal/
npm start
# Opens at http://localhost:3000

Web Portal — Production (Firebase Hosting)

bash
npm run build
npm install -g firebase-tools
firebase login
firebase init hosting
# → Public dir: build
# → Configure as SPA: Yes
# → Overwrite build/index.html: No
firebase deploy
# Live at https://your-project.web.app

ESP32 Boards

  1. Connect XIAO ESP32-C3 via USB-C
  2. Set the correct TABLE_ID for this board
  3. Select the correct port in Arduino IDE
  4. Click Upload (Ctrl+U)
  5. Verify serial output shows correct TABLE_ID
  6. Repeat for all 10 boards (T-01 → T-10)

Once all boards are powered and connected to Wi-Fi, the staff dashboard will show ⚡ Mains for each online table within 10 seconds (first heartbeat).


10. Portal Walkthrough — Screenshots

Home Page

Home Page

The landing page displays the IIT Hyderabad logo, university name, and lab title. Two clickable cards navigate to the Staff and Student portals. Cards lift and border turns orange on hover.


Student — Roll Number Entry

Roll Number Entry

Students type their roll number (e.g. EE22BTECH11001) and press Next or hit Enter. A "Recent Allocations" table below the input shows the last 5 active sessions — roll number, table, and date — pulled live from Firebase.


Student — Table Selection

Table Selection

A dropdown lists only currently unoccupied tables in real time. The page shows how many tables are available. If all tables are occupied, a yellow warning banner appears instead of the dropdown. Student selects a table and clicks Allocate Table.


Student — Confirmation

Confirmation

A green-bordered card confirms the allocation: roll number, allotted table number displayed large in green, "please go to the table, the power is ON", and session duration (3 hours). The page automatically redirects back to home after 5 seconds.


Staff — Login

Staff Login

A centered card with a lock icon and a password field. The 👁️ button toggles password visibility. Correct password stores staffAuth in sessionStorage and navigates to the dashboard. Wrong password shows an inline red error.


Staff — Dashboard

Staff Dashboard

The full control centre. A sticky orange header shows "Technical Staff Portal", live status chips (Occupied / Available / Offline counts), a Show Logs toggle, and the red ⛔ ALL OFF emergency button.

The main table has one row per lab table (T-01 to T-10), each showing:

  • Table ID — bold identifier
  • Status badge — 🟢 Available / 🟠 Occupied (pulsing dot) / ⚫ Off
  • Student Roll — monospace, shown only when occupied
  • Start Time — human-readable session start timestamp
  • Time Remaining — live HH:MM:SS countdown (turns red in last 10 minutes)
  • Power Source — ⚡ Mains / 🔋 Battery / 🔴 Offline
  • ⛔ End Session — red button visible only for occupied tables

The Activity Logs panel (toggled from header) shows all events with type-coded badges: SESSION START / SESSION END / EXPIRE / EMERGENCY / POWER / STAFF. A "Clear Logs" button resets the log in Firebase.


11. Demo Video

Watch the demo video here: Demo Video)

What the demo shows:

  1. Student enters roll number → selects table → confirmation screen → sockets go live
  2. Staff dashboard updates in real time — table flips to Occupied with live countdown
  3. Staff ends session from dashboard → relays cut → table returns to Available
  4. Emergency button press on table → immediate relay cutoff → dashboard updates to Off
  5. Mains disconnected → battery failover → 🔋 Battery badge appears on dashboard

12. Applications

DomainUse Case
University EE LabsControlled, authenticated, logged power access for shared workbenches — primary use case
School Electronics LabsStaff-supervised power control preventing unsupervised student equipment use
MakerspacesPer-member metered power access with session logging and time limits
Industrial Test StationsRemote power management for shared test benches in manufacturing or R&D environments
Exam / Assessment CentresTimed, per-seat power allocation with automatic expiry for practical examinations

13. Challenges Faced

#ChallengeCategoryResolution
1ADC mains-sense gave noisy readings — false failover triggers every few secondsHardwareAdded 100µF + 22µF capacitors across voltage divider output to GND; 5-consecutive-reading hysteresis in firmware
2Relay chatter during mains → battery transition (~80 ms power sag caused ESP32 brownout)HardwareAdded 100µF bulk capacitor directly on 5V rail near ESP32 VCC pin — bridges the switchover gap
3AO3401A gate drive: ESP32 3.3V GPIO cannot fully turn OFF a 5V P-channel MOSFETHardwareAdded NPN transistor level-shift stage; 120kΩ pull-up to 5V rail for proper gate-high state
4KiCad standard library had no AO3401A SOT-23-3 footprint at correct 0.95mm pin pitchHardwareCreated mosfet.pretty custom footprint library — included in the repo
5Initial PCB layout violated IPC-2221 mains creepage distance between AC and DC tracesHardwareRedesigned layout with 3mm gap + physical PCB slot in Edge.Cuts layer
6Firebase streaming (persistent HTTPS) connection dropped frequently on lab Wi-Fi idle timeoutFirmwareSwitched to 2-second polling with Firebase.RTDB.getBool() — stable, latency acceptable for power control
7Emergency button mechanical bounce caused 3–5 spurious LOW reads per single pressFirmware50 ms software debounce + btnWasPressed latch; latch clears only on release (HIGH), not press
8onValue listeners stacked on re-navigation — 3 → 6 → 9 active listeners after 3 visits to dashboardSoftwareuseEffect cleanup returns and calls all three Firebase unsubscribe functions on component unmount
9Session countdown timer drifted 5–10 s per hour using setInterval decrement counterSoftwareChanged to Math.max(0, sessionEnd - Date.now()) per tick — always accurate, drift-free

14. Future Improvements

  • OTA Firmware Updates — Push new firmware to all 10 boards wirelessly via Firebase Functions; eliminates need to physically connect each ESP32
  • EEPROM-Based TABLE_ID Provisioning — Store TABLE_ID in flash memory; configure once over Serial without recompiling the firmware
  • Energy Metering — Add INA219 current sensor per table; log per-session energy consumption (Wh / kWh) to Firebase
  • Admin Analytics Dashboard — Usage heat maps, per-table uptime percentages, peak hours graphs, battery health indicators
  • Email / SMS Alerts — Notify staff automatically when a table goes offline, battery is low, or an emergency is triggered
  • RFID / ID Card Authentication — Replace manual roll number typing with RFID card tap for faster, error-free student identification
  • Tighter Firebase Security Rules — Rate-limit student allocations; validate roll number format server-side; restrict isOn writes to authenticated users only
  • Progressive Web App (PWA) — Add service worker and manifest so students can install the portal to their phone home screen with offline fallback

15. Team

NameRole NumberContribution
Chinthalapudi YashwanthEE22BTECH11016Hardware Design & PCB Layout (KiCad)
Abburi Naga Sai RamEE22BTECH11201ESP32 Firmware & Web Portal Development

Institution: Indian Institute of Technology Hyderabad
Department: Electrical Engineering
Course: Electronic System Design Project Lab
Faculty Advisor: Dr. Abhishek Kumar
Academic Year: 2025–26


Parts

48
QtyValueFootprintReferences
4Conn_01x02_PinConnector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalJ5, J6, J7, J8
4MountingHole_2.2mm_M2_DIN965_PadMountingHole:MountingHole_2.2mm_M2_DIN965_Pad2.2mm, 2.2mm, 2.2mm, 2.2mm
4SS34Diode_SMD:D_SMAD2, D3, D4, D5
30Resistor_SMD:R_0805_2012MetricR11, R12, R13
310kResistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P5.08mm_VerticalR2, R3, R7
3SANYOU_SRD_Form_CRelay_THT:Relay_SPDT_SANYOU_SRD_Series_Form_CK1, K2, K3
2100nFCapacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mmC1, C5
222uFCapacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mmC3, C4
2330Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P5.08mm_VerticalR8, R9
11.2kResistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P5.08mm_VerticalR1
1100uFCapacitor_THT:CP_Radial_D8.0mm_P3.50mmC2
1120kResistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P5.08mm_VerticalRf1
115kResistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P5.08mm_VerticalRg1
118650_Li_IonBattery:BatteryHolder_Keystone_1042_1x18650BT1
120kResistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P5.08mm_VerticalR6
122uHInductor_SMD:L_Abracon_ASPI-0630LRL1
1230V_ACTerminalBlock_Phoenix:TerminalBlock_Phoenix_PT-1,5-3-3.5-H_1x03_P3.50mm_HorizontalJ1
1AO3401Amosfet:SOT23-3Q1
1HLK-PM01Converter_ACDC:Converter_ACDC_Hi-Link_HLK-PMxxPS1
1LED_Dual_AAKLED_THT:LED_D5.0mm-3D1
1MT3608Package_TO_SOT_SMD:SOT-23-6U4
1Relay1TerminalBlock_Phoenix:TerminalBlock_Phoenix_PT-1,5-3-3.5-H_1x03_P3.50mm_HorizontalJ2
1Relay2TerminalBlock_Phoenix:TerminalBlock_Phoenix_PT-1,5-3-3.5-H_1x03_P3.50mm_HorizontalJ3
1Relay3TerminalBlock_Phoenix:TerminalBlock_Phoenix_PT-1,5-3-3.5-H_1x03_P3.50mm_HorizontalJ4
1SW_PushConnector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalSW1
1SW_Push_DPDTButton_Switch_THT:SW_PUSH_E-Switch_FS5700DP_DPDTSW2
1TP4056-42-ESOP8Package_SO:SOIC-8-1EP_3.9x4.9mm_P1.27mm_EP2.41x3.3mm_ThermalViasU3
1ULN2003APackage_DIP:DIP-16_W7.62mmU2
1VaristorVaristor:RV_Disc_D15.5mm_W3.9mm_P7.5mmRV1
1XIAO_ESP32C3XIAO_ESP32C3:MODULE_XIAO_ESP32C3U1

Similar boards

  • 2 layers57 × 24 mmPower supply, the printed circuit board in 3D

    Power supply

    martinquattro/SmartAquariumGuardian

    Smart Aquarium Guardian is an ESP32-based IoT aquarium monitoring and automation system for hobbyists and small-scale aquariums.

    36 parts1MIT
  • 2 layers49.4 × 95.7 mmPhysiowand, the printed circuit board in 3D

    Physiowand

    1tsMS/Physiowand

    91 parts
  • 2 layers29 × 39.5 mmLiPo Charge Boost, the printed circuit board in 3D

    LiPo Charge Boost

    buzzwordExpert/LiPo-Charging-and-5V-Boost-

    1S LiPo Charging and 5V Boost PCB

    23 partsMIT
  • 2 layers95 × 55 mmSmarthome v0.1, the printed circuit board in 3D

    Smarthome v0.1

    whysixmift/smarthome_v0.1

    I wanted to control lights and appliances in my room over Wi-Fi without having loose relay modules, breadboards, and 220V AC wires floating around my desk.

    63 parts
  • 2 layers61 × 61 mmESP32 FC, the printed circuit board in 3D

    ESP32 FC

    MAATHES-THILAK-K/ESP32-S3_FLIGHT_CONTROLLER

    A custom-designed flight controller based on the ESP32-S3 module, built for compatibility with the esp-fc firmware and Betaflight-like configuration.

    69 parts7Apache-2.0
  • 2 layers80 × 34 mmDji fcc, the printed circuit board in 3D

    Dji fcc

    nikolaus018/dji-fcc-esp32

    ESP32-S3 firmware that switches a DJI N1 remote to FCC mode over USB (replaces the Android app)

    69 parts3MIT
  • 2 layers30 × 25 mmProject2, the printed circuit board in 3D

    Project2

    devKOff/pcb-lipo-power-management-system

    An integrated PCB power management system for single-cell Li-Po batteries featuring onboard charging, circuit protection, and a DC-DC boost converter with selectable 5V and 12V DC outputs.

    28 parts2
  • 2 layers96 × 74 mmMacroController, the printed circuit board in 3D

    MacroController

    alex1klimovich/nrf52840-macro-controller

    Custom nRF52840 productivity controller for digital artists — PCB, BLE/USB firmware, OLED, haptics, RGB, and enclosure CAD.

    78 parts1

Questions

How big is the Lab PCB?

It measures 150 × 110 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Lab use?

48 parts, built around the HLK-PM01, MT3608, TP4056-42-ESOP8 and ULN2003A. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Lab KiCad files?

From the Yashwanth786/Centralized_Power_Distribution_System repository on GitHub, at the commit this page was made from: the board is kicad/lab.kicad_pcb and its schematic kicad/lab.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Lab design in my own project?

Its repository states no licence, so its author keeps all rights: ask Yashwanth786 before reusing the design.