Hi!
I’m trying to integrate and implement an external button with my Nvidia Xavier NX. I want to be able to detect a button-push in my Python code. I’m using the package Jetson.GPIO
to interact with the GPIO pins.
After quite some investigation, I found out that the package Jetson.GPIO
doesn’t support pull-up resistors (because “there’s no way to control pull-up/-down from user-space on Jetson.”: pull_up_down value is unused · Issue #5 · NVIDIA/jetson-gpio · GitHub).
Because of this, I’ve soldered and integrated my own pull-up resistor, with the following schema:
Where:
- R1: 1kΩ
- GPIO (read in code): pin 15 (board mode)
- 3.3v: pin 17 (board mode)
- GND: pin 14 (board mode)
Here’s the code snippet that handles the button push:
def start(self) -> None:
"""Starts infinate loop listening to button click. When clicked, it changes the active artwork."""
while True:
input_state = GPIO.input(self.GPIO_pinout)
if input_state == False:
self._change_active_artwork()
time.sleep(self.loop_sleep_sec)
PROBLEM
For some reason, the button is sometimes “pushed” without me pushing it. In my setup, each time the button is pushed, a new image is displayed on a screen. It’s a big problem that the button “self-push”, as the image changes without any manual interaction.
I’m trying to trouble shoot the reason for this weird behaviour, and I’m suspecting that I might be because I’m using the wrong ohm on my resistor. Could the ohm be to high, thus the state of the GPIO pin will randomly sometimes fall back to 0/False even though it shouldn’t?
Could anyone with more knowledge please point me in the right direction? Am I using the correct Ohm for this application?
Best,
Max Fischer