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()
> {
>   Blynk.run();
> }

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 ?

http://www.ebay.com.au/itm/5V-Eight-8-Channel-Relay-Module-With-Optocoupler-For-Arduino-PIC-AVR-DSP-ARM/151964387584?_trksid=p2047675.c100009.m1982&_trkparms=aid%3D222007%26algo%3DSIC.MBE%26ao%3D1%26asc%3D20140117125611%26meid%3Dfcf976b2598041bc823ab1833373cb45%26pid%3D100009%26rk%3D2%26rkt%3D10%26sd%3D221930595470

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
http://www.aliexpress.com/item/1pcs-3V-Isolation-Relay-Control-Module-Drive-Control-Module-High-Driver-Board/32308104223.html?spm=2114.01010208.3.1.OKVIpp&ws_ab_test=searchweb201556_7,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.
http://www.aliexpress.com/item/4-Channel-SSR-Solid-State-Relay-high-low-trigger-5A-3-32V-For-Arduino-uno-R3/32692420896.html?spm=2114.01010208.3.112.pnmZO7&ws_ab_test=searchweb201556_7,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