2 Channel Relay interfacing with ESP 01 & NodeMCU | ESP 8266 | Control two high voltage devices.
In this tutorial, we will explore two channel relay. If you missed 1-channel relay interfacing read this tutorial. This is an extension and will introduce ESP 01 and ESP 8266 together.
You can think of 2 channel relay as two 1-channel relays placed side by side. Relay needs 2 input triggers to operate each relay.
Hardware Requirements
1. NodeMCU
2. ESP 01
3. Jumper wires
4. 2 Channel Relay (Active LOW trigger)
5. Multi output voltage power module
void setup() { pinMode(0, OUTPUT); pinMode(2, OUTPUT); digitalWrite(0, HIGH); digitalWrite(2, HIGH); } void loop() { digitalWrite(0,LOW); digitalWrite(2,HIGH); delay(3000); digitalWrite(0,HIGH); digitalWrite(2, LOW); delay(3000); }
Above code will activate one relay for 3 seconds and then turns it off and activates the other for 3 seconds in a loop and works on NodeMCU and ESP 01. Now lets connect 2 channel relay to ESP 01 and ESP 8266.
Nodemcu and 2 channel relay
ESP 01 3v -> Power module 3VRelay Vcc -> Power module 3vRelay GND -> Power module GNDESP 01 GND -> Power module GNDESP IO0 -> Relay IN1ESP IO2 -> Relay IN2
In the next tutorial we will explore 4 channel relay with NodeMCU.
Note
If you want to isolate power for relay and micro controller. You can use RY-Vcc and GND to power relay. In the above experiment i have shorted Vcc and RY-Vcc to use power from NodeMCU or power module.
Comments
Post a Comment