Pixhawk 2.1 with maxbotic I2CXL-maxsonar-EZ issues

Thank for this, i have this issue on my pixhawk2 and i can’t use lidar on the second I2C port.

Is the I2C port of the second GPS is the same as the first GPS ?
So perhaps we can use it without cut the first GPS cable ?

i need to test…

tested, that doesn’t work…

Were you able to get more than one Sonar working? It seems like if you accessing the I2C through the GPS port that ardupilot actually see’s, then your only able to hook up one sonar, until support for the second I2C port comes in?

I’m pretty sure on the Cube the gps2 port is on the internal i2c bus. And unless they implemented support for the internal or second bus in 3.5 RC6…it isn’t being read by AP.

I know for sure nothing but the oled display will read off of that bus in AP.

I’m running at least 4…maybe 5 accessories wired as I described without issue. I do have the higher current devices powered externally however.

There were some issues with sonar not being read in this RC.

So is anyone able to get SONAR or LIDAR or any object avoidance system to work on the latest version of ardupilot with the pixhawk 2.1?

I use a lidar lite or a terra ranger one (pix 2.1 and copter 3.4.6).
but with a custom cable for taking i2c on the first gps port.

Awesome, could you share your pinout on the custom wiring? Any idea if this will work with the maxbotics sonar sensors as well?


the pinout of the first gps port, you juste need a y cable for the i2c pin.
be careful with the 5V, perhaps you need an external power supply.
and there is no reason that the maxbotix sonar wouldn’t work.

1 Like

Awesome thank you much for that! So all I do is splice (not cut and replace as the GPS still needs it?) in the appropriate wires into the GPS1 port with the I2C plug and then I should be able to have AP read the sonar connected?

Can by any chance I connect an additional sonar, or does the additional need to be seen separately on another port?

Why do you say be careful with the 5V from the pixhawk? Just make sure im not over driving it? So to be safe run a 5v PS?


I just realized the sonar im using is the analog XL sonars not the i2c. Here is how its supposed to be connected to the pixhawk:


Im not sure how to hook it up to the 2.1, its ADC port has 3 wires, and I cant find a pinout like you provided above. Could you let me know where to findthe 2.1 pinouts? I dont see them in the literature here from the downloads folder:


This is the Sonar I am using:


Can someone explain how the compass is the GPS can work if the range finder is also wired to the SCL and SDA pins? I’m can’t see how both the compass and rangefinder can be wired to the same pins?

I2C is a serial bus : all devices have an indivifdual adress and the FC is the master that initiate conmunication by sending the sensor adress first and then send an instruction or read a value

Ah right great, that makes sense. Didn’t realise it worked like that with my analog brain. Might actually consider hacking my Here GPS cable now. I have the 1240 sensor which I’ve had some success using the analog output (cos i ddidn’t want to hack the GPS cable without knowing it would work). When I say some success I mean I’m getting a voltage that roughly changes when I move the copter around on the bench.
When I arm and fly however it’s not current working. In the field it just got stuck at 6.5m and didn’t do anything else. Read the troubleshooting guide and I think it’s most likely noise on the power supply for which I’m going to wire in a filter as advised here:

It could also be radiated noise, acoustic noise or vibration but I’m trying the power filter first, then Ill try moving the sensor further away from the motors etc onto the copter landing gear. Soft mounting is also something i’ll try.
If all that doesn’t work I’ll try I2C but one quick question - reading the manual it looks like I can output either I2C or analog becasue it has pins for both, however elsewhere on the internet it says you need to order a different sensor depending on whether you want analog or I2C.
Can anyone clarify that.

The I2C is the MB1242 look here

Sonar are not very effective as rangefinder, lidar are much better.

I’m starting to see that, but the lidar options all seem quite expensive (>$150 (£110)) to me,unless anyone knows different? Thanks

Yes its the case, the cheapest being the Garmin Lidar Lite v3 for the moment.
We might have an interesting option pretty soon ,

its just been release, we will need to write driver for it … stay tuned :wink:

Oooh looks interesting. I’ll keep on fighting with the sonar for now then! Thanks.

Hi, friends, pls allow me to share, the Benewake inexpensive micro LiDAR sensor TFmini is available. You could pls check OzRobotics link for more details.

1 Like


Can this be used in Arducopter/Pixhawk yet? I guess this will still need a driver writing for it to work? This looks like the same one as referenced above?


@Michael_Brooks I suppose you are asking about TFmini? TFmini is compatible with Arduino, Pixhawk, APM. It does not need a driver like Sonar.
You can please check this TFmini LiDAR development routines on Arduino for reference. Thanks.
Development Routines of TF LiDAR on Arduino-170726.pdf (778.3 KB)