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

    • Admin

      @Raimo,

      Okay, now I know where you are going with your statement about the Pixhawk sonar input pins.

      In my Full Parameter List the sonar analog input pins are SONAR_PIN  for the left sonar and SONAR2_PIN for the right sonar.

      Where are you seeing RNGFND_PIN and RNGFND_TYPE?

      Regards,

      TCIII AVD

    • @Thomas

      Full Parameter list, search for Sonar:

      https://lh5.googleusercontent.com/-RC8l8JvC9pg/VB737YPyE3I/AAAAAAAA...

      Full Parameter list, search for Sonar, result:

      https://lh4.googleusercontent.com/-4C3sp0HYZXU/VB736yaQ4zI/AAAAAAAA...

      Search RNGFND result:

      https://lh4.googleusercontent.com/--FVnINICwmE/VB736_si_OI/AAAAAAAA...

      Full Parameter list, Tree:

      https://lh5.googleusercontent.com/-8FGGz3p3-EI/VB737ziC5-I/AAAAAAAA...

      No Sonar, only RNGFND

      I updated the MP to 1.3.10, result is the same. These are screenshots when APM is connected. Selection possibilities for Pixhawk are the same.

      Regards,

      Raimo

    • Admin

      @Raimo,

      Since I do not use the sonars any longer, as they are not effective at speeds above 3m/s, there must have been a change to the sonar input pin acronym that I am not aware of.

      It sounds like the sonar function in the ArduRover stable firmware is possibly broken if you cannot get your sonars to work.

      You might have to wait until our Developer/Programmer Tridge is available after the AU OBC to fix the issue if there is one.

      Are you sure that the HC-SRO4 output is compatible with the present sonar function?

      Regards,

      TCIII AVD

    • Admin

      @Raimo,

      I have tried one of my Maxbotix MB1240 on my test bench Pixhawk and it is definitely a no go.

      Will have to wait for Tridge to resolve this sonar non-functional issue.

      Regards,

      TCIII AVD 

    • Admin

      @Raimo,

      There have been major changes to the general rangefinder firmware recently  to accommodate the integration of additional types of sensors and the changes to the ArduRover2 rangefinder firmware have not been verified.

      Regards,

      TCIII AVD

    • Hi,

      HC-SR04 signal is not fed directly to Pixhawk/APM - the signal activation, calculations, processing and conversion is done with Arduino Micro. The output is just voltage from 0 to 3V - analog. I modified the code so that it will not go above 3V, although ADC should support also 5V signal.

      "It sounds like the sonar function in the ArduRover stable firmware is possibly broken if you cannot get your sonars to work."

      How can that happen?

      Regards,

      Raimo

  • Admin

    Hi All,

    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.

    Sorry for the inconvenience.

    Regards,

    TCIII ArduRover2 Developer

  • 3D Robotics

    Excellent! Does this differ in any important way from what's in the manual?

    And any chance for doing the same for dual GPS?

    • Admin

      Hi Chris,

      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.

      Setting up the sonar functional parameters is the same.

      Regards,

      TCIII ArduRover2 Developer

    • 3D Robotics
      Ah, thanks. Will you be adding this to the wiki?
This reply was deleted.