
You can also subscribe to our newsletter to receive more such useful electronics projects through email. We’ll create an ESP32 / ESP8266 Web Server that is mobile responsive and it can be accessed with any device with a.
#Arduino relay board tutorial how to#
Like that, I can control other relays with the respective remote buttons.Ĭlick Here to explore more such Arduino Projects. ESP32/ESP8266 Relay Module Web Server using Arduino IDE (1, 2, 4, 8, 16 Channels) This tutorial is a step-by-step guide that covers how to build a standalone ESP32 or ESP8266 NodeMCU Web Server that controls any relay module.

Please take proper safety precautions while using high voltage.Īs per the sketch, if I press “1” on the remote the relay-1 will turn on, and then if I press the “1” button again the relay-1 will turn off. Now, connect the relay module as per the circuit diagram. Now lets connect the module to one of the computers USB connections and open the Arduino IDE. Irrecv.resume() // Receive the next value As you remember, the ESP-01 module is installed on the USBAdapter module and ready to be programmed.
#Arduino relay board tutorial code#
Irrecv.enableIRIn() // Enable the IR receiverĬase 0x10EFA956: // 10EFA956 = Hex code for IR remote button 1 (change this)ĭigitalWrite(switch_1, HIGH) // turn on switch 1ĭigitalWrite(switch_1, LOW) // turn off switch 1Ĭase 0x10EF9966: // 10EF9966 = Hex code for IR remote button 2 (change this)ĭigitalWrite(switch_2, HIGH) // turn on switch 2ĭigitalWrite(switch_2, LOW) // turn off switch 2ĭigitalWrite(switch_3, HIGH) // turn on switch 3ĭigitalWrite(switch_3, LOW) // turn off switch 3ĭigitalWrite(switch_4, HIGH) // turn on switch 4ĭigitalWrite(switch_4, LOW) // turn off switch 4 Int toggleState_4 = 0 //Define integer to remember the toggle state for switch 4 Press and keep pressing the button several seconds. Click Upload button on Arduino IDE to upload code to Arduino. Library and example for the 4-port Relay Expansion Board are part of of PhpocExpansion library for Arduino.The library reference is available here.

Tutorial & Code: ELEGOO Arduino Mega 2560 The. PES-2601 is an easy-to-use 4-port Relay Expansion Board for Arduino Uno and Mega, which allows Arduino to control DC electric device on/off. Copy the above code and open with Arduino IDE. Click to download: Datasheet ELEGOO DC 5V Relay Module - link 1 ELEGOO DC 5V Relay Module - link 2 - Google Drive. Int toggleState_3 = 0 //Define integer to remember the toggle state for switch 3 Open Arduino IDE, select the right board and port. Int toggleState_2 = 0 //Define integer to remember the toggle state for switch 2 Depending on the operating principle and structural features relays are of different types, such as: 1. Int toggleState_1 = 0 //Define integer to remember the toggle state for switch 1 Step 1: Basics A Relay is a large mechanical switch, which is toggled on or off by energizing a coil.
