Site icon ElectroIoT

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


Components Required

Circuit Diagram

Connections

Relays

Relay ESP8266 Pin
Relay 1 D1 (GPIO 5)
Relay 2 D2 (GPIO 4)
Relay 3 D5 (GPIO 14)
Relay 4 D6 (GPIO 12)

Push Buttons

Switch ESP8266 Pin
Switch 1 SD3 (GPIO 10)
Switch 2 D3 (GPIO 0)
Switch 3 D7 (GPIO 13)
Switch 4 RX (GPIO 3)

WiFi LED

Setting Up Arduino IoT Cloud

Step 1: Create a New Thing

  1. Go to Arduino IoT Cloud
  2. Create a new “Thing”
  3. Add four Boolean variables:
    • relay1
    • relay2
    • relay3
    • relay4
  4. Set each as Read & Write with ON_CHANGE trigger.

Step 2: Configure Device

  1. Select ESP8266 NodeMCU as the device
  2. Link your WiFi credentials
  3. Copy the Secret Key for use in the code

Arduino Code

Upload the following final working code to your ESP8266:

How It Works

  1. Cloud Dashboard: The Arduino IoT Cloud lets you toggle each relay remotely.
  2. Manual Push Buttons: Pressing a button toggles its corresponding relay.
  3. WiFi LED Indicator: If WiFi is disconnected, the LED turns ON; otherwise, it stays OFF.
  4. State Synchronization: The relays remain updated whether controlled remotely or manually.

Demonstration Video

i Will upload it soon

Future Improvements


Conclusion

This ESP8266-based 4-channel relay project enables seamless home automation with cloud and manual control. Whether you want to remotely switch lights, appliances, or fans, this project is a great starting point.

If you liked this project, give it a thumbs up and share it with others! 🚀

Contact & Support

For any queries, email me at electroiot@hotmail.com.

Happy Making! 😊💡

 

Exit mobile version