My relay is turning on automatically, when the NodeMCU is rebooting

i have read in a thread: All relay turns on automatically when my nodemcu reboot, that this was solved, but i didn’t really understand how this was solved, i have the same problem, but can you please explain more and how to solve this?
i dont have this in my code:

void setup(){
  Blynk.syncAll();
}

This is the problem?, or it was a local server problem?

which PIN do you use ?

D7 on NodeMCU

PIN D7 is GPIO 13
the PIN is High at boot
better use D1 or D2

3 Likes

ohh, so this will solve the problem:

Blynk.syncAll();

??

this is used to sync virtual pin, not digital one :wink:

then how to sync a digital one?

ohh but this will work, cuz the button on the blynk app will sync and turn off the device, right?

Yes !!

ohhh thanks!!!, i just tried it, but the device is turning on for like less than a sec, and then turning off, is this normal?

if you use D7 it’s normal ! it’s what I said :wink:

3 Likes

ohh ok, niceee, thankss for this info, much appreciated :smiley:

2 Likes

2 Likes

niceee, thanks!!

2 Likes

Hi Ahmad,
If your problem is not solved yet, may it is a hardware related problem.
In case of you are using a transistor controlled relay, most important to grounding transistor base with ~10k resistor like in this example picture what I have created for you:

I had similar problem with ESP8266 and this helped to solve mentioned issue.
Regards,
aquarius