GPIO pull-up / down issue

Hi everyone, I have a problem setting up Pull-up / down resistors for GPIO buttons.

So, my buttons without any resistor work fine, but as there’s no resistors, i occasionally have unwanted button presses.

So I decided to put a pull resistor to any button. The problem is that when I actually push the buttons, sometimes they work, sometimes they don’t.

I’ve made a PCB like this:

POS ------ SW -------- GPIO ------- 10k res -------- NEG
POS ------ SW -------- GPIO ------- 10k res -------- NEG
POS ------ SW -------- GPIO ------- 10k res -------- NEG

Positive and negative are shared, and I tried both pull-up and pull-down just inverting positive and negative.

Any idea what i may have done wrong?

afaik Raspberry comes with both pullup and pulldown resistors built in, you only have to switch which of both should be active (in software)

Udo, thanks for the answer.
I’ve searched everywhere, but I didn’t find how to enable the internal resistors in openhabian. Any hints?

Afaik there is no option at all to do this in openHABian.

So, just for you to know, there IS a way to enable a raspberry’s internal pull up/down resistors in an openhabian system (actually any debian based system).

I may write a tutorial about it since there’s lack of information on the subject.

I’m a bit disappionted that your last reply just linked generic infos on pull up/down resistors that, if you read my first post, I already knew how they work. Luckily i’m stubborn and kept searching/studying.

Well, in fact the link is about how to enable internal pullup/pulldown resistors per pin, although you will need a python script. This sort of scripts is not part of openhabian (as far as I know).

I may have misunderstood your first posting :wink:

My apologies, as I’ve read the truncated file without opening the actual link.

Anyways I solved with wiringPI and a bash script.

Out of curiosity - are the pullups configured active in some way by default, then? Why didn’t your external pullups work as expected?

afaik by default there are some GPIs konfigured as pullup, some others as pulldown, so it depends on which GPI is used…