Connection between nodemcu board and relay module

hallo everyone, i have a problem. my nodemcu board is connect to Wi-Fi, but when i connect to my relay module, it’s goes nothing. what should i do ?

by the way, it is the program :

#define BLYNK_TEMPLATE_ID "***********"
#define BLYNK_DEVICE_NAME "**********"

#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG

#define APP_DEBUG

// Uncomment your board, or configure a custom board in Settings.h
//#define USE_WEMOS_D1_MINI

#include "BlynkEdgent.h"

void setup()


void loop() {;

@Fandu_ilham please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code, so that it displays correctly.
Triple backticks look like this:

I’d also suggest that you provide details of how you are connecting your relay to your NodeMCU and how you are powering your relay.

Information about the datastream types you’ve configured would also be useful.


I just connect the pins from D0 to D3 to pins in relay module (i used 4 channel), and VIN pin in nodemcu to VCC pin in relay module, and GND in nodemcu to GND pin in relay module.

About powering, i just using from port of PC and phone charger.

And, i used integer as my datastream types.

I’d suggest using virtual pins

and supply power to the relay module using external power source.

There is a good chance that the relay is pulling GPIO0 (pin D3) LOW, which puts your board in programming mode and prevents it from executing the sketch.

You should read this, and choose better pins…

Also, if you use Digital datastreams rather than Virtual datastreams then your relays will probably be activated for a short time when the device powers on.

And as @John93 also said, it’s a really good idea to use an external power supply to power your relays, as the NodeMCU can brown-out because there is insufficient power available when you activate the coils on multiple relays simultaneously.