Pull down resistors for GPIO



  • Hi guys,

    I am suffering from unexpected gpio activations on a push switch. I am using a "rising" condition with the new-gpio program by Kit Bishop (thanks for that!).

    Should I be using pull-down resistors with the gpio to ground? What would be a good value, 10k?

    Thanks!



  • @Samuel-Mathieson I assume from your message that you are using a switch that pulls the GPIO pin high.
    While I cannot give an authoritative answer, in my opinion it is never a good thing to rely on a state for a pin that is left floating - which would be the case when the switch is open with no pull down - on my Omega, when I examine the pin states of all pins when they are left floating (i.e. unconnected to anything) some show as low and some as high.
    Thus, I would highly recommend using a pull down resistor.
    Unless you are already using it, I would also recommend using a debounce time as my code allows for - mechanical switches can be noisy and cause additional spurious signals when switching.



  • I am already using a debounce time of 5 seconds. More so that the switch cannot activate more than once every 5 seconds. What value of pull down resistor is a good idea, 10K?

    Thanks,
    Sam.



  • @Samuel-Mathieson Personally, I think a pull down of 10K would be fine.
    Interestingly, information at https://wiki.onion.io/Hardware-Specifications/Electrical-Characteristics and the information in Section 7.4 in https://wiki.onion.io/Hardware-Specifications/ar9331_datasheet.pdf says:

    • Pullup/Pulldown resistance: 200 kΩ

    Implying that GPIO pins have a pull up and pull down resistance.
    However, it is unclear what this actually means:
    a. Does it mean they need such a pull up/down?
    b. Or does it mean that they already have such built-in resistances? Which would seem to imply that they are effectively floating and would need additional pull up/down to pull them to the required level.



  • Thanks for the additional info. It seems a little ambiguous as you say.

    200K seems rather high. I am just finishing the installation with 10K. I will see how that works now.

    Thanks again for the help.



  • I'd recommend using a pull-up resistor and connecting the switch to ground. A capacitor across the switch will add some analog debounce as well. Using a pull-down instead will probably work, but the logic transition levels typically work better with a pull-up, perhaps .1 uF or 1 uF.

    As for Kit's question, I think that means that the GPIOs have a 200k pull-up and pull-down resistance, and you need something smaller for a pull-up or pull-down to prevent the input from floating.



  • @Samuel-Mathieson Good luck :-) Hope it goes well. Would be interested to know results.

    @Boken-Lin Any possibility of clarification on the pull up/down for GPIO pins?
    What does the documentation in https://wiki.onion.io/Hardware-Specifications/Electrical-Characteristics actually mean?
    Should we be using external pull up/down when the pin is not actively driven one way or the other?
    As I indicated above, my testing of floating GPIO pins indicates some return as low and some as high.



  • Yes, use a pull-up or pull-down if it is an input that's not being actively driven. Floating inputs can go either way, and they can definitely cause problems.



  • Thanks guys.

    I used a pull-down resistor. Seems everything is working exactly as expected.

    Thanks again!



  • @Samuel-Mathieson Cool :-) Glad it worked and you are going again.


Log in to reply
 

Looks like your connection to Onion Community was lost, please wait while we try to reconnect.