kriswiner / VL53L5CX

Some sketches for the VL53L5CX ranging camera for use with the Arduino IDE

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VL53L5CX

Some examples for the ST's VL53L5CX 8 x 8 pixel ranging camera using Simon Levy's Arduino library and Seth Bonn's multi-byte I2C read and write functions.

BasicExample shows how to use the interrupt for data ready as well as allowing some basic parameters to be set like data rate and pixel array size, etc. This sketch combines several of the examples in ST's API. In order to get the 8x8 resolution working I had to increase the VL53L5CX_TEMPORARY_BUFFER_SIZE to 4096 in the vl53l5cx_api.h library file. Simon Levi should have already done this, but if it doesn't work for you check this buffer size and change appropriately.

I am using this VL53L5CX breakout board with the Ladybug STM32L432 development board.

VL53L5CX

DisplayExample is more or less the same as the BasicExample except I have added an Adafruit 128 x 160 color TFT display and I am plotting the 64 ranging pixels using RGB565 format in inverse order; that is, closest pixels are brightest. Unlike plotting 8-bit image data or thermal camera data, the dynamic range of the VL53L5CX is quite large, varying from a few mm to 1650 mm from my desk top to the ceiling, for example. Even when looking at a nearby object the distance gradations are not as "image-y" as I would hope for a "camera". This means nearby objects appear white and far-field objects black and not a lot of gradation in between. Here is an example of the display image of my forefinger ~10 cm above the VL53L5CX:

VL53L5CX_Camera

The forefinger and hand are close and white, ceiling far and black but not much other information is apparent. More work will be required to plot range data in a more intuitive manner. Maybe using a logarithmic scale...

DualExample shows how to use two (or more) VL53L5CX (with default I2C address of 0x29) on the same I2C bus. The sketch uses the LPN pin to disable the I2C bus on one of the VL53L5CX (at 0x29) while the I2C address of the other is changed to 0x27. After the change, both LPN pins are set to HIGH (or the LPN pinMode can be changed to INPUT since there is a 47K pullup on the breakout board). The sensors Dev and Range classes are separately instantiated and data is read upon interrupt for each sensor independently. The treatment is simple and a bit clunky, but effective. This procedure can be repeated for an arbitrary number (well, up to about 100) of VL53L5CX on the same I2C bus.

The VL53L5CX breakout board is available for sale on Tindie.

Copyright 2021 Tlera Corporation. All rights reserved.

About

Some sketches for the VL53L5CX ranging camera for use with the Arduino IDE


Languages

Language:C++ 90.5%Language:C 9.5%