1

It seems that I am missing something or I have mis-configured something.

I have a garage door opener connected to a relay to my GPIO. If I use gpio export 17 out the circuit will complete and the door opens. However any attempt to read/write seems to fail. Look at this below. -- why am I getting different values?

pi@raspberrypi /sys/class/gpio/gpio17 $ ls
active_low  device  direction  edge  subsystem  uevent  value
pi@raspberrypi /sys/class/gpio/gpio17 $ cat value
1
pi@raspberrypi /sys/class/gpio/gpio17 $ gpio read 17
0

I can then gpio export 17 in to "resset" then gpio export 17 out and the door will close. I know that's not right, but what am I missing?

2

It may just be the difference between configuring the gpio as an input or an output.

I expect gpio export 17 out configures gpoio17 as an output and actively writes 0 or 1 depending on the last setting.

I suspect gpio read 17 is (erroneously) setting gpio17 as an input. It will no longer be driven by the Pi but will take the value of the external circuit (which seems to be driving it low).

You could check by using my pigpio pigs utility.

sudo pigpiod
pigs w 17 1 # set as output and write 1
pigs r 17 # should read back 1

EDITED TO ADD

I've just tried the same commands with the gpio utility and it does not set the gpio as an input when doing gpio read 17. It also reads back the correct value. So either you have got an old version of the utility or something odd is going on with your relay.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.