Smart Home Hub
A whole-home automation build — custom RF protocol, Arduino node firmware, a Raspberry Pi hub and a Flutter app, end to end.
Personal build — same engineering as the trading systems, different domain.
This is a complete home automation stack built from bare components: a Raspberry Pi hub controlling relay-switched lights, fans and a water pump, an IR-blasted ceiling fan with seven speeds, an RGB ambient lamp with smooth color fades, a rooftop water-tank level sensor, mains-voltage monitoring, motion sensing and a WiFi fish feeder — across firmware, backend and mobile app, all written from scratch.
Devices talk over two radio links. Arduino nodes use nRF24L01 2.4 GHz with a custom four-byte binary protocol — hardware auto-acknowledgement, tuned retries and application-level retransmits. The battery-powered tank node reports over one-way 433 MHz, sending only median-filtered readings where three of five samples must agree before anything is broadcast.
State is truthful in both directions: physical wall buttons override the app and report back, nodes persist their state to EEPROM through power cuts, and the hub journals everything to disk. The Flutter app — a custom dark neumorphic design — polls the hub every two seconds, so what you see is what the house is actually doing. Remote access runs through a secure tunnel with zero open ports.
Scheduled automations round it out: the fish gets fed every morning at 7:30 whether anyone remembers or not.
System architecture
The modules that make it up, and how data flows between them.
Neumorphic 4-page control UI
Roof ultrasonic · 433 MHz
Pi · Flask · radios · automations
Relays · IR · LED · wall override
ESP-01 · servo · scheduled
Hover a module to trace what it feeds.
Command flow
One tap, end to end — from the app to a relay click and back.
- 1
App tap
A card toggle posts the command over HTTPS, through the secure tunnel, to the hub's API.
- 2
Frame build
The command packs into a fixed four-byte RF frame addressed to its target node — the same shape for relays, fan speeds and lamp colors.
- 3
Radio transmit
The radio lock is acquired and the frame written with hardware auto-ack plus up to five application-level retries.
- 4
Node acts
The node drives its relay, fires the IR code or fades the LEDs — then persists state to EEPROM and sends a status frame back to the hub.
- 5
State loop closes
The hub's listener updates the state journal; the app's two-second poll reflects it. Wall-button presses, voltage telemetry and tank readings arrive through the same loop.
- 6
Automations
The scheduler runs timed jobs — the fish feeder fires daily at 7:30 — and the tank node keeps broadcasting filtered levels every thirty seconds.
Engineering highlights
The details that keep it alive with real money on the line.
Custom binary RF protocol
Fixed four-byte frames, tuned auto-ack and retry parameters, pipe-collision avoidance and TX flush handling — designed against the radio's datasheet, not a library default.
Two-way state truth
Wall switches, app and hub can never disagree for long — every actor reports back, and EEPROM carries node state through power cuts.
Instant outage detection
A raw peak-to-peak voltage check bypasses the energy library's slow filter decay, so a mains outage reads zero immediately instead of fading.
Sensor hygiene
The tank node only speaks when five-sample medians agree within tolerance — no phantom water levels from ultrasonic noise.
Zero open ports
Remote access via an outbound secure tunnel — the home network exposes nothing to the internet.
Under the hood
The stack, and the system in numbers.