Back to projects

Connected IoT case study

AasPas Smart Box

IoT smart switch platform with ESP32 firmware, cloud backend, mobile app, and web dashboard

AasPas Smart Box is a full-stack IoT control platform built around real household automation. It combines ESP32 firmware, a Node.js backend, MongoDB persistence, Socket.IO realtime state, a Next.js web dashboard, and an Expo-based mobile app. The system supports device claiming, relay control, per-relay timers, daily and one-time schedules, energy tracking, device presence monitoring, power-loss recovery, and fallback behavior when realtime transport drops.

This platform was built end to end by me across firmware-facing API design, device authentication, backend automation, web dashboard UX, mobile control flows, energy logic, and power-recovery behavior.
AasPas Smart Box mobile control screen

Live relay control, schedule automation, energy insights, and device health are all surfaced through the mobile product instead of being hidden behind firmware-only tooling.

System topology

ESP32 device
Device identity, WiFi setup, relay control, heartbeat, and fallback communication.
Cloud backend
Auth, device ownership, automation, energy logic, presence, and persistence.
Mobile app
Handheld control surface for relay actions, schedules, timers, and energy views.
Web dashboard
Browser dashboard for device management, status monitoring, and automation setup.

Mobile walkthrough

Real app screens that prove product depth

These screens show that Smart Box is not a concept-only IoT demo. It already has real onboarding, connected-device overview, relay control, schedule setup, and energy analytics surfaces.

Device dashboard

Device dashboard

The dashboard gives the user a quick operational view of device count, online status, relay summary, and the connected Smart Box overview.

Smart-device onboarding

Smart-device onboarding

Device claiming is designed as a real onboarding flow where users link a Smart Box by device ID and follow setup instructions instead of dealing with raw hardware steps alone.

Relay control surface

Relay control surface

The control screen shows independent relay state, on and off actions, live status, relay-level runtime and cost indicators, and direct access to timers and schedules.

Schedule automation modal

Schedule automation modal

Daily and one-time automation are exposed through a clean mobile scheduling UI so household automation feels practical rather than hidden behind backend-only logic.

Energy usage analytics

Energy usage analytics

Relay-level runtime, units, and rupee cost are surfaced across today, yesterday, month, and lifetime views to make the product useful for monitoring as well as control.

ESP32 + cloud
Connected hardware platform with software control surfaces
3-channel control
Independent relay automation for real household use cases
Mobile + web
Expo mobile app and Next.js dashboard for multi-surface control
Realtime + fallback
Socket.IO live updates with HTTP fallback and heartbeat logic
Energy aware
Per-relay watt, unit, cost, and monthly overview calculations
Recovery built in
Power-loss pause/resume logic and outage-aware state restoration

System map

Major product systems

Smart Box is not only a remote switch. It is a hardware-to-cloud product where device identity, ownership, relay automation, analytics, and recovery all matter at once.

Device ownership and control

Users sign up, claim devices by ID, manage multiple Smart Boxes, and control only the hardware they own through authenticated APIs and device-aware realtime subscriptions.

Relay automation

Three separate relays can be controlled independently with immediate toggle, timer automation, daily schedules, and one-time schedules for household devices like lights, fans, and pumps.

Realtime device presence

Device and user clients maintain Socket.IO connections with heartbeat acknowledgements, room-based updates, and online/offline state transitions backed by server-side presence handling.

Energy intelligence

Per-relay energy configuration tracks watts, runtime, unit consumption, cost, daily history, monthly usage, and all-time overview with user-facing analytics.

Power-loss recovery

When household power fails, timers pause, energy tracking stops, outage history is recorded, and the system resumes intelligently when the device reconnects.

Cross-surface product delivery

The platform includes firmware-compatible APIs, a Next.js dashboard, an Expo mobile app, and backend automation logic, making it a real multi-surface IoT product.

Platform surfaces

Four connected product surfaces

This project spans hardware, cloud, mobile, and web. That cross-surface complexity is exactly what makes it strong portfolio material.

ESP32 device layer

Embedded device identity and control

The hardware surface is designed around real device identity, network uncertainty, and relay-by-relay control rather than a basic serial demo.

Unique device IDs derived from hardware identity
Three independent relay states for light, fan, and water-pump style use cases
Captive-portal style WiFi setup for first-time configuration
Socket.IO realtime connection with heartbeat signalling
HTTP polling fallback if realtime transport drops
Registration and cloud synchronization through backend endpoints

Mobile app

Control on the go

The mobile product gives users a polished handheld control surface for automation, device status, and energy visibility.

Login, registration, and secure device ownership flows
Multi-device overview with online, offline, and relay activity status
Detailed device-control screen with animated relay cards
Timer, schedule, energy setup, and energy details modals
Monthly energy overview and per-relay breakdown screens
Power-loss warning and device-offline feedback for real-world reliability

Web dashboard

Desktop monitoring and administration

The Next.js dashboard provides another surface for login, device claiming, status monitoring, and relay automation from desktop browsers.

Authentication and account entry flow
Device list with online state and relay activity overview
Add-device modal for claiming a Smart Box by device ID
Device-control page with timer and schedule modals
Realtime status syncing through Socket.IO
Responsive layout for practical web-based device management

Backend and automation cloud

State, security, and recovery engine

The backend is where the system becomes production-like: ownership validation, device routing, timers, schedules, heartbeats, and energy correctness all live here.

JWT auth and user-based device ownership enforcement
Socket authentication for users and ESP32 devices
Timer creation, pause, resume, and expiry handling
Daily and one-time schedule execution per relay
Device-presence tracking, outage history, and last-seen state
MongoDB-backed persistence for control, energy, and recovery data

Technical architecture

Technology footprint

The stack spans embedded hardware behavior, authenticated backend APIs, realtime transport, web control surfaces, mobile UX, and analytical energy logic.

Hardware and firmware interface

The embedded side is shaped around device identity, WiFi setup, cloud communication, and relay-oriented control, not just local switching.

ESP32 firmwaredevice ID generationcaptured WiFi setup flowrelay control mappingHTTP fallback

Cloud backend

Backend services handle auth, device ownership, relay commands, timer and schedule automation, presence management, and persistence.

Node.jsExpress.jsMongoDBMongooseJWT authautomation routes

Realtime layer

Socket.IO synchronizes device and user clients while heartbeat acknowledgements help the platform understand connectivity and offline transitions.

Socket.IOdevice subscriptionsuser roomsheartbeat ackpresence tracking

Web dashboard

The browser dashboard provides desktop-friendly device management and automation setup with a clean operational surface.

Next.jsReactTailwind CSSsocket.io-clientresponsive dashboard

Mobile control app

The mobile app brings the same control and monitoring flow into a handheld format with richer device cards and energy-specific views.

ExpoReact NativeReact NavigationAsyncStoragereanimated UX

Energy and recovery logic

Device analytics and resilience behavior make the product significantly deeper than a basic on-off switch.

runtime trackingcost calculationmonthly historypower-loss pause/resumeoutage logs

Automation systems

Relay automation and scheduling engine

Automation depth is one of the strongest parts of this product because timer and schedule logic work independently per relay instead of being a single global switch.

Per-relay timer automation instead of device-wide only timers

Daily schedules and one-time schedules for each relay independently

Automatic ON/OFF execution driven by backend automation logic

Timer pause and resume behavior when relay state changes or power fails

Schedule persistence in MongoDB so automation survives reconnects and app restarts

Realtime status emission so apps see automation changes immediately

Energy intelligence

Usage analytics and cost visibility

The energy layer gives the product more depth than a simple home switch because users can estimate runtime, units, and cost per relay over time.

Wattage and unit-rate configuration per relay

Today, yesterday, monthly, and all-time runtime calculations

Unit and rupee cost estimation for each configured relay

Monthly overview screen aggregating multiple relays into one device-level summary

Relay-level energy details with breakdown and reset support

Energy tracking pause and resume logic tied to actual device availability

Reliability

Offline detection, power loss, and recovery

Real homes have power cuts and unstable connectivity. The resilience logic in this system is what makes it feel more production-grade than a hobby-only IoT build.

Device heartbeat monitoring with offline timeout handling

Socket disconnect and reconnect awareness for both users and ESP32 hardware

HTTP polling fallback when direct realtime transport is unavailable

Power-loss detection that pauses timers and energy computation instead of producing false data

Power restoration logic that resumes timer and energy state correctly

Outage history storage for reliability insight and retrospective visibility

Security and ownership

Control, auth, and device trust

Since this is a cloud-controlled device system, ownership validation and control security are central to the product, not optional extras.

JWT-authenticated user access for device control routes
Device ownership validation so only the claimed user can control a Smart Box
Socket authentication for both user and device clients
Device registration and identity checks tied to device IDs and MAC-aware matching
Protected API routes for toggles, timers, schedules, and energy setup
Separation between device-facing endpoints and user-facing control flows

Ownership

What I personally handled

This is another project where the value comes from system breadth: device logic, backend automation, web, mobile, and reliability decisions all had to come together.

Backend API and data-model design for device state, timers, schedules, and energy tracking
Realtime Socket.IO architecture for user clients and ESP32 devices
JWT auth, user-device ownership, and secure control routes
Next.js dashboard experience for device management and automation setup
Expo mobile app flows for device control, energy analytics, and offline feedback
Reliability logic for power-loss handling, offline detection, and recovery behavior

Technology index

Core technologies used

ESP32Arduino-style firmwareNode.jsExpress.jsMongoDBMongooseSocket.IOJWT authenticationNext.jsReactTailwind CSSExpoReact NativeAsyncStorageReact NavigationRender deploymentHTTP polling fallbackEnergy analyticsTimer and schedule automationPower-loss recovery logic