# Intergrating VL53L1x Range Finder with VOXL2

Source: https://forum.modalai.com/topic/3583/intergrating-vl53l1x-range-finder-with-voxl2
Category: VOXL 2 and VOXL 2 Mini (https://forum.modalai.com/category/26/voxl-2-and-voxl-2-mini)
Tags: voxl-2
Posted: 2024-06-25 19:47:02 UTC by Jetson Nano
Replies: 31 · Views: 8632

## Jetson Nano · 2024-06-25 19:47:02 UTC

Hello, 

I'm using a VL53L1x rangefinder for reducing drift accumulated during VIO on a Starling system. I'm using the sensor VL53L1X, which I'm connecting to VOXL2 through J19 port where I2C communication lanes (Pins 7,8) are available. 

When I enable range finder parameters in QGC, I'm not getting any data from the rangefinder in mavlink inspector or mavlink console. As mentioned in ModalAI documentation, this sensor is directly compatable with VOXL2. Is there any specific functional parameter which is to be enabled in PX4 config seperately?

## Reply by modaltb (ModalAI staff) · 2024-06-27 15:39:41 UTC

Hi @Jetson-Nano our implementation is used on the applications processor (not the DSP) so you would want to use this reference:
https://gitlab.com/voxl-public/voxl-sdk/services/qrb5165-rangefinder-server/-/tree/master

## Reply by James Strawson (ModalAI staff) · 2024-06-28 00:35:32 UTC

Hi @Jetson-Nano 

The I2C port on J19 is connected to the Sensors DSP and therefore can't be accessed from the main applications processor. 

Here is a new documentation page describing how to hook up and use these sensors.

https://docs.modalai.com/rangefinders/

## Reply by Jetson Nano · 2024-07-04 13:19:48 UTC

Thank you @modaltb @James-Strawson,

Will check and get back. Apart from VL53L1x what are the other Rangefinder sensors which are compatible with VOXL2?

## Reply by Jetson Nano · 2024-07-05 07:32:40 UTC (in reply to Jetson Nano)

@James-Strawson @modaltb , I checked with reference to the documentation you shared, but still it was not working.

I used the M0141 USB2 Breakout Board with the VL53L1X Rangefinder, and ran the commands that was there in the documentation.

```
voxl-configure-rangefinders 1_downward_on_m0141
```

And I got the similar output for the following commands

```
voxl2:/$ voxl-configure-rangefinders 1_downward_on_m0141 
creating new config file for 1 downward TOF without multiplexer
DONE
enabling  voxl-rangefinder-server systemd service
Done configuring voxl-rangefinder-server
voxl2:/$ cat /etc/modalai/voxl-rangefinder-server.conf 
/**
 * Rangefinder Configuration File
 * This file is used by voxl-rangefinder-server
 * please use voxl-rangefinder-server --config {arrangement}
 * to set up this file.
 *
 * FOV for VL53l1X TOF rangefinder is a diagonal FOV in degrees and
 * can be set between 15 and 27 degrees.
 *
 * vl53l1x_timing_budget_ms MUST be one of 20, 33, 50, 100, 200, 500
 * 100 is default
 * vl53l1x FOV options are 15, 20, and 27 degrees
 * default is 27
 *
 * set id_for_mavlink to a valid id (0+) to publish that sensor reading to
 * mavlink as a DOWNWARD sensor for the autopilot to use
 * set to -1 to disable this feature.
 */
{
	"i2c_bus":	1,
	"vl53l1x_timing_budget_ms":	50,
	"id_for_mavlink":	0,
	"sensors":	[{
			"enabled":	true,
			"sensor_id":	0,
			"type":	"TOF_VL53L1X",
			"fov_deg":	15,
			"range_max_m":	3,
			"location_wrt_body":	[-0.02500000037252903, 0.019999999552965164, 0.00800000037997961],
			"direction_wrt_body":	[0, 0, 1],
			"is_on_mux":	false,
			"i2c_mux_address":	112,
			"i2c_mux_port":	0
		}]
}
``` 

But the rangefinder server in not running, even after starting the server. It is enabled but not running.

![Screenshot from 2024-07-05 11-38-52.png](https://forum.modalai.com/assets/uploads/files/1720164738170-screenshot-from-2024-07-05-11-38-52.png) ![Screenshot from 2024-07-05 11-39-05.png](https://forum.modalai.com/assets/uploads/files/1720164738184-screenshot-from-2024-07-05-11-39-05.png)

## Reply by modaltb (ModalAI staff) · 2024-07-11 15:33:21 UTC

Can you detect the sensor on the I2C bus, e.g https://docs.modalai.com/voxl2-linux-user-guide/#i2cdetect-usage ?

## Reply by Jetson Nano · 2024-07-17 13:07:03 UTC (in reply to modaltb)

@modaltb It is not detecting any sensors, I check the sensor with another FC with PX4 which support VL53L1X and it was detected there.

![83689947-e4e1-4267-a075-2918b54f68f4-image.png](https://forum.modalai.com/assets/uploads/files/1721222683040-83689947-e4e1-4267-a075-2918b54f68f4-image.png)

## Reply by modaltb (ModalAI staff) · 2024-07-17 14:14:30 UTC

what about with 

i2cdetect -r -y 1

## Reply by Jetson Nano · 2024-07-18 04:48:21 UTC (in reply to modaltb)

@modaltb I tried detecting in all i2c bus, 0 to 5, it wasn't detected, I got three devices in 4, but it was UU and I think it is the cameras.

## Reply by Jetson Nano · 2024-07-25 07:16:10 UTC (in reply to Jetson Nano)

@modaltb 

![70308483-ccc3-4068-b59f-bc44b2608a01-image.png](https://forum.modalai.com/assets/uploads/files/1721891752540-70308483-ccc3-4068-b59f-bc44b2608a01-image.png) 
![cf541698-4c24-4180-aad6-79d543f3c9c3-image.png](https://forum.modalai.com/assets/uploads/files/1721891767774-cf541698-4c24-4180-aad6-79d543f3c9c3-image.png)

## Reply by modaltb (ModalAI staff) · 2024-07-25 16:48:25 UTC

Hi @Jetson-Nano 

OK we'd expect something on the bus like this:

![b67f6f17-672e-4d9e-94a7-6dc803bd8e97-image.png](https://forum.modalai.com/assets/uploads/files/1721925758513-b67f6f17-672e-4d9e-94a7-6dc803bd8e97-image.png) 

Can you describe your wiring setup?

## Reply by Jetson Nano · 2024-07-26 10:23:14 UTC

This is the wiring diagram of the sensor with the USB Expansion Board.
![Screenshot 2024-07-26 at 3.52.05 PM.png](https://forum.modalai.com/assets/uploads/files/1721989331686-screenshot-2024-07-26-at-3.52.05-pm.png)

## Reply by Jetson Nano · 2024-07-26 17:42:24 UTC (in reply to Jetson Nano)

@modaltb Is there any specific SDK we could check for the working of Range-Finder with?

## Reply by modaltb (ModalAI staff) · 2024-07-30 15:22:41 UTC (in reply to Jetson Nano)

@Jetson-Nano are you using our M0070 board like this? https://docs.modalai.com/rangefinders/#single-rangefinder-using-m0141-expansion-board

Or custom?  If custom check pin 5, which on our M0070 board is pulled up to 3.3VDC.

![5639b8e2-b569-4c3e-934e-6ab3816e4ab5-image.png](https://forum.modalai.com/assets/uploads/files/1722352944791-5639b8e2-b569-4c3e-934e-6ab3816e4ab5-image.png)

## Reply by Jetson Nano · 2024-07-30 15:30:11 UTC (in reply to modaltb)

@modaltb I'm using M0141 expansion board.

## Reply by modaltb (ModalAI staff) · 2024-07-30 15:32:15 UTC (in reply to Jetson Nano)

@Jetson-Nano what is the VL53L1X on?

## Reply by Jetson Nano · 2024-07-30 15:35:08 UTC (in reply to modaltb)

@modaltb is connected on J5 port of M0141.

## Reply by modaltb (ModalAI staff) · 2024-07-30 15:37:01 UTC (in reply to Jetson Nano)

@Jetson-Nano can you take a picture?  for example, we make a M0070 board that has this sensor on it.  Are you making your own carrier board for the sensor?

![0b5bffdb-4c2d-495a-96db-d42e6dd0c8cb-image.png](https://forum.modalai.com/assets/uploads/files/1722353821169-0b5bffdb-4c2d-495a-96db-d42e6dd0c8cb-image.png)

## Reply by Jetson Nano · 2024-07-30 15:43:31 UTC (in reply to modaltb)

@modaltb This is our setup,

![IMG_3702.jpg](https://forum.modalai.com/assets/uploads/files/1722354166254-img_3702.jpg) 
![IMG_3703.jpg](https://forum.modalai.com/assets/uploads/files/1722354172141-img_3703.jpg) 
![IMG_3701.jpg](https://forum.modalai.com/assets/uploads/files/1722354204056-img_3701.jpg)

## Reply by Vinny (ModalAI staff) · 2024-07-30 17:41:15 UTC (in reply to Jetson Nano)

HI @Jetson-Nano 
We have not seen that module before.
Is there a product link you can share so we can investigate for voltage and signal compatibility?

Thanks!

## Reply by Jetson Nano · 2024-07-31 04:50:31 UTC (in reply to Vinny)

@Vinny @modaltb Here is the link of the product

https://www.ktron.in/product/vl53l1x-laser-ranging-module-tof/

Thanks!

## Reply by Vinny (ModalAI staff) · 2024-07-31 17:01:29 UTC (in reply to Jetson Nano)

Thanks @Jetson-Nano 
Can you help us find schematics?
I do not know what these parts are doing and could be leading to some of your issues...
![c8740441-8344-4eda-b26d-9762e267bcf4-image.png](https://forum.modalai.com/assets/uploads/files/1722445249472-c8740441-8344-4eda-b26d-9762e267bcf4-image.png) 
That site only has the link for the original datasheet.
Without more detail, I cannot offer much help aside from speculation.

Thanks!

## Reply by Jetson Nano · 2024-08-02 04:48:10 UTC (in reply to Vinny)

@Vinny I was not able to get the schematics. But when I tested this sensor with a Pixhawk flight controller running PX4, I was able to get it working on I2C.

## Reply by Vinny (ModalAI staff) · 2024-08-02 05:05:53 UTC (in reply to Jetson Nano)

Hi @Jetson-Nano 
Pixhawk ports are 5V voltage output, we provide 3.3V.

![77c90398-23c8-4f39-b1d1-324977798bc6-image.png](https://forum.modalai.com/assets/uploads/files/1722574578610-77c90398-23c8-4f39-b1d1-324977798bc6-image.png) 
So, that data point does not help me from the HW viewpoint. I am assuming you knew you had 5V VREF from Pixhawk and converted to 3.3V.

However, if we had the SCH of that module, that will tell me if they are actually trying to do voltage conversion of the I2C bus down to 1.8V (the default operating mode of these ST ToF units), which most likely is not compatible with our ports. 
![aa868fe7-8fd0-4d78-b7f1-a33c75f8b832-image.png](https://forum.modalai.com/assets/uploads/files/1722575022511-aa868fe7-8fd0-4d78-b7f1-a33c75f8b832-image.png) 

Most hobby electronics shops do not plan for all variations of translators, and most voltage translators do not like being cascaded. With a pixhawk, you are native 3.3V from the micro-controller w/o a level translator, so going through 1 level translator down to either 1.8V or 2.8V is no issue.
On VOXL 2 and VOXL 2 Mini, all of our JST ports have been translated up from 1.8V to 3.3V, which can limit the signal level translators we can work with since we end up with cascaded translators and that can be problematic if not designed correctly, especially I2C.
So, the SCH for that module is required for me to help further.
Sorry, but I can't do much else.

## Reply by Jetson Nano · 2024-08-02 05:10:27 UTC (in reply to Vinny)

@Vinny Is there any other carrier board you recommend, because modalai doesn't have the rangefinder for sale yet?

## Reply by Vinny (ModalAI staff) · 2024-08-02 05:31:10 UTC (in reply to Jetson Nano)

Hi @Jetson-Nano 
Every time we try an OTS product, it is flakey due to level translation issues. So we have done our own internally, but not yet made it available standalone. It is on our roadmap to support these ST ToF modules, not just the VL53L1x, but others as well.

The Starling V2 Front End has one of these, but we have not made that little board a standalone product yet: https://docs.modalai.com/M0173/#downward-range-finder-and-flir-lepton

## Reply by Jetson Nano · 2024-08-02 05:52:57 UTC (in reply to Vinny)

@Vinny Thanks!

## Reply by Vinny (ModalAI staff) · 2024-08-02 05:57:44 UTC (in reply to Jetson Nano)

@Jetson-Nano 
I'll try my best to tag you once we make the M0157 for sale individually, but it relies specifically on the hardware circuits on M0173 to work.
Again lots of interface nuances with these little ST sensors, and the newer ones are more painful to integrate since they are dual voltage. We are working that aspect now for future efforts. I know this does not help you now, but rest assured we are on it!

## Reply by Jetson Nano · 2024-08-02 12:56:42 UTC (in reply to Vinny)

@Vinny I saw that M0173 is available in the modalai website. If I get that board with the new image sensors and use it with voxl 2, can I get the VIO running with three tracking cameras?

## Reply by Vinny (ModalAI staff) · 2024-08-02 18:21:39 UTC (in reply to Jetson Nano)

Hi @Jetson-Nano 
Sorry, not my area of expertise.

@modaltb, are you able to offer guidance here?
Thanks!

## Reply by modaltb (ModalAI staff) · 2024-08-09 14:45:17 UTC (in reply to Vinny)

@Jetson-Nano not at this time and not with QVIO.  We are working on multi cam VIO but can't provide any details or release dates really at this time.

## Reply by Jetson Nano · 2024-08-10 05:14:14 UTC (in reply to modaltb)

@modaltb Thank you for the update
