VL53L1X ToF distance sensor - adapting to micropython

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
benjam
Posts: 1
Joined: Fri May 25, 2018 10:06 am

VL53L1X ToF distance sensor - adapting to micropython

Post by benjam » Fri May 25, 2018 10:13 am

Hi guys,

I'm starting to experiment with the new VL53L1X sensor for which there is an Arduino library, and I'd like to port it to micropython.

https://github.com/sparkfun/SparkFun_VL ... no_Library

However I'm no expert and I have to learn a lot, and I'm using I2C to read/write to the correct registers.

It seems like someone wrote a library for the previous model of the sensor, the VL53L0X.
So if anyone is working on the new one please let me know as this would be useful.
Otherwise if I get somewhere I'm happy to share my code.

Thanks :)

Ben

User avatar
s-light
Posts: 3
Joined: Sun Jun 21, 2015 8:18 am
Location: Germany, Nuremberg
Contact:

Re: VL53L1X ToF distance sensor - adapting to micropython

Post by s-light » Sun Sep 09, 2018 9:20 am

hi benjam,

did you started experimenting with this in MicroPython?

i have found a python librarie - but have not jet looked at what it needs to get this ported to MicroPython..
https://github.com/pimoroni/vl53l1x-python

and also what it takes to port it to Adafruit CircuitPython
- i think they have a different hardware-abstraction layer -
but have not read the Design Guide (https://circuitpython.readthedocs.io/en ... guide.html) yet..

i will post back here if i get something going..

sunny greetings
stefan

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: VL53L1X ToF distance sensor - adapting to micropython

Post by jickster » Sun Sep 09, 2018 5:22 pm

I don’t have any of the mentioned hardware but I have done a lot with the C-layer of micropython.

Quote me if you need help with C-functionality.


Sent from my iPhone using Tapatalk Pro

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: VL53L1X ToF distance sensor - adapting to micropython

Post by devnull » Wed Oct 10, 2018 4:50 am

The VL530LX predecessor thread is here: viewtopic.php?t=3358#p19605

@deshipu has created a library for the VL530LX but it does not appear to work for the VL531LX (https://bitbucket.org/thesheep/micropyt ... vl53l0x.py)

Tindie are selling these at only USD10.00 each (https://www.tindie.com/products/blkbox/ ... r-arduino/) which is where I got mine, which is incredible good value given they have a range of up to 4 meters, but I have been unable to get them to work !

csebe
Posts: 1
Joined: Tue Feb 11, 2020 10:55 am

Re: VL53L1X ToF distance sensor - adapting to micropython

Post by csebe » Fri Feb 14, 2020 2:52 pm

Has there been any updates? I'm using the same sensor with a v1.1 Pyboard. I watched the videos on how to write a C-wrapper in Micropython, but I don't know how I would have to write it when I have multiple .c and .h files. Could anyone suggest a way to get started?

OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: VL53L1X ToF distance sensor - adapting to micropython

Post by OutoftheBOTS_ » Fri Feb 14, 2020 11:09 pm

I have used this sensor with micropython but it was quite a while ago now. I did defiantly use
@deshipu has created a library for the VL530LX but it does not appear to work for the VL531LX (https://bitbucket.org/thesheep/micropyt ... vl53l0x.py)
and it worked for me.

I looked through my videos and found a video that I made to send to someone that I was helping use the sensor. https://www.youtube.com/watch?v=jLUuA2j ... e=youtu.be

elschopi
Posts: 16
Joined: Tue May 12, 2020 5:12 am
Location: Bavaria, Germany

Re: VL53L1X ToF distance sensor - adapting to micropython

Post by elschopi » Wed Sep 30, 2020 7:28 am

Hello everyone,
I know this is quite old, but I'm a bit out of ideas in getting this sensor to work.
The library which is linked in this thread is not available anymore, so I'm using https://github.com/uceeatz/VL53L0X

Now my problem is that this library is coming from a pycom wipy board, which I do not have. When trying on my ESP32, I get an error that tells me that the module 'Timer' doesn't have an attribute 'Chrono'.
From what I understand, it is only used to 'perform_single_ref_calibration', and used as a timer.

Is there a possibility to port the 'Chrono' part to ESP32? Or is that a specialty of the pycom boards?
Or, better yet, could someone provide me with the alternate library?

Best regards,
Chris

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: VL53L1X ToF distance sensor - adapting to micropython

Post by jimmo » Thu Oct 01, 2020 12:48 pm

elschopi wrote:
Wed Sep 30, 2020 7:28 am
Is there a possibility to port the 'Chrono' part to ESP32? Or is that a specialty of the pycom boards?
Yes this is a pycom feature.

However, it's functionaly just a way of measuring how much time has passed. Short for "Chronograph" (or "stopwatch").

In MicroPython you can just use the time.ticks_ms() to get the current uptime in ms, and time.ticks_diff() to get the difference between two values.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: VL53L1X ToF distance sensor - adapting to micropython

Post by pythoncoder » Fri Oct 02, 2020 8:02 am

I was sufficiently intrigued by this device to spend some time researching it. Unfortunately I couldn't locate a programming manual. This is odd as STM usually document their kit extensively. These links might be of interest.

https://github.com/adafruit/Adafruit_Ci ... vl53l0x.py Adafruit driver for VL53L0X - a device with more limited range.
https://www.l33t.uk/ebay/vl53l1x/
https://github.com/pololu/vl53l1x-arduino Driver written in C.

The Pymoroni library https://github.com/pimoroni/vl53l1x-python referenced by @s-light above uses a .so library which is a Linux equivalent to a DLL. This is effectively a binary blob. As far as I know MicroPython has no support for such files.

I've ported a number of C drivers to MicroPython so I considered porting the Pololu driver. However it's a complex driver. And in every case where I've ported a driver from C to MicroPython I've had access to a programming manual and needed it. Perhaps someone more skilled or braver will tackle it.

I'd go for the VL53L0X and try to track down @deshipu's driver; or, failing that, port the Adafruit one. But there doesn't seem to be a manual for that device either...
Peter Hinch
Index to my micropython libraries.

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: VL53L1X ToF distance sensor - adapting to micropython

Post by deshipu » Sat Oct 03, 2020 9:42 am

pythoncoder wrote:
Fri Oct 02, 2020 8:02 am
I'd go for the VL53L0X and try to track down @deshipu's driver;
There are backups of all my repositories that Bitbucket deleted available here: https://bitbucket-archive.softwareherit ... /thesheep/

Post Reply