How to Install Dual Sonars on a Pixhawk

Hi All,I just completed installing dual Maxbotix MB1240 sonars on one of my Pixhawk equipped rovers.Since the sonars were from an APM equipped rover they already had single pair shielded cables terminated with three pin servo connectors providing power, rtn, and the sonar output signal.You will need a DF13 five pin connector cable to connect to the Pixhawk ADC3.3vdc Analog Input. The cable should be wired as follows:Pin 1 5vdc (red)Pin 2 Left Sonar Signal Input (Sonar)Pin 3 RTNPin 4 Right Sonar Signal Input (Sonar2)Pin 5 RTN

Since I am using two sonars, I had to trigger them sequentially to avoid having them see each other. Therefore I used two of the Aux Servo pins as Digital Outputs:Aux Servo pin 5 (Virtual pin 54) Right sonar triggerAux Servo pin 4 (Virtual pin 53) Left sonar triggerThese two outputs go to the Left and Right sonar trigger pins.

The only change from the manual is electrically interfacing the sonars to the Pixhawk ADC3.3vdc Analog Input DF13 five pin connector.

When interfacing with the APM each sonar connected to the APM Analog Input channels with a three pin servo connector. In my case I built a small interface board that had two three pin mating connectors on it that allowed me to mate the sonar cable servo connectors to the DF13 five pin cable wires.

Additional testing of the Pixhawk dual sonar configuration has found that the two sonars are not being triggered sequentially by the digital stop pins. The sonars will appear to work intermittently, but cannot be considered to be fully functional at this time. The single sonar configuration will work just fine and I have found that the single sonar will give accurate, repeatable results with minimum false triggers or drop outs.

Linus Penzlien's review of the PX4 code found that the sonar stop pin function has not been implemented for the PX4 causing both sonars to free run and interfere with each other when used together. Andrew Tridgell, our developer/programmer, will review the code to determine what is required to make the stop pin functional and we should have a new v2.45 beta available by the end of the weekend.

Under CLI I have tested SONARTEST and get: WARNING sonar is not enabled. From Optional Hardware selection I can not enable nor select sonar. From Full Parameter list selecting RNGFND_TYPE does not activate sonar. There is no longer word "SONAR" under Full Parameter List, I suppose it has been replaced with RNGFND according to Wiki inf.

I have tested my sonar sensors and I can get analog output, tested it with a voltmeter. I'm not using the trigger pin, I get constant sonar output from my sensors. I use the HC-SR04 connected to a Arduino Micro. NB! I got rid of the capacitor/resistor filter, fixed too big deviations with code update.

I also tested the ADC on pixhawk with Arduino Micro by giving constant output of 2V and 1V with 2000ms intervals - no result, have excluded my sensor output not working.

Because you have stated that the 3,3V ADC input 1 and input 2 needs to be mapped to pin 14 and 13 aka Sonar Pin 14 (Left sonar), Sonar Pin 13 (Right sonar). According to MP RNGFND_TYPE comment I need to use analog = 1.

HC_SR04 signal is processed and converted to analog signal with the Arduino Micro with analogwrite. It worked well with previous Firmware on my Rover.