ESP8266 4-Relay IoT Control With Arduino Cloud & Push Buttons
by ElectroIoTIN in Circuits > Arduino
25 Views, 0 Favorites, 0 Comments
ESP8266 4-Relay IoT Control With Arduino Cloud & Push Buttons
In this project, we will use an ESP8266 NodeMCU to control four relays using both Arduino IoT Cloud and manual push buttons. This allows remote switching via the cloud while maintaining local control. The project is ideal for home automation applications, allowing you to control lights, fans, and other appliances via the internet.
Features
✅ Remote Control – Operate relays via the Arduino IoT Cloud dashboard
✅ Manual Control – Use physical push buttons to toggle relays
✅ WiFi Connectivity Indicator – An LED shows the status of the WiFi connection
✅ State Synchronization – Whether toggled manually or remotely, relay states remain synchronized
Supplies
Components Required
- ESP8266 NodeMCU
- 4-Channel Relay Module
- Push Buttons (x4)
- WiFi Router for Internet Connectivity
- Jumper Wires
- Power Adapter (5V, 2A recommended)
Circuit Diagram
Connections
Relays
RelayESP8266 Pin
Relay 1
D1 (GPIO 5)
Relay 2
D2 (GPIO 4)
Relay 3
D5 (GPIO 14)
Relay 4
D6 (GPIO 12)
Push Buttons
SwitchESP8266 Pin
Switch 1
SD3 (GPIO 10)
Switch 2
D3 (GPIO 0)
Switch 3
D7 (GPIO 13)
Switch 4
RX (GPIO 3)
WiFi LED
WiFi Status LED → D0 (GPIO 16)
Create a New Thing
Go to Arduino IoT Cloud
Create a new "Thing"
Add four Boolean variables:
- relay1
- relay2
- relay3
- relay4
Set each as Read & Write with ON_CHANGE trigger.
Configure Device
- Select ESP8266 NodeMCU as the device
- Link your WiFi credentials
- Copy the Secret Key for use in the code
Arduino Code
Upload the following final working code to your ESP8266:
How It Works
Cloud Dashboard: The Arduino IoT Cloud lets you toggle each relay remotely.
Manual Push Buttons: Pressing a button toggles its corresponding relay.
WiFi LED Indicator: If WiFi is disconnected, the LED turns ON; otherwise, it stays OFF.
State Synchronization: The relays remain updated whether controlled remotely or manually.
Future Improvements
- 📌 Add MQTT or Blynk for additional control options
- 📌 Use Alexa for voice-based relay switching
- 📌 Expand to more relays for home automation
All Code and PCB Gerber File and Documents
Here Is project Details And Documents GitHub Like
https://github.com/ElectroIoT/ESP8266-NodeMCU-4CH-Relay-Module