BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Esp8266 NodeMcu with Blynk Issue


#1

Hello
I just completed a project with Esp8266 NodeMcu + Blynk.
I am using NodeMcu with two - 5v relay to switch on or off via blynk. I have connected 5v power supply to Vin pin in NodeMcu and the same to power up my relay board.

The following are the issues:

  1. Once I connect to the Wifi and open up Blynk prog, the relays trigger on ( High ) even before I push the switch on the Blynk app to switch on. I have tried both options of “1” and “0” on the Blynk app and result are the same. I need to keep relay “LOW” so they don’t turn on automatically. Can’t figure out the issue. Any help on this will be helpful.

  2. While Node Mcu is trying to connect to the Wifi, I need a LED, (connect to any other pin on the Node MCu) to stay ON and once connected the Led should turn " OFF". I was unable to use pinMode, or assign the LED to a particular pin on NodeMcu as “OUTPUT” either. Anything I am missing out.

Thanks in advance
Regards
Vijay


#2

What code have you tried that doesnt’t work with PinMode? (Make sure to format it correctly with backticks when you post it)…
Blynk%20-%20FTFC

What pins are you using for your relay and LED?

Do you understand the difference between the “D” numbers that are screen printed on your NodeMCU and the corresponding GPIO numbers?

Pete.


#3

Yes. D pins are what used. I also understand that gpio pins are refered to arduino pins.
I am using D5, D6 for my relay module. The problem is once I start blynk app the relays activate when I expect it to be in N/C status. The Led part I am yet to try.


#4

All MCU devices, including the NodeMCU, use General Puropse Input/Output (GPIO) pins. It’s just that for some u known reason, NodeMCU boards screen print D numbers against the pins rather than their GPIO number.

Or GPIO14 and 12. These are safe pins to use for this application, and are LOW by default after boot-up.

Are you certain that your relay is active HIGH? This doesn’t tend to be th norm with the cheap relay boards that you get from China. Some have a jumper to allow you to switch between active HIGH and LOW, but this isn’t that common.

You said in your original post…

But now say…

The reason why I ask, and would like to see the code where you tried unsuccessfully to use PinMode for the LED is that declaring GPIO14 and 12 as Outputs, then immediately writing them LOW at startup is potentially one way to overcome issues with relays, although the symptoms you describe with your relay makes me think that it’s actually active HIGH as I said earlier.

If you want help then you’re better-off volunteering lots of info up-front, or providing it when asked, rather than drip-feeding information then saying contradictory things. Your code, a picture of your relay board and info about testing you’ve done to prove that it is active LOW, info about how you’ve wired the relay board to your MCU etc would potentially all be useful.

Pete.


#5

Dear Pete
Had the issue sorted out. There was something funny happening when I wrote code for pinMode. I just re-typed the code and all seems well. I was also able to have the relay NOT turning on logging on Blynk app. Also had an LED turn OFF when connection to WiFi was established.
Thanks for writing.
Regards
Vijay