NodeMCU esp8266 blynk not actuating relays

Hello complete beginner here

i have a nodemcu with esp8266 using the following code:

>     > #define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
>     > #include <ESP8266WiFi.h>
>     > #include <BlynkSimpleEsp8266.h>

> // You should get Auth Token in the Blynk App.
> // Go to the Project Settings (nut icon).
> char auth[] = "AUTH";

> void setup()
> {

>   Serial.begin(9600);
>   Blynk.begin(auth, "ssid", "Password");

> }


> void loop()
> {
> }

I am trying to control relays with the output pins but the relays arent getting enough voltage to actuate when i try to control them via the app

i can communicate with the nodemcu and control the on board red and blue leds

I have tried two boards and two relays and have tested the relays between 5v and ground and 3v and ground and they actuate

Can someone please help me ?

The ESP’s can’t deliver the current necessary to actuate a relay. Try using a NPN transistor with the ESP output pin controlling the base. With an NPN, you wire the relay directly to the power supply on the positive side, then through the transistor to ground. Like this:

adjust R1 to deliver enough current to switch the transistor completely on (saturated). Check the datasheet for the transistor to figure out what you need.

thank you heaps that explains a lot … just another question as i want to avoid building my own relay modules would something like this work ?

im assuming the idea is that a separate 5v is what actuates but the signal from the esp/nodemcu tells which relay to actuate

I’ve used these successfully with nodemcu,searchweb201602_1_10017_10005_10006_10034_10021_507_10022_508_10032_10020_10018_10019,searchweb201603_2&btsid=d207bce0-da22-4feb-941e-b76ad57ae717

That board should work @barkgrind , but pay attention to how much current each unit will need to operate, and if your supply will be able to handle them. That is, if you are trying to actuate multiple relays simultaneously.

I like solid state relays better.,searchweb201602_1_10057_10056_10055_10049_10059_10058_10017_405_404_106_105_104_10060_103_10061_102_10062_412,searchweb201603_8&btsid=1c286f68-c8d8-481d-8593-702b75a9f4b5

I would also consider using a Flyback diode in parallel with your relay coil.

i thought flyback are for motors, don’t you use a MOV for a relay coil?

Flyback works for any inductive load