Pi 3B: Why would only GPIO 4 work to read a contact sensor and no other pin?

I’m using openhab 2.3 on OpenhHabian on a Pi Model 3B. I’ve got gpio 4 to work reading my contact sensor, but none of the other pins seem to work. For eg. if I change the ‘pin:4’ below to ‘pin:17’ and move the wire to the 6th pin down on the left hand side (GPIO 17), it doesn’t work (other wire going to ‘ground’). Am I missing something?

home.items file:

Contact PIR "door [%s]" { gpio="pin:4 activelow:no" }

home.sitemap file:

sitemap home label="Apartment Control"

        Frame label="Living Room"
        Text item=PIR label="door"

Find out how to look in the logs ad see what state changes take place, in your working and non-working examples. It’s a starting point.

I don’t know what does your HW looks like, however it may be related to the default pull-up configuration of the pi, which is: GPIO 0-8 have pull-ups to 3V3 enabled, while GPIO 9-27 have pull-downs to 0V enabled.


1 Like

Ok, thanks I’ll check that out. The other pins worked as outputs and I was able to control some relays with them but those same pins don’t work as inputs with my sensor. Is there a config needed to set the pins as inputs/outputs with openhab? Or I just need to make sure inputs are all plugged into pins 0-8?