VL53L1X Time of Flight (ToF) sensor


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

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.



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



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.



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.



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.



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

1 Like


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



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. =)



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.



… Wow.

My Grandad’s on the other side of the continent and I’ve seen pictures of snow piled as high as me. You sure know how to weather over there :D



Just got back from my morning walk with my dog Ginger. -15c with a feels like -21c. We walk on a trail in the woods so we don’t have to deal with the feels like. We still keep a close eye on the dogs.
Not much snow around right now. We had some rain a few days back that cleared a lot of it away.
Around here they say, if you don’t like the weather, just wait 15 minutes lol.