About the project
SmartStrip — Intelligent 5-Socket Energy Monitoring Extension
SmartStrip transforms a standard 5-socket extension box into a
smart, self-hosted energy monitoring and control system — built
from the ground up at RAIN (Robotics and Artificial Intelligence
Nigeria) in Ibadan, Nigeria.
## The Problem
Most Nigerian homes and offices have no visibility into how much
electricity individual appliances consume. With unstable power
supply, prepaid meters, and rising NERC/DISCO tariffs, energy
waste is expensive and invisible. SmartStrip solves this by giving
users per-socket insight and control — without relying on expensive
imported smart home ecosystems that aren't built for the Nigerian
context.
## What It Does
SmartStrip monitors and controls 5 independent sockets in real time:
- **Per-socket energy monitoring** — voltage, current, active power,
energy (kWh), power factor, and frequency are measured
independently for each socket using dedicated PZEM-004T V4.0
sensors
- **Remote relay control** — each socket can be switched ON or OFF
remotely via MQTT from the web dashboard
- **Electricity cost calculation** — uses PZEM's built-in kWh
accumulator multiplied by a user-configurable tariff rate,
reflecting real Nigerian electricity billing
- **Real-time dashboard** — a six-page HTML/JS web interface
displays live readings, analytics, schedules, and settings
- **JWT authentication** — secure login system protects access to
the dashboard and API
- **Schedule automation** — sockets can be programmed to turn ON
or OFF at set times automatically
- **Self-hosted architecture** — no cloud dependency, no
subscription fees, runs entirely on local infrastructure
## Hardware Stack
| Component | Role |
|-----------|------|
| ESP32-WROOM-32 | Main microcontroller, WiFi, MQTT |
| 5x PZEM-004T V4.0 (100A) | Per-socket energy measurement |
| 8-channel 12V relay module | Per-socket switching |
| HLK-PM03 PSU | Mains to DC power conversion |
| CT clamps (x5) | Non-invasive current sensing |
| Sony 12V 3A adapter | Relay coil power supply |
## Software Stack
| Layer | Technology |
|-------|------------|
| Firmware | Arduino C++, PubSubClient, HardwareSerial |
| Backend | FastAPI, SQLAlchemy 2.x, SQLite |
| Auth | JWT via python-jose, passlib, bcrypt |
| Broker | MQTT via HiveMQ |
| Frontend | HTML, CSS, JavaScript (6 pages) |
| Protocol | MQTT pub/sub for real-time data |
## How It Works
The ESP32 polls all 5 PZEM sensors every 2 seconds using
two hardware UART buses — PZEM1 on UART1 and PZEM2-5 sharing
UART2 via unique Modbus addresses (0x01–0x05). Readings are
packaged as JSON and published to MQTT topics per socket. The
FastAPI backend subscribes to these topics, logs data to SQLite,
and serves the web dashboard. Users can toggle sockets from the
dashboard, triggering MQTT control messages that the ESP32 receives
and acts on by driving the relay IN pins LOW.
## Nigerian Market Context
SmartStrip was designed with the Nigerian electricity landscape in
mind:
- **220V mains** wiring throughout, following UK conventions
(brown/blue/green-yellow)
- **Service Based Tariff** support for accurate cost calculation
- **Prepaid meter awareness** — helping users track consumption
before their units run out
- **Local sourcing** — all components sourced in Ibadan
- **Self-hosted** — no dependence on foreign cloud infrastructure
## Build Journey
SmartStrip was built entirely from scratch as an internship project
at RAIN from initial ideation and component sourcing, through
full physical assembly (drilling, wiring, casing), to firmware
development and web application. The build involved real engineering
challenges including UART bus sharing for 5 sensors, GPIO pin
conflict resolution, mains wiring debugging, relay power supply
design, and full-stack API development with authentication.
## Built at
**RAIN — Robotics and Artificial Intelligence Nigeria**
Ibadan, Nigeria · 2026