I am making a thermostat and one of the issues I have with the pi is that on restart it sets all its pins to input which will provide power to devices, in this case a relay being used to switch on and off my various devices.

Because it seems like none of the pins are guaranteed to be low during the boot phase (though apparently you can set this on shutdown), I can't just leave my relays connected to it since they get activated. I am aware of dtoverlay=gpio-poweroff,gpiopin=some_pin. This does not work because it is not true the whole time during bootup.

I am considering just building a xor gate using two of the gpio pins so that its off at boot up, off at shutdown, and on when I set it to be so in software. It feels a bit silly that theres no way of managing this. I hope I am wrong!

  • Related if not dupe: raspberrypi.stackexchange.com/a/17169/19949 external Pull-downs would be the thing to do. – Ghanima Nov 18 '18 at 16:25
  • 1
    Setting pins to be inputs explicitly does not send power to devices. GPIO 0-8 have internal pull-ups to 3V3 enabled at power-up, GPIO 9-27 have internal pull-downs to ground enabled at power-up. – joan Nov 18 '18 at 17:31
  • I am using 17, 27, 22 using the BCM numbering. So should I put the resistor before or after the load? – flips Nov 18 '18 at 19:09
  • I just saw from the definition it is between vcc and the load. So before the load. Otherwise it would be pull down. – flips Nov 18 '18 at 19:11
  • resistorguide.com/pull-up-resistor_pull-down-resistor according to this guide I should use a value of ~5k given that some experiments reveal pin impedance to be about 50kohms – flips Nov 18 '18 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.