I have created a garage door controller using my pi zero w. I am currently using a GPIO pin which will send the signal to relay and trigger the relay for a second which connects the garage door switch.

I know that there are some pins that go HIGH and some pins that go LOW after the boot "complete". Now, I have observed an issue, Whenever the pi reboots or boots up, All the pins go high for a second while the boot up is happening and then the pins that have to be set to LOW on boot up goes Low. My pin is 9, which will be low once the pi OS boot up completes. But there is a 1-2 second period for which the PI sets the pin to High while booting. This is causing the garage door to open and I will not know about this.

Is there a way to turn this off in the software?

I do have an alternative, by using a circuit which will turn the relay on only if the signal is for 3 seconds or more. but still, this will slow down the responsiveness by adding the 3-second delay on the toggle.

  • Possible duplicate of What is the power on state of the GPIOs?
    – Brick
    Commented Mar 14, 2018 at 19:40
  • Are you sure they all go high? Probably some high and some low, in which case you can change your pin.
    – Brick
    Commented Mar 14, 2018 at 19:40
  • Instead of delaying the relay control, delay the power on of the whole relay board. This can be done passively with a sufficiently large in-line inductor on the 5V line going to the relay, delay it a few milliseconds until the CPU is in bootloader code and GPIOs configured as needed and the power-on state is not important
    – crasic
    Commented Mar 14, 2018 at 19:50

1 Answer 1


You will need to find an external hardware solution or change the GPIO you use.

The Pi GPIO are all set as INPUTS at power-up.

GPIO 0-8 have pull-ups to 3V3 applied as a default.

GPIO 9-27 have pull-downs to ground applied as a default.

This means that GPIO 0-8 will probably be seen as high and GPIO 9-27 will probably be seen as low.

  • 2
    Internal pull-ups are generally weak (50K+), you can "overpower" them with external pulls in the 4.7K range. But, is generally a more reliable approach to use power sequencing to avoid toggling external device. Instead of trying to maintain safe signals through boot for your relays, keep the power off the relay until the system is ready.
    – crasic
    Commented Mar 14, 2018 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.