cancel
Showing results for 
Search instead for 
Did you mean: 

Issues while interfacing two VL53L1X sensors using Esp32

PNadar08
Associate II

Hi ST team and community!

I am trying to develop a People Footfall Counter for commercial use using the two VL53L1X Sensors on Esp32 using the Sparkun Library from the following:

https://github.com/sparkfun/SparkFun_VL53L1X_Arduino_Library

First of all, I set two different addresses using XSHUT pins for the respective VL53L1X sensor. On calling getI2CAddress() function, I receive the set addresses again. But strangely, when i2c scanner code is executed(the i2c scanner code written just below the getI2CAddress()), I receive a single i2c address ie. 0X0B after scanning and not the assigned addresses of VL53L1X. Also it shows as 1 device found which is again strange as it should scan the VL53L1X Sensors as two separate entities since we have assigned two separate addresses. Please ignore address 0X68 as its of RTC.

Since its for commercial use, I need the VL53L1X sensors to cover maximum area too. I get better output in ROI Configuration: x=8, y=8 and opticalCentre = {167, 223}. But when the ROI Configuration is set as: x=8, y=16, opticalCentre = {167, 223} the accuracy drops and many a times the person crossing goes undetected.

Can we use multiple(in my case two) VL53LIX sensors for detecting a person crossing and even cover maximum area too?

I tried analysing distances of both the sensors and updated the status ie. in or out of both the sensors separately.

Then used the logical 'OR' condition ie. if any of the sensors detects a person crossing, then increment the person count to one.

This doesn't give proper output, in fact the output is much better when the distance of only one sensor is analysed and count of the person crossing is incremented without using logical 'OR'.

Is there any better way to implement multiple VL53L1X?

Refer the attachment below for the code snippet and the received output.

1 ACCEPTED SOLUTION

Accepted Solutions
John E KVAM
ST Employee

I'm really sorry you are having trouble.

The software most likely to be of use to you is:

STSW-IMG017

2D LIDAR using multiple VL53L1X Time-of-Flight long distance ranging sensors

It sets up 9 different sensors.

If you have 2 sensors giving the exact same answer, you have failed to actually address the second sensor.

(I know, I've done it.)

Can happen that you thought you changed the address on one of the sensors. But in fact did not.

So one sensor is answering for both.

  • john

If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.

View solution in original post

4 REPLIES 4
John E KVAM
ST Employee

you have two questions there. One is about the lack of ability to set up 2 sensors. So I'm going to make a guess on this one.

There are two ways to define a I2C address. One is the 7-bit address. The default is 0x29. The other way is to specify the write address (0x29<<1) = 0x52. The read address is one larger than the write address.

I'm guessing your scannner gives the 7-bit address.

(What I've said is true, but I'm only guessing that it's your issue.)

The other problem is with the people counting itself.

I tried using distance as you did. And it works - sort of. It's better in one direction than it is in the other direction.

Consider using the signal strengh per SPAD as an added piece of information.

As the person barely enters the FoV, you get a distance and a small signal, but as he enters the FoV completely you get a bigger signal.

and that added bit of information can help a lot to add information about where in the FoV the person is.

  • john

If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.
PNadar08
Associate II

Can you please point me to a program that works with 2 VL53L1X at one time?

Because what I get is both the sensors giving same exact values even if they have different addresses as well as objects in front of them.

If it is possible can you please ask about this question in your company and give me a specific answer as I have been trying to make the sensors work for last 2 months and I cannot understand how to make 2 devices work giving two different ranges at one time.

John E KVAM
ST Employee

I'm really sorry you are having trouble.

The software most likely to be of use to you is:

STSW-IMG017

2D LIDAR using multiple VL53L1X Time-of-Flight long distance ranging sensors

It sets up 9 different sensors.

If you have 2 sensors giving the exact same answer, you have failed to actually address the second sensor.

(I know, I've done it.)

Can happen that you thought you changed the address on one of the sensors. But in fact did not.

So one sensor is answering for both.

  • john

If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.
PNadar08
Associate II

Solved the above problem by interfacing the two VL53L1X sensors to two different I2C Buses.

Also there was issue on my side as the XSHUT Pins where connected to GPIOs of Esp32 which work only as Input State and not as Input and Output State. Corrected this and now all four sensors are working fine.