Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relay fires when power is applied #28

Open
harfordhawk opened this issue Nov 9, 2018 · 3 comments
Open

Relay fires when power is applied #28

harfordhawk opened this issue Nov 9, 2018 · 3 comments

Comments

@harfordhawk
Copy link

Mark,
I am trying to use this code very simply with a nodemcu and a 4-relay board. I power the relay from a separate 5V line from the same usb power source. Have common grounds between them. Anyway, everything works great except the power up sequence, which fires the relay. This is not good as you know for when I have a power outage, the garage will open when power is restored.
I have tried setting active high and active low. Do you have any ideas how I can stop the triggering on power up? Thanks

@Mike1082
Copy link

I think this has something to do with certain pins on the NodeMCU being pulled high or low during boot. I am running into this exact issue myself with a NodeMCU and 2 relay module while automating my doorbell (essentially the same thing as this project). Are you using D0 (GPIO 16)? See here for more information.

@harfordhawk
Copy link
Author

harfordhawk commented Nov 12, 2018 via email

@Mike1082
Copy link

Ok I was just able to get around this on my doorbell sketch. I don't know if this is a preferred method, or if there is a better way, but my relays are no longer firing on bootup (using D0 and D2 on NodeMCU). I did a digitalWrite to HIGH before setting the pinMode in the void setup() function. I found the solution here.

digitalWrite (RELAY1, HIGH);
digitalWrite (RELAY2, HIGH;
pinMode (RELAY1, OUTPUT);
pinMode (RELAY2, OUTPUT);

If this is bad, and someone knows a better way, please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants