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

Views: 9630

Replies to This Discussion

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

And any chance for doing the same for dual GPS?

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

Ah, thanks. Will you be adding this to the wiki?

Hi Chris,

Yes, I can get with Tridge during the Sunday code hacking hangout and integrate it into the Wiki.

Regards,

TCIII ArduRover2 Developer

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

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

@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

@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

RSS

Groups

Season Two of the Trust Time Trial (T3) Contest 
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here

© 2018   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service