WebApp View:
Circuit Diagram:
IoT 12V Home Automation: ESP32 & 8-Channel Relay Realtime Control
Welcome back to the workbench! Today, we are building a complete, high-performance IoT Smart Home Automation system using an ESP32 DevKit V1 and a 12V 8-Channel Relay Module. This entire setup interfaces seamlessly with a custom Firebase Realtime Database web dashboard, allowing you to trigger heavy components, studio monitors, lighting setups, or hardware peripherals from anywhere in the world instantly.
System Architecture & How It Works
The system leverages a direct web app link to Firebase cloud nodes, cutting down latency so transitions feel entirely local. The architecture flows effortlessly across your wireless environment:
- Web App Dashboard: A lightweight, highly responsive frontend bundle (HTML, CSS, JS) that push/pulls instantaneous digital state variables (0 or 1) directly out of your private Firebase server instance.
- Firebase Database Backend: Operates as the centralized control buffer, streaming data downstream to the microcontroller node using real-time synchronization hooks.
- ESP32 Hub: Monitors database strings continuously via the network connection, immediately translating modifications into high/low physical logic potentials across target GPIO nodes.
Complete Hardware Connection Pinout
For safe and reliable execution, your microcontroller and relay modules require explicit path mapping. Use this exact connectivity index to populate your breadboard or control panel enclosures:
ESP32 to 12V 8-Channel Relay Mapping
| Relay Channel | Input Node | ESP32 Target GPIO | Default Label Assignment |
|---|---|---|---|
| CH1 | IN1 | GPIO 23 | Light 1 |
| CH2 | IN2 | GPIO 22 | Fan Control |
| CH3 | IN3 | GPIO 21 | Hardware Array |
| CH4 | IN4 | GPIO 19 | Studio System |
| CH5 | IN5 | GPIO 18 | Classroom Main |
| CH6 | IN6 | GPIO 13 | Light 2 |
| CH7 | IN7 | GPIO 12 | 3D Printer Array |
| CH8 | IN8 | GPIO 2 | LED Indication Loop |
Power Supply Delivery Paths
| Device Hardware | Specific Port Pin | Source Destination | Recommended Wire Standard |
|---|---|---|---|
| Relay Module | VCC | 12V Power Supply (+) | 18 AWG Red (Heavy Load Line) |
| Relay Module | GND | 12V Power Supply (-) | 18 AWG Black (Heavy Ground Line) |
| ESP32 DevKit | GND | 12V PSU Ground Rail | 22 AWG Black (Common Ground Reference) |
| ESP32 DevKit | 5V / VIN | USB Connection or 5V Regulator | 22 AWG Red Power Feed |
Setting Up the Software Workspace
1. Live Hosting Deployment (Web App Dashboard)
Collect your project configuration files (index.html, app.js, style.css, and firebase.json) into a single folder named esp32-app on your system workstation, open your system's Command Line interface, and execute the following deployment chain:
- Install the cloud utility terminal package if missing:
npm install -g firebase-tools - Log into your cloud console account profile:
firebase login - Initialize the targeted directory:
firebase init hosting(Select fir-esprelay, enter '.' as the public folder root, and select N for structural overrides). - Publish your live build out to the web:
firebase deploy
2. Microcontroller Provisioning (Arduino IDE)
Load up the ArduinoFirebasereal.ino sketch file from the repo inside your IDE. Navigate down to the configuration section near lines 7 and 8, then update your runtime connection parameters explicitly:
#define WIFI_SSID "Your_Network_Name" #define WIFI_PASSWORD "Your_Network_Password"
Ensure your target board type is configured to DOIT ESP32 DEVKIT V1 under your active port assignments, then fire the upload button to boot your firmware.
Verification & Troubleshooting Bench Tests
- Hardware Echo Checklist: Boot up your diagnostic Arduino Serial Monitor configured to
115200 baud. You should see successful connection notifications alongside real-time prints detailing active data states (e.g.,CH1 = 0). - Control Loop Validation: Launch your generated Firebase web link inside a browser panel. Clicking on any relay channel switch should trigger an auditory mechanical relay click instantly within your workspace, updating both database values and active hardware arrays.
Now your high-contrast IoT automated framework is fully deployed and configured. Test with low-power diagnostic indicators first before applying live, high-amperage equipment lines!

Comments
Post a Comment