2 Channel Relay normal open is not working with NodeMCU but led on board light up

I am pretty new to NodeMCU (ESP8266) and Ardunio IDE in general. I followed various documentation / blogs to set up 2 Channel Relay with NodeMCU chip.

Below is sketch code for it.

#define CAYENNE_PRINT Serial

#define LEFT_GARAGE 4
#define RIGHT_GARAGE 5


char username[] = ""XXXXXXXXXXXXXXXXXXXXXX";";
char mqtt_password[] = ""XXXXXXXXXXXXXXXXXXXXXX";";
char client_id[] = ""XXXXXXXXXXXXXXXXXXXXXX";";

void setup() {
  Cayenne.begin(username, mqtt_password, client_id, ssid, password);
  digitalWrite(LEFT_GARAGE, HIGH);
  digitalWrite(RIGHT_GARAGE, HIGH);

void loop() {

// Left Garage Door
  int currentValue = getValue.asInt();

//Right Garage Door

On relay board I tried to connect wire in 2 different configuration.

1st Config:

vcc -> 3.3v from NodeMCU
in1 -> D1/GPIO 04 from NodeMCU
in2 -> D2/GPIO 5 from NodeMCU
GND -> GRD from NodeMCU

2nd Config:

vcc -> 5v usb from NodeMCU
in1 -> D1/GPIO 04 from NodeMCU
in2 -> D2/GPIO 5 from NodeMCU
GND -> GRD from NodeMCU

In 1st config, On relay board respective LED’s are turning on when Cayenne buttons are pressed but when I check for continuity on multi meter I don’t get anything.

In 2nd config, no led and no continuity.

am I missing something here? Any feedback/comments are highly appreciated.

Hello and Welcome to the Cayenne Community.
Can you show us your relay specification? Maybe it is normally closed, and when you apply signal on some of the pins, it opens the relay? You can test it when you measure also when you do not apply a signal.

Thank you.

Can you post a link to the relay you are using?

Are you sure your relay module is 3.3v?
Most of those modules are 5v, but… though the coil must be energized with 5v, the trigger “signal” can be 3.3v from the ESP (High state GPIO output).

This is how I connected mine. Works like a charm…

Hope it helps…

1 Like

Also, reading the code, I believe your GPIO wiring is incorrect…

D1 is GPIO 5
D2 is GPIO 4


I have had problems getting my solid state relays to consistently work with just 3.3v (they re rated at 5v trigger). It could also be that the 3.3v doesn’t have enough mA to trip the switch inside the relay. I have a relay board with 2 relays that can be powered by a external source and then it just uses the MCU input to trigger it rather than power it. That way it only takes 5-10mA to trip it.

I also had a problem with a relay module. One time it works with 3.3 and other it does not work…It depends on how many other consumers I have on my GPIOs…

There has been a couple posts recently about relays not working, so for anyone here having problems with relays, this video describes why they do not with out of the box with 3.v gpio pins. If you use 5v for vcc on the relay coil circuit and 3.3v vcc on the trigger circuit it will solve the problems. As for the single channel relays, I’m not sure how to hook them up. Google seems to offer lots of conflicting answers and I don’t have one to test with.


@ognqn.chikov @adam @vapor83 @spacefolder so good to see everyone helping out, a huge thank you from the Cayenne team!



I will also suggest not buying cheap relay boards because they can burn the house! I was using a cheap 8 channel relay that was market as 15A. On 6A they melted down! So…I never ever buy parts from cheap suppliers. I use adafruit and other similar suppliers that they give warranty and seems legit :slight_smile:

1 Like