Unable to setup any range finders

Hi team.

Not sure if this is right place, but I’ve been dabbling with Pixhawk to make my own Quad. While the basics worked for me i.e. takeoff flight & the FPV system, I wanted to move next step and start adding sensonr units to Pixhawk.

My plan is to add 10 rangefinders for 360degree, but wanted to start with one at a time and scale it up. The Rangefinders I’ve handy with me are:
VL53L1X (I2C) - x1 (ST VL53L0X / VL53L1X Lidar — Copter documentation)
VL52L0X (I2C) - x2 (ST VL53L0X / VL53L1X Lidar — Copter documentation)
HC-SR04 (GPIO) - x2 (HC-SR04 Sonar Rangefinder — Copter documentation)
Maxbotrix 1040 (Serial) - x1 (Maxbotix Analog Sonar — Copter documentation / Interfacing Ultrasonic Sensors with a Pixhawk or Ardupilot Mega (APM))

I followed the instructions as linked above, have been rechecking my wirings since 2-3 days now, but no matter which range finder I use, with whichever port, Mission Planner can’t detect any rangefinder & readings are always 0.

I tried following combinations of connections:
VL53L0X & VL53L1X (one at a time) : Directly to i2C, didn’t work. Via i2c hub, didn’t work but other devices connected to hub ( SSD1306/GPS) worked.
Maxbotrix Sonar to ADC 3.3V port, didn’t work.
HC-SR04: Without Logic Level shifter, on Aux 5 & 6 (With Pins as 54 & 55) didn’t work. With logic shifter on diff aux pins (In case pin 4 & 5 are fried and changing params) also didn’t work.

I also verified to remove faulty sensor scenrio, by testing VL53L0X and HC-SR-04 after testing on Pixhawk, and am able to get readings in raspberry pi, so wanted to know what possibly is wrong.

Since this is my 1st time post, if any follow up documents, pictures, wire diagrams etc are required do let me know I can add to the post.

Thanks for help in advance,

Recall that VL53LxX are for indoors use.

I think that for 360 degrees there are supported systems. For a moderate number of rangefinders you can use I2C based ones changing the default address (TFmini’s…). They should have a dedicated supply.

Thanks for reply Webillo.

I understand that VL53L0X are for indoor use, and for 360 i can make use of 360 lidars but those are expensive options.

I wanted to setup simple altitude hold as initial use case with single sensor attached to my Quad. As described in post, i tried the setups with single rangefinder, either of HCSR04/MB1240/VL53L0X via their respective connections.

So if i should be able to make cheap unidirectional sensor work i would upgrade it to 360 one as recommended. But issue is an unable to make even simple rangefinder work.

I’ve a quick question, when you say the rangefinder needs separate power source, do you mean just for I2C ones (Like VL53L0X) or all sensors like (MB1240 via ADC3.3 connector & HCSR04 via servo rail of PixHawk). I tested the pins of MB1240 & HCSR04 via voltmeter they were around 6-7volts. Makes sense since those are power out lines but didn’t get chance to check voltage across VL53L0X connected via I2C.

Note that the servo rail in PixHawk is powered by 5V BEC from ESCs.


I tried various sensors (sonar and lidar), but the one that worked best among the cheap ones is the TF LUNA which has the defect of emitting a lot of EMI and disturbing the GPS (on small quadcopters with small spaces). Here are some tips and videos:

Strange. It’s part of documentation so I would like to believe they are supported (Maybe the dev who created it isn’t supporting anymore). Thanks for the heads up. I was planning to by a MaxBotix (MB1242 I2CXL-MaxSonar-EZ4 | MaxBotix Inc.) which costs me same as TF-Luna Micro (TF-LUNA Micro LiDAR Distance Sensor) . Let me place an order for TF Luna.

But an update on the post, I suspected is it case of faulty sensor, so I tried testing it with RPi I’ve got, it didn’t detect anything in i2c port. I thought maybe sensor is damaged, so tried a brand new i2c sensor as well with RPi w/o soldering (Maybe my soldering technique damaged the PCB ? ) headers but still no connect leading me to believe my RPis SD & SC pins are fried (But how can it fry when connecting to VL53L0X for 1st time). I’ll try to check if sensors are working or not using couple of Aurdino and another RPi I’ve got but scared to fry pins of another RPi.

I somehow suspect this is a case of some configuration am missing out on. Let me give it a try using TFLuna using configs you’ve mentioned and update. Just don’t want to fall back to using RPi as companion for obstacle avoidance as well as I plan to use it for Image recognision later on.

Strange thing is haven’t many people in this forum have tried PixHawk with wither VL53L0X/MaxBotix/HCSR04!



In general, when the sensor emits it is going to demand large current from supply. Check individual sensor datasheet.

Compare with 4 or 8 TFmini’s, for example.

Na there was no smoke…for stranger reasons my 3s LiPo is charged to 4.2v/cell but output from PDBs are around 16-17v total. Hence across the whole circuit I’ve 2v extra. Output from various BEC are at +2, so does from UBEC, servo rail, ADC Ports on PixHawk.

Haven’t seen smoke yet and I think there should be a buffer voltage levels.

As for update, I think I’ve damaged my VL53L0X sensor. I tried VL53L1X and BMP280 with Arduino to make sure sensors are working and it’s working only VL53L0X isn’t.

Am going to test MaxBotix and HCSR04 sensors with Arduino, to make sure that there is issue from PixHawk side or sensor side.


So guys, quick update after few experiments today.
Was able to accertain that VL53L1X & HCSR04 are working file and there is issue with VL53L0X I’ve got. (Strange both piece aren’t working). I was trying to test Maxbotix 1040 as well but seems their official website is down with some attack so no docs handy for interfacing with RPi or Arduino.

Anyways, to add to mix I wanted to add another I2C sensor to veriff a hunch I’ve had. Tested BMP280 also worked with RPi & Arduino like VL53L1X & HCSR04.

I then added ony by one to Pixhawk (VL53L1X & BMP280 pressure sensor) and to my surprise I found that BMP280 is working and sending data across MavLink but VL53L1X isn’t. no sonarvolate and range.

I think there must be issue in application code of Pixhawk where maybe they have stopped supporting these cheap range finders? Because other devices through I2C works but Rangefinders doesn’y!!

I think because in the external environment the ranges of these sensors are too small and therefore not very usable. Here you see my test of a maxbotix i2c clone. Look at the distance between me and the backing drone, that’s the range of that sonar