Trilobot Distance Sensor

Hi, built the robot from RaspberryPi shop in Cambridge lat week and I am running tests, whenever I run anything that uses the distance sensor it with error as below. I have rebuilt the robot and made sure that he header block is in correctly no pins are bent and that the pins on the distance sensor are correctly seated. I2C is also enabled.
How can I test to see if the distance sensor is connected or what should I do to test?
Running RaspberryPi 64bit latest on Pi4 with 4GB, i am testing using the samples from GITHUB.
Regards,
Luke

Trilobot Example: Print Distance

Traceback (most recent call last):
File “/home/luke.kenyon/Pimoroni/trilobot/examples/print_distance.py”, line 23, in
distance = tbot.read_distance(timeout=25, samples=3)
File “/usr/local/lib/python3.11/dist-packages/trilobot-0.0.2-py3.11.egg/trilobot/init.py”, line 535, in read_distance
GPIO.wait_for_edge(self.ULTRA_ECHO_PIN, GPIO.RISING, timeout=timeout)
RuntimeError: Error waiting for edge

Did you get this sorted? I’m having the exact same issue.

Might be worth trying with the Legacy version of Pi OS? I don’t think the new GPIO libraries that are available in Bookworm have a way of reading the time between GPIO pulses as of yet, which I suspect is why this example is falling over.

Hi, what worked for me was create a Python 3 virtual environment and then adding in the packages I needed via pip3. I uninstalled RPi.GPIO and then installed in the virtual environment along with trilobot.
One thing that I did not do was follow the setup on GitHub as it always failed.
I then used GitHub as the source and just copied the relevant code, I created copies for distance_print.py and distance_ligts.py and tested both and the worked as expected.
my version of RPi.GPO in the venv is 0.7.1 and trilobot is 0.0.2

Thanks both - I went back to bullseye and that worked fine

1 Like