How do I get Maxbotix sonar to work with serial?

Hi, I am new to this forum, please advise me.

I am working on an octa-copter for some agricultural purpose and I need a sonar for a ground proximity sensor. I need to keep the cost down, so I choose sonar instead of laser rf.

I got a MaxBotix MB7060. I made a cable and hook it according to the data sheet so that the sonar will output the reading through a serial protocol. I plug the serial out from the sonar and into my PX4 Pixhawk V2.4.5 at serial 4. I upload the Copter 3.5 rc1. Then, I use mission planner to set the parameter for serial 4 to be LIDAR and Baud rate to 9600 (according to sonar spec), and rangefinder type to MaxBotix Serial. and… nothing happened.

I checked the reading in Range Finder page and it seems that it doesn’t have any reading.
I checked the reading from the pixhawk in the status page and I can’t seem to find sonarrange or sonarvoltage or something relevant.

Am I missing something? Please help

I tried updating to Copter 3.5 latest (rc7?) from github master.
The sonar works in analog, but a lot of noise and I want the filter (which is in serial)

Usually best way to troubleshoot this sort of issue if it doesn’t work right away is to make sure your sonar outputs correct serial data. Have you tried connecting it directly to a computer, with FTDI cable or equivalent? I suspect you might find an issue there. If you do get readings connecting directly to a computer serial port I’d check wiring to Pixhawk, parameter baud rate and serial settings next.

You’ll also find sonar output data in Mission planner in the status tab. There are many parameters there so it’s easy to miss. If you right click in mission planner and pick “User Items” you can choose to do a custom display and display those parameters on the HUD “permanently”.

I double check the wiring and it seems to be correct. I will try changing the baud rate and serial setting next.

There is nothing in “Status” page that I can see that it is relevant to sonar.

I tried hooking it up to the arduino and upload the code to see the serial output of the sonar. It seems to output a value of a number in cm and zero. like this
172
0
173
0
145
0
150

I am not sure whether it should be reading like this or not. The reading was accurate, but I don’t know why there is always a 0 after 1 reading (maybe it is with the code that I upload to the arduino).

Hi guys,

Sorry to bump this post, but I’m having the same exact issue with getting my maxbotix LV-EZ04 sonar to work using the pixhawk’s serial port. I set the baud rate to 9600 and range finder type to maxbotixserial but I’m unsure of what to set the serial protocol to. Setting it to Lidar just gives me a Bad Lidar Health error in Mission Planner. Did you manage to get yours to work?

We have given up and use the I2C model instead.
Sonar works okay in an indoor environment, but there are highly unreliable in an outdoor environment even with the outdoor model. For outdoor use, laser rangefinder will work much much better.

I agree a Lidar rangefinder would work miles better but they are quite expensive and my budget for this project is VERY limited. The sonar was the best I could do. I also understand now that the serial output of the sonar is a form of RS232 serial that represents 1’s with GND and 0’s with Vcc, I’m going to try and implement a TTL inverter and see if the sonar works then.

when I update to 3.5 my analog sonar EZ0 stop to work, and I can not make it work.

Maybe you should send something like this,
The number of floating-point Numbers in meters, and then
add a newline.For example: 1.23 and a carriage return.
If you choose UART sonar,means you should set parameters SERIALx_PROTOCOL 9.And set right SERIALx_BAUD.
(Ps:Im Chinese,fisrt join the discussion. Maybe i hava a terrible English,please dont mine:-))