# voxl2 rangefinder (lw20)

Source: https://forum.modalai.com/topic/2869/voxl2-rangefinder-lw20
Category: General Questions (https://forum.modalai.com/category/2/general-questions)
Posted: 2023-11-16 16:05:18 UTC by relevinsky
Replies: 9 · Views: 2045

## relevinsky · 2023-11-16 16:05:18 UTC

Hi,

I need to connect my rangefinder (LW20) to the VOXL2 board using connector J19 (by I2C) to the PX4 flight controller. What configurations should I make in QGroundControl to receive the "Distance Sensor" message in the Mavlink Analyze tab?

Thank you.

## Reply by Eric Katzfey (ModalAI staff) · 2023-11-17 15:10:36 UTC

@relevinsky The driver for that is not currently built into the VOXL2 PX4 firmware. You would need to add that to your build.

## Reply by voxltester · 2024-05-14 18:10:02 UTC (in reply to Eric Katzfey)

@Eric-Katzfey 
I am wondering if rangefinders can be used for VOXL2.
Specifically, I have LW20/C rangefinder and tried to setup on VOXL2 by referring to [https://docs.modalai.com/voxl2-D0015/](https://docs.modalai.com/voxl2-D0015/). But it is not working.

One more thing is `voxl-configure-rangefinders` package.
[https://gitlab.com/voxl-public/voxl-sdk/services/qrb5165-rangefinder-server](https://gitlab.com/voxl-public/voxl-sdk/services/qrb5165-rangefinder-server)
Can you explain what this one is for?
I tried to use it by running `voxl-configure-rangefinders`, it is not working..
I hope you provide the instruction to install the rangefinder on the VOXL2.

Thank you.

## Reply by Eric Katzfey (ModalAI staff) · 2024-05-15 14:48:18 UTC (in reply to voxltester)

@voxltester In order to use the LW20 with i2c interface you would need to add that driver to your build (e.g. in `boards/modalai/voxl2-slpi/default.px4board`). And then you would need to start that driver in the startup script (e.g. in `boards/modalai/voxl2/target/voxl-px4-start`).

## Reply by Eric Katzfey (ModalAI staff) · 2024-05-15 14:51:50 UTC (in reply to voxltester)

@voxltester The `voxl-configure-rangefinders` refers to range finders connected to the apps processor outside of px4. If you use that then the `voxl-rangefinder-server` will communicate to px4 with mavlink messages to indicate distance.

## Reply by voxltester · 2024-05-15 15:05:21 UTC (in reply to Eric Katzfey)

@Eric-Katzfey 
Thank you for your quick answer.
Eric, on my VOXL2 flight deck, I cannot find `board` folder...
Please refer to the version info of my VOXL2.

```
voxl2:/$ voxl-version 
--------------------------------------------------------------------------------
system-image: 1.7.1-M0054-14.1a-perf-nightly-20231025
kernel:       #1 SMP PREEMPT Thu Oct 26 03:25:38 UTC 2023 4.19.125
--------------------------------------------------------------------------------
hw platform:  M0054
mach.var:     1.0
--------------------------------------------------------------------------------
voxl-suite:   1.1.3-1
--------------------------------------------------------------------------------
Packages:
Repo:  http://voxl-packages.modalai.com/ ./dists/qrb5165/sdk-1.1/binary-arm64/
Last Updated: 2024-05-07 20:27:28
```

## Reply by voxltester · 2024-05-15 15:09:43 UTC (in reply to voxltester)

@Eric-Katzfey 
One more question,
Is there any other way to use LW20 instead of i2c?

## Reply by tom (ModalAI staff) · 2024-05-15 16:29:21 UTC (in reply to voxltester)

@voxltester This is what he is referring to as the `boards` folder: https://github.com/modalai/px4-firmware/tree/b5c45bb232afc6a936b8349f4fa0be1efeb17707/boards

## Reply by voxltester · 2024-05-15 16:52:06 UTC (in reply to tom)

@tom 
THank you for the info.
I am using VOXL2 flight deck... I never touched the PX4....

What I found just before is `/etc/modalai/voxl-px4.conf`
I edited `DISTANCE_SENSOR=LIGHTWARE_SF000`, then I was able to see PX4 parameter `SENS_EN_SF0X` in QGC. I set it as `LW20/c`..

But I cannot see the rangefinder data in QGC `MAVLink Inspector`...

## Reply by Eric Katzfey (ModalAI staff) · 2024-05-16 15:11:40 UTC (in reply to voxltester)

@voxltester Again, LW20 is not in the px4 build. Until you rebuild px4 with that driver you cannot use it within px4. So, you have 2 choices. Rebuild PX4 and try to get LW20 working within PX4 or take a look at the source code for voxl-rangefinder-server and see if you can add support for LW20 into that. It currently supports the vl53l1x rangefinder. Perhaps you can just switch to that rangefinder model? Otherwise the source code it here: https://gitlab.com/voxl-public/voxl-sdk/services/qrb5165-rangefinder-server
