Problem using physical 4 buttons using Nodemcu esp8266 to switch relays

i gave the vin and ground connection to the relay board via nodemcu 3.3v and gnd connections respectively.

and nodemcu is powered from my phones micro-usb charger.

just a part of debugging could you connect LED’s to any of the relay pin say D5 and check if your logic works fine.
Secondly try powering the relay board with Vin pin of NodeMcu rather than 3.3v

1 Like

The relay board is working perfectly fine when I toggle the state from blynk app, i can see the relays light and hear the relays tick.
The only problem I’m facing is the physical push (hardware) buttons are not doing anything!

Despite me asking you to correctly format your code, you didn’t.
I’ve corrected it for you this time, but in future incorrectly formatted code will be deleted from your posts.

The code must be preceded and followed by three backticks characters like this:


1 Like

Sorry for that… And thanks for formatting it…!

You’ve connected your physical button so that one side is connected to the digital pin, and the other side is connected to 3.3v
The side of the switch that’s connected to the digital pin is being pulled LOW by the 10k resistor to prevent it floating in an intermediate state (more on that later).

This means that when you press the physical button, the digital pin will be pulled HIGH.

Your code had defined the digital pins for the physical buttons as INPUT_PULLUPs, meaning that they’ll be pulled HIGH by default, so external pull-up resistors aren’t needed to prevent them from floating, and all of your code is looking for a LOW signal from the switch to actuate your relays.

If you throw away the pull-down resistors and connect the other side of the switch to GND rather than 3.3v it should work as desired.

However, you should also read this:


Hey Sorry for the delayed reply for some reason my esp8266 went bad so had to order a new one and finally it came and tried your solution on it and man it worked.

And As you suggested the thing worked perfectly by removing the resistors.
However only two of my Butoons are working the other two buttons connected to GPIO 10 & 9 or S3 , S4 are not working for some reason.

Try clicking the link I provided about GPIO pins and see what it says about pins 6 to 11.


I don’t think you need to be rude when one needs help. Should we than not use Blynk and find another App with better support???

You are new here, so are probably unaware of the rules regarding posting. Good support also requires good questions and participating users willing to read, listen and learn. @PeteKnight was not rude, nor did he do anything worthy of your unnecessary critiquing.

Feel free to go wherever you wish, but good luck finding better support than from the members of this forum.


Support for the free version of Blynk is provided by other users (like myself) who volunteer their time and knowledge to help others.

If you think that some or all of my comments that enabled @swapnilkute2777 to resolve his problem were rude or unhelpful then I’d suggest you hit the ‘Flag’ button so that the issue can be bought to the attention of Blynk staff and appropriate action taken.



With attitude like yours you are running down this company and yes I will not be using Blynk for my future Industrial projects.

I’m pretty sure @PeteKnight nor @Gunner is affiliated with Blynk. - They donate their spare time to help users on the forum.

Both of whom are very knowledgeable.


@firdosh Barely two posts in and already making friends :stuck_out_tongue: We will miss you.

Yes, and thank you @JustBertC I am just a long term Blynk forum volunteer… and still learning as I go.

And like many of us regulars, we just have fun helping as best as we can… even if we have to resort to some “tough love” teaching methods with the “problem children” :stuck_out_tongue_winking_eye:

1 Like

“Industrial projects” implies that this is a commercial application, which is strictly forbidden for the free version of Blynk - which is the version supported via this forum.

If you pay $166 per month the you’ll get email support within 48 hours from Blynk staff.

To paraphrase a common saying - if you pay nothing then you get rude monkeys like @Gunner and myself.

Good luck find anything that comes close to the functionality of Blynk.



Yup… Give this monkey crap, get :monkey: :poop: right back :wink:

Notice how he didn’t get snarky in “his” topic when looking for answers :thinking:


@firdosh don’t know what is a community.
we all are volunteers in this forum
even monkeys :joy::joy:


Thanks For the help.

Finally all four relays are working fine with buttons.

After reading the post u shared about best gpio pins in Nodemcu. i changed a few pins.

The issue am now facing is when the nodemcu is given power the relay / ledpin 4 starts for a brief moment then turns back down and while turning down relay / ledpin 3 also glows and dies ( but led pin 3 does that glow and die in less than a second like a pulse ).

I think the issue for Relay / Ledpin 4 ( GPIO15 ) is due to the reason that its pulled low during startup ( Right.? ).

But cant seem to understand why Relay / Ledpin 3 ( GPIO 14 ) is giving a pulse.?

Please post your full updated code (don’t forget the triple backticks).


GPIO 12,13,14 are High for 100ms at boot , then low
GPIO15 has pulldown, and must be low at boot
Only GPIO 4 and 5 are low at boot and remain low
better use ESP32 :wink:

1 Like