I have a question regarding the GPIO status during the boot process. As a bit of background, I'm currently building an automated sprinkler setup using a raspberry pi and an 8-relay board. The board wiring is pretty simple, you supply and input with ground, and the relay activates and is indicated with an LED. Pretty straightforward to wire up. However, I noticed the GPIO pins are not exactly 0 when booting the device, they are not 1 either, because I can see the relay LED's blink faintly while booting the pi. Once the device has booted, it works as expected and when a pin is pulled to ground the LED lights up brightly and the relay clicks. I'm not sure what is going on here, I have tested with another pi, but the result is the same. The relay board is powered externally, all the pi has to do is give pulse to the board. Anybody any ideas? Is there some settings I can adjust in order to keep pins where they are while booting? I realise this is not a huge problem because the boot time is not too long, but still.

  • Welcome. "I noticed the GPIO pins are not exactly 0 when booting the device, they are not 1 either..." Yep, from power on until they are configured differently by software, the default state for most of them is as an input, which means unless they are pulled sufficiently up or down they will be in a high-z "floating" state: en.wikipedia.org/wiki/High_impedance#Digital_electronics Pretty sure the only remedy to this, if it is a significant problem, is via external circuitry.
    – goldilocks
    Jul 14, 2023 at 12:58
  • oh wow, I thought this was a mistake on my part, but this is just by design then... So I would need to turn on 3.3 V manualy in software for the relay board to turn on for example? Thank you for explaining this to me!
    – Tim
    Jul 14, 2023 at 13:14
  • No, that's just the GPIO pins. The power and grounds aren't GPIOs, they only have one state and that cannot be changed. The choice of a floating input default state is presumably because it is the least dangerous (there will be no damage if they are connected to a ground or <=3.3V current source, whereas there could be with an output pin). But depending on what you have connected, there isn't really any perfectly safe choice. So if you do connect things, you need to be aware of this and take appropriate pre-cautions if necessary.
    – goldilocks
    Jul 14, 2023 at 13:19
  • Yeah, I managed to explain it poorly again... What I really mean is: if I don't want to risc a relay firing during boot because of floaty GPIO, I could unpower the relay board via a transistor of some sort until the program runs. And the instant the program runs, trigger the transistor that powers the relay board? I hope this makes more sense? It would still be powered from the 3.3V rpi pin, but separated with a transistor.
    – Tim
    Jul 14, 2023 at 13:28
  • You will need to think about what kind of transistor to use keeping in mind the control input on that will potentially be floating at boot too -- but that can be remedied via an internal (and controllable) pull-up/down, as per Milliway's post most pins have a default that way. In theory you might be able to do that with the relay control directly (ie., no need for the transistor). There's a lot of similar questions here, maybe something worth gleaning along those lines: raspberrypi.stackexchange.com/…
    – goldilocks
    Jul 14, 2023 at 14:04

1 Answer 1


The Pi (in common with most computers) starts with all pins as input.

The SoC sets pins 0-7 with pullup all others with pull down. (GPIO 2,3 have physical pullup resistors.) This is well documented.

If you want to override this you can use physical pull resistors which will override the weak default 50k pull.

You can set the state of pins in config.sys although there is a small delay before this applies.

  • Thank you so much for explaining this!
    – Tim
    Jul 14, 2023 at 13:18

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.