VL53L1X Time of Flight (ToF) sensor


#1

I followed the install instructions and ran
sudo pip install smbus2
sudo pip install vl53l1x
When I run the trigger.py file from Idle (Python 3) I get VL53L1X no such module error?
Reran the two above with pip3 but now I get another error?
Value error not enough values to unpack (expected 2, got 0)
line 24, rows, cols = [int© for c in os.popen(“stty size”, “r”).read().split()]

All I want to do is verify it works?


VL53L1X (ToF) Arduino Issues
#2

Curious- I thought I had an idea why it might be failing, but a quick check of the .whl files suggests my theory was wrong.

Giving it a try to see if I can replicate.


#3

Ooooh I bet stty size just wont work in IDLE3 because it’s not connected to a tty of any sort.


#4

The current Raspbian only lists Python 3 from the GUI menu, or I would have just ran it in Idle2.
Just want to be sure its working before I try it in Arduino.
Can I launch it in idle2 from the terminal? I should know the answer to that but its 6:30 AM and I haven’t even had one cup of Java yet, lol.


#5

Try running the same example via Terminal with python3 directly.

I’m not sure if there’s any way I could make this work sensibly within IDLE since it’s trying very hard to be a CLI application. I might have to whip up some less ambitious examples.


#6

OK, that I know how to do, I’ve been down the python versus python 3 road before.
Will I see and output on screen someplace? How do I know it worked etc?

EDIT: Never mind, I’m running it from the terminal doah.


#7

Whipped up a simple example, and added some error-handling to graph.py to catch this- https://github.com/pimoroni/vl53l1x-python/blob/master/examples/distance.py


#8

Ok, just powering up that Pi, will let you know how it goes in a bit. Thanks.


#9

That worked thanks a bunch. After a comedy of errors at my end. I thought I had downloaded the file but it saved as a link to the file or something? I got a weird syntax error and opened the file to find it was all html something something something, lol. Had to clip and past from the GitHub page into idle then save it and run it. Just me doing things in the early AM half asleep. ;)

Anyway once I got it running I could see the numbers drop as I moved my hand closer and closer. Lowest number was around 25 mm or so. Now I know its functional and the real fun starts. Getting it running on my Arduino. I want to use it with my ZUMO rover for collision avoidance.

Thanks Phil for the quick example file. =)


#10

Time for a nice walk in the woods with my dog Ginger. We’ve been cooped up in the house now for about 4 days. It’s been too cold to really safely walk anywhere. Wind chill has been around -20c for days now.
Its only -6 out today, and being in the woods we will be out of the wind for the most part. Just the icy trail to watch out for. Enjoy your day Phil, or at least try to. I’ll likely be starting another thread when I start messing around on my Arduino.