GPIO not working on RPI4 #116
-
Hi, this is a continuation of a discussion started elswhere. I have connected a pushbutton to Pin 18 of RPI4 with a pullup resistor to VCC+3V. Pushbutton-Presses are not reported by MQTTany (MQTTany 0.14.3). /etc/mqttany.yml: mqtt:
host: 'localhost'
port: 1883
client id: 'test'
gpio:
pintest:
pin: 18
pin mode: 'input'
resistor: 'pullup' Just to be on the safe side, I have connected GND to Pin No.6 and the other part of the Pushbutton to Pin No. 18 (GPIO 24). The pin numbering can be found at https://www.raspberrypi.org/documentation/usage/gpio/ python3 mqttany/mqttany.py -vv results in:
Pressing of Pushbutton is not reported at all. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 8 replies
-
OK, here is an update. I use gpio version: 2.60, retrieved via Now i issue the following commands: gpio mode 5 up After that, I can reliably read any pushbutton actions with 'gpio read 5'. The GPIO 5 used by gpio corresponds to my physical pin 18 (you can get this via the listing obtained by gpio readall): gpio readall Now the first question is, which Pin Number is MQTTany refering to? I would like to avoid testing stuff on the wrong pin number... Is it physical pin 18, is it GPIO Pin 5 according to GPIO readll or is it PinNo. 24 according to the official wiring diagram? |
Beta Was this translation helpful? Give feedback.
-
A simple fix: you need to enable interrupts. Adding the option to your config gives this: mqtt:
host: 'localhost'
port: 1883
client id: 'test'
gpio:
pintest:
pin: 18
pin mode: 'input'
resistor: 'pullup'
digital:
interrupt: both |
Beta Was this translation helpful? Give feedback.
-
Does not work. The result is: Traceback (most recent call last): 2021-03-16 16:30:20,988 [ERROR] [core ] [config ] Config file does not specify a version |
Beta Was this translation helpful? Give feedback.
-
### Config file version
version: '1.0'
######## MQTT Module ########
mqtt:
host: 'localhost'
port: 1883
client id: 'test'
gpio:
pintest:
pin: 24
pin mode: 'input' # can be 'input' or 'output'
resistor: 'pullup' # can be 'pullup', 'pulldown', or 'off'
digital:
interrupt: both
|
Beta Was this translation helpful? Give feedback.
-
aaaaah. OK, I didn't know that :-) Now I see something:
Please note, I'm using "pin 24" here because the documentation of MQTTany says that SoC is default, and for PIN#18 SoC is 24. |
Beta Was this translation helpful? Give feedback.
aaaaah. OK, I didn't know that :-)
Now I see something: