Connecting sonar to navio2

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!