# Vl53l1x cannot connect to pixhawk

**URL:** <https://discuss.px4.io/t/vl53l1x-cannot-connect-to-pixhawk/33262>\
**Category:** Uncategorized\
**Created:** [July 14, 2023, 12:34pm UTC](https://discuss.px4.io/t/vl53l1x-cannot-connect-to-pixhawk/33262 "2023-07-14T12:34:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ning](https://discuss.px4.io/letter_avatar_proxy/v4/letter/n/b5e925/32.png) [@ning](https://discuss.px4.io/u/ning)\
**Post date:** [July 14, 2023, 12:35pm UTC](https://discuss.px4.io/t/vl53l1x-cannot-connect-to-pixhawk/33262/1 "2023-07-14T12:35:00Z")

</div>

hi,

I bought an ATK-PMW3901 module and want to achieve indoor positioning. However, during testing today, the vl53l1x built-in in the module was connected to the I2C interface of pixhawk2.4.8, and the GPS module was unplugged（the SPI interface was not connected to PMW3901 because the wire I purchased had not yet arrived）. At the same time, the settings shown in the following figure were made in QGC.  
 ![图片](https://discuss.px4.io/uploads/default/original/2X/a/a066f3ad65dc1ca258776902c78f69b60931c731.png)  
 ![图片](https://discuss.px4.io/uploads/default/original/2X/4/44837c3053d4657bc63e19538ada009280eab65e.png)  
 ![图片](https://discuss.px4.io/uploads/default/original/2X/0/01cbae257eb25489b5af8dae544be5f4e60bf16a.png)  
 ![图片](https://discuss.px4.io/uploads/default/original/2X/c/cff76d7a4c6dba01022bf41ed4f5aafc9ecf00c4.png)

However, distance information is not displayed in the Mavlink Inspector, and the following issues were found when executing instructions in the Mavlink Console.  
 ![图片](https://discuss.px4.io/uploads/default/original/2X/4/4e09ad2c7d93b42a313f0ee47359d56fd66838bd.png)

I have modified the~/PX4 Autopilot/boards/px4/fmu v3/default. cmake file and recompiled and burned it.  
 ![图片](https://discuss.px4.io/uploads/default/original/2X/1/17eaf9a3b2a7fd8fb9cd6770b3ff7ff791976844.png)  
 ![图片](https://discuss.px4.io/uploads/default/original/2X/2/27d40df4315cbb65527711d0668b5a1864433aa6.png)

May I ask if there is a problem with my settings and if I need to turn off GPS. I hope to receive your help. Thanks.

---

<div class="post-metadata">

**Author:** ![Igor\_Misic](https://discuss.px4.io/user_avatar/discuss.px4.io/igor_misic/32/13536_2.png) [@Igor\_Misic](https://discuss.px4.io/u/Igor_Misic)\
**Post date:** [July 14, 2023, 3:43pm UTC](https://discuss.px4.io/t/vl53l1x-cannot-connect-to-pixhawk/33262/2 "2023-07-14T15:43:15Z")

</div>

in Mavlink Console try to use `i2cdetect` to verify if the device is properly connected.

---

<div class="post-metadata">

**Author:** ![ning](https://discuss.px4.io/letter_avatar_proxy/v4/letter/n/b5e925/32.png) [@ning](https://discuss.px4.io/u/ning)\
**Post date:** [July 15, 2023, 8:47am UTC](https://discuss.px4.io/t/vl53l1x-cannot-connect-to-pixhawk/33262/3 "2023-07-15T08:47:38Z")

</div>

Thank you for your suggestion. When my I2C interface was connected to vl53l1x, I executed the i2cdetect command and did not display any data;  
 ![图片](https://discuss.px4.io/uploads/default/original/2X/e/e9955fe3b70e29204d5a7550d8b5cf178736e171.png)

But when I connect the I2C interface to GPS, it will display as follows:  
 ![图片](https://discuss.px4.io/uploads/default/original/2X/b/b09bc0a9fa9b21930f8cfe2ea77ac387e4bb24a3.png)

I don’t know why this is happening. I hope to receive your help. Thanks.

---

<div class="post-metadata">

**Author:** ![Igor\_Misic](https://discuss.px4.io/user_avatar/discuss.px4.io/igor_misic/32/13536_2.png) [@Igor\_Misic](https://discuss.px4.io/u/Igor_Misic)\
**Post date:** [July 15, 2023, 9:09am UTC](https://discuss.px4.io/t/vl53l1x-cannot-connect-to-pixhawk/33262/4 "2023-07-15T09:09:46Z")

</div>

The GPS you are using most likely has an integrated magnetometer connected over I2C. So this **1E** address is a magnetometer.

Scan all I2C buses when **vl53l1x** is connected and disconnected, there is more than one bus. Use  
`i2cdetect --help` to learn about the command.

This is how to scan different buses.  
`i2cdetect -b 0`  
`i2cdetect -b 1`  
`i2cdetect -b 2`

> **[Igor Misic is PX4 Autopilot Maintainer](https://www.buymeacoffee.com/igormisic)**
>
> If you found this helpful you can thank him by buying him a coffee.

---

<div class="post-metadata">

**Author:** ![ning](https://discuss.px4.io/letter_avatar_proxy/v4/letter/n/b5e925/32.png) [@ning](https://discuss.px4.io/u/ning)\
**Post date:** [July 15, 2023, 9:40am UTC](https://discuss.px4.io/t/vl53l1x-cannot-connect-to-pixhawk/33262/5 "2023-07-15T09:40:39Z")

</div>

I have scanned all I2C buses, but since the I2C expansion board I purchased has not yet arrived, I can only insert one device at a time. When inserting GPS with a magnetometer, the scanning results are as follows:  
 ![图片](https://discuss.px4.io/uploads/default/original/2X/f/f05785806ae4673e9178611c98cdebfc197262af.png)

When inserting vl53l1x, the scanning results are as follows:  
 ![图片](https://discuss.px4.io/uploads/default/original/2X/9/96ee9b9825829df878fe97ae2726a8b88eccccfd.png)

So I think there may be some issues with my vl53l1x sensor, or there may be a problem with the circuit, and I will check it.  
If you have any other ideas, I hope you can provide them to me. Thank you for your help.

---

<div class="post-metadata">

**Author:** ![Igor\_Misic](https://discuss.px4.io/user_avatar/discuss.px4.io/igor_misic/32/13536_2.png) [@Igor\_Misic](https://discuss.px4.io/u/Igor_Misic)\
**Post date:** [July 15, 2023, 9:53am UTC](https://discuss.px4.io/t/vl53l1x-cannot-connect-to-pixhawk/33262/6 "2023-07-15T09:53:14Z")

</div>

> I think there may be some issues with my vl53l1x sensor

Yes, definitely it doesn’t communicate with the flight controller and this is basic I2C communication (it doesn’t have to do anything with drivers or other software that is needed).

This is the first thing to solve, later you will maybe have an issue with the drivers, but first, take care of this.
