Portfolio / Smart Home IoT
02 / Team Project ● Shipped

Smart Home
IoT.

An IoT home automation system built with ESP32 microcontrollers - sensor data streaming into Firebase, surfaced through a web frontend and React Native app.

year 2024 type Team (×3) role Backend · Mobile status Shipped
Python ESP32 Firebase RTDB React Native Expo TypeScript HTML / CSS / JS Arduino IDE

Hardware to app, end-to-end

Built with two teammates, the goal was simple: take home automation out of consumer black-box territory and build it ourselves - from the hardware up. That meant writing firmware, designing a real-time data pipeline, and shipping two separate frontends that work together.

ESP32 microcontrollers sit at the edge, reading sensors and controlling devices. Firebase Realtime Database acts as the sync layer between hardware and software. A custom web frontend and a React Native mobile app both subscribe to that data stream - showing live readings and sending control commands back to the device.

The data flow

The system has three layers: hardware, sync, and interface. Firebase RTDB is the glue - it decouples the firmware from the frontends so either side can be updated independently.

architecture.txt - Smart Home IoT
// Hardware Layer ESP32 ──[GPIO]── DHT22 (temperature + humidity) ──[GPIO]── PIR sensor (motion detection) ──[GPIO]── Relay module (switching devices on/off) ──[Python / MicroPython firmware]── // Sensor readings → cloud (every N seconds) ESP32 ──WiFi──▶ Firebase RTDB │ ┌───────────────┴───────────────┐ ▼ ▼ Web Frontend React Native App (HTML / CSS / JS) (Expo + TypeScript) onValue() listener onValue() listener live sensor dashboard remote control + alerts // Control flow (reverse path) Web / Mobile ──set()──▶ Firebase RTDB ──polling──▶ ESP32 (ESP32 reads command node on loop, acts on it)

What it's built with

// hardware

  • ESP32
  • Arduino Uno
  • DHT22 sensor
  • PIR motion sensor
  • Relay module

// firmware

  • Python (MicroPython)
  • Arduino IDE
  • C++ (Arduino)

// backend / sync

  • Firebase RTDB
  • Firebase SDK

// web frontend

  • HTML / CSS / JS
  • Firebase JS SDK

// mobile

  • React Native
  • Expo
  • TypeScript

What we had to figure out

01

WiFi reconnection on the ESP32

The ESP32 occasionally drops its WiFi connection. A naive implementation hard-resets on disconnect, causing missed sensor readings and dropped commands. We wrote reconnection logic in MicroPython with exponential backoff - the firmware waits progressively longer between retries rather than hammering the network, then resumes normal operation once it reconnects.

02

Sensor calibration

Raw DHT22 temperature readings consistently read about 4–5°C higher than a reference thermometer - a known issue with the sensor's self-heating inside enclosed casings. We added calibration offsets in the firmware. This taught us that hardware tolerances are real: you can't just trust a sensor's datasheet at face value in a specific physical installation.

03

Structuring data for Firebase's listener model

Firebase's onValue() fires every time a node changes. If you put all sensor data in one flat node, a single temperature update triggers a full re-render of everything. We restructured the database into separate sensor nodes so each listener only fires when its specific data changes.

What we shipped

The system ran reliably in a real home environment over several weeks of continuous use. We demonstrated it to assessors and peers - live sensor readings updating in real time on both the web dashboard and mobile app, with device control working in the other direction.

For me the biggest takeaway was how different hardware engineering is from pure software. Timing, tolerances, physical installation - things you can't unit test. You have to build, measure, and iterate.

📡

Live sensor stream

Real-time temperature, humidity, and motion data visible in both app and web frontend.

📱

Cross-platform control

Device switching works from both the web dashboard and the React Native mobile app.

🔌

Weeks of uptime

System ran continuously after WiFi reconnection logic was implemented.

see also
eStokvel
Node.js · PostgreSQL · Redis · React Native · USSD