I'm a newbie on Arduino and NodeMCU so now I'm trying to run my relay module trough the NodeMCU v3 and so far I have wired them all respectively as the instruction below:

NodeMCU 5v Relay
D2 +
Gnd -

but somehow it doesn't work when I try vin pin but the led of Relay module just turns automatically on when I connected to 3v pin works on vin3 without me doing anything through the app (Blynk). I wonder if I'm missing something here?

Thanks very much for your help in advance.


  • 1
    Can you please share the schematic and code for reference
    – Maaz Sk
    May 6 at 8:15
  • 2
    I don't understand how you have connected the relay module. For example: What should "NodeMCU = 5V Relay" mean? What is connected to what here? Please be more specific
    – chrisl
    May 6 at 8:22
  • 4
    If I understand correcly, you might have switched positive power supply input for Relay (+) and Signal pin (S)...
    – KIIV
    May 6 at 10:38
  • I can't seem to find the actual schematic for Version 3, ESP8266 NodeMCU. Does anyone know if there is a schematic out there or where to find it? @MaazSk
    – SaNi
    May 6 at 11:59
  • 2
    I second the wiring mistake. + goes to 5V, - goes to ground. S goes to D2.
    – BobT
    May 6 at 15:14

You’ve probably switched some wires.

Relay Connection with Arduino, usually takes 3 Pins:

  • VCC / In (5v)
  • Signal (Data) - [D2] Pin On your sketch.
  • Ground

It is that simple.

Some recommendations apart from your question:

  1. Make sure to know how your relay starts. That is: Starts Always On or Always Off.

  2. On your sketch (relay initialisation); set the initial relay state before defining its function as OUTPUT.


digitalWrite(relayPin; LOW);
PinMode(relayPin, OUTPUT);


  1. Ensure the wires are properly connected to avoid wasting time understanding why the relay doesn’t work. Special attention to Ground Wiring.

Note: Depending on your schematic; You may require to bridge your Grounds.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.