So you're a Noob? Post your questions here until you graduate! Don't be shy.
User avatar
By minez
#65017 Hi guys,

I'm having problems with powering a 5V relay from my NodeMCU. The relay that I am using is the following 2 channel relay:

The NodeMCU is powered via USB, so my understanding is that I can power the relay using the Vin pin (3.3V is not enough to power this relay on its own). The relay ground is connected to NodeMCU ground and I have a pin set up to provide the switching signal.

When I power on the NodeMCU without the relay connected, the Node boots as expected and I can ping its IP. If I then connect the relay power to the Vin pin, the relay fires up and I can control it perfectly.

However, if I power the NodeMCU with the relay already connected, the NodeMCU fails to boot and is unreachable on the network (ie. can't be pinged). In this situation, the NodeMCU and the relay are both unusable until I disconnect the relay and power cycle the Node. The relay is definitely getting power as the led is lit, but it is almost like it is stealing power from the NodeMCU and making it unable to boot.

Wondering if anyone has any ideas on how to make this setup work? A separate power supply or a boost converter might be able to be used, but I'm trying to keep parts as minimal as possible for this application.

User avatar
By MHeys
#65082 Strange, it says it only requires 15-20ma on that link.

Do you have a multi-meter? Could you try and measure the voltage on the VIN pin with and without the relay? See if it's dropping below 5V, maybe measure the current the relay is using?

You could try a large capacitor to see if that helps if a current spike is causing the NodeMcu to brown out, that would be the least number of additional components I could think of, otherwise like you said, a separate power supply with a common ground.
User avatar
By rudy
#65083 You probably have it connected to a pin that needs to be in a certain state on power up. Your connection to that pin is prevent it from running the flashed code. Make sure that you are not using D0, D2, or D15. (native port numbering) D15 probably is okay to use as needs to be low on boot. I'm assuming the load on the pins are sinking current to ground.