Connecting sonar to navio2

Hello y’all, I’m new to the the quad copter scene and have been reading up on the F450 and checking out its various setups. I have also ordered most of the components to get one off the ground, frame, ESC’s, motors, navio2 ect… Of what I have so far accumulated I have been able to power the navio2 with rPI and get it connected to APMplanner GCS. I also have a power module that came with navio2 hooked up and displaying voltage readings. I was wondering if any one familiar with Navio2’s could assist me on connecting a sonar module and get it working with APMplanner. The one I have is the “Maxbotix LV MaxSonar EZ4 MB1040” which I have been able to power it with the red and black wire’s from the ADC port of the Navio2. What I don’t understand is which wire or pin do I need to connect to get the feedback from the thing?

Or is there a pinout diagram for the navio2 anyone knows of that could maybe help?

Anyways any help would be great, thanks

1 Like

Hi David! This sonar has analog output which can be connected to Navio2 ADC channels in the ADC port (check the labels on the bottom of the board).

Hi FPVdude,

I’ve done some digging around with the navio2 adc too… What I’ve found out so far (copied from another thread):

Mikebert4Mike Beaton2d
@mikhail.avkhimenia - thanks for the response, I’ve got the ADC example working for me now (see below) but I can’t get the data into APM - I’ve tried pin 4 and pin 5 in APM, but no avail.

…hacked C++ ADC example…

I’ve hacked the C++ example to output voltage from all of the channels provided in /sys/kernel/rcio/adc/ reading from each of the 5 files in that dir and outputting thus:
(ch0 | ch1 | ch2 | ch3 | ch4 | ch5)

example output:
4.8320V | 0.0000V | 0.0160V | 0.0220V | 0.0180V | 0.0700V
4.8320V | 0.0000V | 0.0160V | 0.0220V | 0.0180V | 0.0700V
4.8320V | 0.0000V | 0.0160V | 0.0220V | 0.0180V | 0.0700V
4.8320V | 0.0000V | 0.0160V | 0.0220V | 0.0180V | 0.0700V
4.8320V | 0.0000V | 0.0160V | 0.0220V | 0.0320V | 0.0660V
4.8380V | 0.0000V | 0.0260V | 0.0220V | 0.0320V | 0.0660V

So, that gives me a channel mapping thus:

ch0 = always 4.832v
ch1 = always 0v
ch2 = unknown (just noise seen)
ch3 = unknown (just noise seen)
ch4 = ADC (green wire on connector)
ch5 = ADC (blue wire on connector)

… What I don’t know is what those inputs translate into for APM - that’s where I got stuck!

If you discover the secret… please share!

These work as usual ADC channels in APM, e.g. if there is a choice for an ADC channel in Mission Planner or APM Planner you can specify these.

Sorry, I should have said - I’m using the LV-EZ4 as well - I found a great video on how to wire it up with a noise-reducing cable…

Basically, Red to V+ (With a 100ohm resister in line), Black to Ground, signal wire to AN (pin 3 - should be labelled), and a 100mF capicator across ground/V+

Using the test in Navio2/C++/Examples/ADC - I got a readable signal this way (on channels 4 and 5, depending which wire I plugged in)

I’ll have a try again later this week - I tried all the APM analogue pins in order (0 to 9) and couldn’t get a reading into mission planner - what pin should we set RNGFIND_PIN to, exactly?

Ok great thanks I got it working finally! I did an SVN repo download of the C++ examples at and then did watch on the each of the channel files outputted by ADC.cpp in /sys/kernel/rcio/adc/

Then I compared with channel mapping and connected the green wire and vuala! I was able to point the sonar around and get different readings from various distances on CH5.

In APMplanner im able to get it to show distance and its corresponding voltage. The only tricky thing was to uncheck ‘Ratio Metric’ in the Initial Setup tab or you could set RNGFND_RMETRIC=0

That’s awesome. I’ll try that later this week!

@FPVdude - what pin did you set in APMplanner?

On the bottom of the Navio2 the wire going from pin labeled ADC3, with mine it was the green wire. then that connected to AN on the bottom of the Maxbotix. Then in APMplanner I set the input pit to 5 and unchecked the Radio Metric box and it works


I’ve just tested it… and success - thankyou all for your help!

Disabling Ratio-metric is important - it seems that that function is either broken or lacks a scale-factor with which to execute it’s maths, enabling it forces my range to 0.

I’ve just tested range - and with my EZ4 I’m using a scale factor of 4.32m/v and an offset of 0.04v - which makes the sensor accurate to within 5cm (indoors - tested to 3m) I’ll refine this when I can get the sensor outside and away from reflections.

1 Like

Why the 100Ω resistor in line? Surge protection? Thanks

Hello @Mikebert4 , where you able to do a terrain following with the sensor or how is it helpful on the Navio 2?

Is take off and landing more accurate given that you can measure the distance to the ground?


Give this pdf from MaxBotix a look. It explains the circuit, for what models to use a 10 or 100 ohm resistor, and why it is needed.

But this does not address the issue if such a Sonar would help or improves the landing or takeoff procedure yet with Navio 2…

I am confused now as you Suggest the ADC connected sonar,
whilst the pixhawk webpage suggests the I2C connected sonar.

Which one to use ?

Is it possible to use an I2C Sonar with the Navio 2 on Raspberry Pi 3?

Yes, absolutely. That is how we are using it since it gives us a more accurate reading. Just make sure you keep the cable between the sensor and the Navio2 DF13 connector as short as possible. We tried connecting it to the ADC and it was being affected by the 16-channel receiver every time we turned the radio On as show here.

1 Like