ESP8266 Nodemcu 4 Ch Relay Module For IoT Project
Overview
This project allows you to control four relays using an ESP8266 (NodeMCU) via the Arduino IoT Cloud. You can toggle relays using physical switches or control them remotely from anywhere using a cloud-based dashboard.
🎯 Key Features:
✅ Manual Control – Use physical switches to toggle relays.
✅ Remote Control – Control the relays from the Arduino IoT Cloud Dashboard.
✅ WiFi Connectivity – Get real-time feedback on the relay status.
✅ Synchronization – Changes from manual and cloud control stay updated.
Circuit Diagram
🖼️ Follow the wiring diagram below to connect your components:
Wiring Details:
Relays:
Relay 1: GPIO 5 (D1)
Relay 2: GPIO 4 (D2)
Relay 3: GPIO 15 (D8)
Relay 4: GPIO 13 (D7)
Switches:
Switch 1: GPIO 0 (D3)
Switch 2: GPIO 2 (D4)
Switch 3: GPIO 14 (D5)
Switch 4: GPIO 12 (D6)
Step-by-Step Instructions
1️⃣ Install Required Libraries
Open the Arduino IDE and install the following libraries via the Library Manager:
ArduinoIoTCloud
Arduino_ConnectionHandler
2️⃣ Configure Arduino IoT Cloud
Go to Arduino IoT Cloud and create a new Thing.
Add the following Cloud Variables:
relay1 (type: CloudSwitch)
relay2 (type: CloudSwitch)
relay3 (type: CloudSwitch)
relay4 (type: CloudSwitch)
Link these variables to a toggle switch in the dashboard.
3️⃣ Upload the Code to ESP8266
Connect the ESP8266 to your computer.
Upload the following Arduino Sketch (after replacing WiFi credentials and Cloud Keys):
#define RelayPin1 5 // D1
#define RelayPin2 4 // D2
#define RelayPin3 15 // D8
#define RelayPin4 13 // D7
#define SwitchPin1 0 // D3
#define SwitchPin2 2 // D4
#define SwitchPin3 14 // D5
#define SwitchPin4 12 // D6
CloudSwitch relay1;
CloudSwitch relay2;
CloudSwitch relay3;
CloudSwitch relay4;
void setup() {
pinMode(RelayPin1, OUTPUT);
pinMode(RelayPin2, OUTPUT);
pinMode(RelayPin3, OUTPUT);
pinMode(RelayPin4, OUTPUT);
pinMode(SwitchPin1, INPUT_PULLUP);
pinMode(SwitchPin2, INPUT_PULLUP);
pinMode(SwitchPin3, INPUT_PULLUP);
pinMode(SwitchPin4, INPUT_PULLUP);
}
void loop() {
if (digitalRead(SwitchPin1) == LOW) {
relay1 = !relay1;
digitalWrite(RelayPin1, relay1 ? LOW : HIGH);
}
}
4️⃣ Test Your Project
Press the physical switches to control the relays.
Use the Arduino IoT Cloud Dashboard to toggle the relays remotely.
Future Improvements
🔹 Add real-time feedback (LEDs for relay status).
🔹 Expand control for more devices.
🔹 Add timer scheduling for automation.

ESP8266 Nodemcu 4 Ch Relay Module For IoT Project
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.

Raspberry Pi 5 7 Inch Touch Screen IPS 1024x600 HD LCD HDMI-compatible Display for RPI 4B 3B+ OPI 5 AIDA64 PC Secondary Screen(Without Speaker)
BUY NOW
ESP32-S3 4.3inch Capacitive Touch Display Development Board, 800×480, 5-point Touch, 32-bit LX7 Dual-core Processor
BUY NOW
Raspberry Pi 5 7 Inch Touch Screen IPS 1024x600 HD LCD HDMI-compatible Display for RPI 4B 3B+ OPI 5 AIDA64 PC Secondary Screen(Without Speaker)
BUY NOW- Comments(0)
- Likes(1)

-
RichardV31 Jan 30,2025
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by MANORANJAN DAS
-
Arduino Matrix Clock MAX7219 New V1.5 Hello All My Friend This is Simple LED Dot Matrix MAX7219 Clock Using Arduino ..... I Make This For ...
-
M5Stack Prototype Board M5Stack Prototype Board
-
M5Stack Original Prototype Board M5Stack Original Prototype Board
-
Arduino Remote Relay Board With BT And IR Hello Every One This Is Very Nice And Simple SMD Arduino Project . Control Relay With Bluetooth And ...
-
Arduino Christmas Sounds Arduino Christmas Sounds
-
Christmas LED Lights Using BC548 This Is Really Very Fun Project For Little Baby
-
ESP8266 NTP Clock with 16x2 I2C LCD Display This project uses an ESP8266 NodeMCU to create a 12-hour format NTP clock with AM/PM, date, and day ...
-
ESP8266 Nodemcu 4 Ch Relay Module For IoT Project OverviewThis project allows you to control four relays using an ESP8266 (NodeMCU) via the Arduino Io...
-
ESP32 Water Level Monitor And Automictic Motor Control 30A relay ESP32 Water Level Monitor And Automictic Motor Control 30A relayUsed ESP32 ModuleOled DisplayUltraso...
-
4 CH Relay Module With ESP32 For Home Automation ,Alexa,Google Home Hello All My FriendThis is Simple Easy To USE 4 Ch Relay Module With ESP32 SupportUse This Board For...
-
8Ch Relay With ESP8266 Wemos D1 Mini Work With Amazon Alexa And Google Home This Project 8Ch Relay With ESP8266 Wemos D1 Mini Work With Amazon Alexa And Google Home Simple part...
-
PiTrezor : A DIY bitcoin hardware wallet based on trezor and raspberry pi zero Hello Everyone This is One Of Best Project Who Want To Make OWN hardware wallet At low Cost or Make ...
-
100mm X 50nn DIY Universal Board 100mm X 50nn DIY Universal Board
-
Simple Internet Clock Using ESP8266 DHT11 Hello Everyone This Project is Simple Internet Clock Using Esp8266 And DHT11 Upload Video And More T...
-
Micro USB FTDI Board With Dual Header Micro USB FTDI Board With Dual Header
-
Micro USB FTDI Module FT232RL Hello Everyone All FTDi Module In Market is Mini USB Version And Its Little Complicated To Find Mini...
-
BT136 AC Dimmer Board For Arduino And Esp8266 And Esp32 IoT BT136 AC Dimmer Board For Arduino And Esp8266 And Esp32 IoTAll Information Update Soon .
-
30A ESP8266 Wemos D1 Relay Board With Oled And MAX6675 Sensor Update All Information Soon
-
Arduino Matrix Clock MAX7219 New V1.5 Hello All My Friend This is Simple LED Dot Matrix MAX7219 Clock Using Arduino ..... I Make This For ...
-
M5Stack Prototype Board M5Stack Prototype Board
-
M5Stack Original Prototype Board M5Stack Original Prototype Board
-
Arduino Remote Relay Board With BT And IR Hello Every One This Is Very Nice And Simple SMD Arduino Project . Control Relay With Bluetooth And ...
-
Arduino Christmas Sounds Arduino Christmas Sounds
-
Christmas LED Lights Using BC548 This Is Really Very Fun Project For Little Baby
-
ESP8266 NTP Clock with 16x2 I2C LCD Display This project uses an ESP8266 NodeMCU to create a 12-hour format NTP clock with AM/PM, date, and day ...
-
ESP8266 Nodemcu 4 Ch Relay Module For IoT Project OverviewThis project allows you to control four relays using an ESP8266 (NodeMCU) via the Arduino Io...
-
ESP32 Water Level Monitor And Automictic Motor Control 30A relay ESP32 Water Level Monitor And Automictic Motor Control 30A relayUsed ESP32 ModuleOled DisplayUltraso...
-
4 CH Relay Module With ESP32 For Home Automation ,Alexa,Google Home Hello All My FriendThis is Simple Easy To USE 4 Ch Relay Module With ESP32 SupportUse This Board For...
-
8Ch Relay With ESP8266 Wemos D1 Mini Work With Amazon Alexa And Google Home This Project 8Ch Relay With ESP8266 Wemos D1 Mini Work With Amazon Alexa And Google Home Simple part...
-
PiTrezor : A DIY bitcoin hardware wallet based on trezor and raspberry pi zero Hello Everyone This is One Of Best Project Who Want To Make OWN hardware wallet At low Cost or Make ...
-
Commodore 64 1541-II Floppy Disk Drive C64 Power Supply Unit USB-C 5V 12V DIN connector 5.25
159 1 2 -
Easy to print simple stacking organizer with drawers
87 0 0 -
-
-
-
Modifying a Hotplate to a Reflow Solder Station
1131 1 6 -
MPL3115A2 Barometric Pressure, Altitude, and Temperature Sensor
636 0 1 -
-
Nintendo 64DD Replacement Shell
493 0 2 -
V2 Commodore AMIGA USB-C Power Sink Delivery High Efficiency Supply Triple Output 5V ±12V OLED display ATARI compatible shark 100W
1436 4 3