-->
Page 1 of 1

Help with powering a relay from NodeMCU

PostPosted: Mon Apr 17, 2017 1:31 am
by minez
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: https://www.amazon.com/dp/B0057OC6D8/ref=cm_sw_su_dp

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.

Thanks!

Re: Help with powering a relay from NodeMCU

PostPosted: Mon Apr 17, 2017 12:04 pm
by SurtrTech
I think you should use an external power source for your relay, because it's drawing much current, if you have that jumper on the relay board remove it and use an external 5v source

Re: Help with powering a relay from NodeMCU

PostPosted: Wed Apr 19, 2017 5:52 pm
by MHeys
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.

Re: Help with powering a relay from NodeMCU

PostPosted: Wed Apr 19, 2017 8:03 pm
by rudy
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.