Prevent Relay from triggering on power loss or broker reboot



  • I'm wondering if its not your code that is bringing the PIN high momentarily during boot up but the device or boot loader itself. Try flashing it with blank code and power cycle it and see if it triggers the relay still. If it does then you may need to put a pullup resistor on the pin to prevent it from happening.



  • @rhuehn I know this is an old post but I had a similar issue which I solved by inserting a line in my sketch to pull the pin high before setting it as output

      digitalWrite(RELAY_1_PIN , HIGH);  //stops relays cycling state during boot
      digitalWrite(RELAY_2_PIN , HIGH);  //stops relays cycling state during boot
      
      pinMode(RELAY_1_PIN , OUTPUT);
      pinMode(RELAY_2_PIN , OUTPUT);
    

Log in to reply
 

466
Online

6.7k
Users

7.6k
Topics

80.3k
Posts

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.