Admin

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 RTN
Pin 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 trigger
Aux Servo pin 4 (Virtual pin 53) Left sonar trigger
These two outputs go to the Left and Right sonar trigger pins.

Then go to the MP's Full Parameter List and set up the Sonar and Sonar2 parameters. For the Maxbotix MB1240 setup described above use the following parameters:
BRD_PWM_CNT 0 (Makes all the Aux Servo pins digital)
Sonar Function 0
Sonar Enable 1
Sonar Debounce 2
Sonar Max Cm 700
Sonar Min Cm 20
Sonar Offset  0
Sonar Pin 14 (Left sonar)
Sonar Scaling 2.04 (Adjust as necessary to display the correct distance to the target)
Sonar Settling Ms 50
Sonar Stop Pin 53 (Left sonar trigger)
Sonar Trigger Cm Whatever distance you want in cm
Sonar Turn Angle Whatever distance you want in deg
Sonar Turn Time Whatever distance you want in sec
Sonar2 Function 0
Sonar2 Enable 1
Sonar2 Debounce 2
Sonar2 Max Cm 700
Sonar2 Min Cm 20
Sonar2 Offset  0
Sonar2 Pin 13 (Right sonar)
Sonar2 Scaling 2.04 (Adjust as necessary to display the correct distance to the target)
Sonar2 Settling Ms 50
Sonar2 Stop Pin 54 (Right sonar trigger)

Regards,
TCIII ArduRover2 Developer

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

    • Can any of the MaxSonars, in the 3DR store, be used with Pixhawk?
      Is the more expensive 1240 required for dual sonar setup?

      Thanks

      Anders

    • Admin

      @Anders,

      You can use any of the Maxbotix sonars as long as they are analog. You will have to adjust the scaling factor to your particular sonar.

      Regards,

      TCIII AVD

    • Thanks a lot for your info

      Regards

      Anders

  • Have you been in contact with Tridge, is there any hope it will be resolved in near future, year 2014?

    • Admin

      Hi Raimo,

      Unfortunately I have yet to hear from Tridge since the completion of the AU OBC.

      I believe that the sonar issue will be corrected in the near future, but as to when, I do not know.

      Regards,

      TCIII AVD

  • Admin

    Hi All,

    The issue with the dual sonars not being sequentially triggered correctly has been corrected in firmware v2.46 beta which can be found here: Rover Latest

    I have verified that the dual sonar function in the new beta firmware operates correctly.

    Regards,

    TCIII ArduRover2 Developer  

    • Hi,

      I need help with enabling The SONAR.

      Description of problem and setup:

      MP 1.3.9

      Rover 2.46

      Pixhawk: RNGFND_PIN = 13 and 14, RNGFND_TYPE = 1 (analog)

      APM 2.5: RNGFND_PIN = 0 and 1, RNGFND_TYPE = 1 (analog)

      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.

      Regards,

      Raimo

    • Admin

      @Raimo,

      Why are you using  RNGFND_PIN = 13 and 14, RNGFND_TYPE = 1 (analog) on the Pixhawk?

      Also, the instructions are for Maxbotix sonars and not the HC-SR04 which may have an output that is different than the Maxbotix sonars.

      Regards,

      TCIII AVD

    • Hi,

      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.

      Regards,

      Raimo

    • @Thomas

      I dont understand the reason for this question: "Why are you using  RNGFND_PIN = 13 and 14, RNGFND_TYPE = 1 (analog) on the Pixhawk?"

      Are the instructions about pin mapping and MP comments wrong?

      Regards,

      Raimo

This reply was deleted.