Capstone Project: Smart Solution — Sensor to Dashboard
Assemble and deploy a complete end-to-end IoT system, connecting edge hardware to a local broker, backend API database, and web dashboard.
Domain
Full-Stack IoT Integration
Difficulty
⭐⭐⭐⭐⭐ (Expert)
Course Module
Capstone Project
Deliverables
Assembled Hardware, Backend DB, Web UI
1. Bidirectional Capstone Architecture Loop
The final capstone integrates all components from previous modules. The diagram below illustrates the bidirectional telemetry and control loop. The ESP32 edge node publishes sensor telemetry to a password-secured local Mosquitto broker. The Express.js backend receives data feeds and saves them to a PostgreSQL/TimescaleDB time-series database. Users monitor the system via a web dashboard, which sends control commands back through the backend to toggle the relay actuator on the ESP32.
2. Part 1: Step-by-Step System Launch & Debug Operations
Follow these detailed steps to start the complete system stack inside your VM guest, upload the firmware, and open the web dashboard.
STEP 1
Launch VM Terminal and Navigate to Workspace
Boot up your VirtualBox Ubuntu machine. Open the terminal (Ctrl+Alt+T) and navigate to the project directory.
ubuntu@iot-vm:~$ cd ~/workspace/backend_scaffold
We change the working directory of our shell to the backend workspace, where we will build and launch our multi-container services.
STEP 2
Build and Launch the Backend Infrastructure
Build and start the containerized backend services (Express API server, TimescaleDB database) in detached mode.
ubuntu@iot-vm:~/workspace/backend_scaffold$ sudo docker-compose up --build -d
We run `docker-compose up` with the `--build` and `-d` (detached) flags as root to compile the images, launch the services, and run them in the background.
STEP 3
Verify Container Run Status
List the running containers to confirm that both the backend API and the database services started without errors.
We query the running services using `docker-compose ps` to verify that both containers are active and their health-check states are normal.
STEP 4
Configure and Upload the ESP32 Capstone Firmware
Open the Arduino IDE, update the connection parameters in the firmware code (SSID, password, and VM IP), and upload the code to your ESP32 board.
Firmware Settings (Arduino IDE):
1. In the Arduino IDE, open your capstone sketch.
2. Locate the variables "ssid", "password", and "mqtt_server". Update them with your local credentials.
3. Locate the "mqtt_user" and "mqtt_pass" variables. Enter the credentials you configured in Project 7.
4. Click the circular Upload arrow icon in the toolbar. Once uploaded, verify the connection status logs in the Serial Monitor.
We configure and upload the ESP32 firmware to connect the edge hardware to your local Wi-Fi router and target the VM's authenticated Mosquitto broker.
STEP 5
Access the Capstone Web Dashboard
Open the capstone web dashboard in your host computer's browser to monitor telemetry data and send actuator commands.
Browser Dashboard Access:
1. Open your host computer's web browser.
2. Navigate to: http://localhost:3000/dashboard.html
3. The dashboard UI should load, displaying live temperature and light level trends, and enabling manual relay control.
We load the web dashboard in the browser to verify the end-to-end data pipeline, checking that telemetry is received and relay toggle commands are routed to the ESP32.
3. Bidirectional Web Dashboard & Relay Control Flow
The control flow diagram below outlines the sequential events triggered when a user clicks the relay toggle button on the web dashboard.
4. Part 2: Complete Codebases & Deployment Packages
Below is the complete C++ firmware code for the ESP32 node, followed by the HTML/JS web dashboard interface.
BOM target totals validated within the $30.30 target.
Bidirectional telemetry and relay control verified.
Express router schema validation passes all automated Jest tests.
6. Closing Explanation: Why We Did This & What It Accomplishes
Architectural Intent & Operational Impact
Why We Did This
Integrating the end-to-end telemetry and control loop demonstrates how edge hardware, local brokers, databases, and dashboards work together in a production system.
Disabling anonymous broker access and enforcing credentials secures the communication layer, protecting the system against unauthorized access and control.
Running the backend services in Docker containers simplifies deployment and scaling, ensuring that the backend runs consistently across staging and production.
What This Accomplishes
Completes the final capstone project, delivering a functional smart-building telemetry loop that bridges physical sensors to a custom web dashboard.