Dual Mb1242

Hello, I am a teacher, and each year we do different projects with drones. This year we are venturing in to autonomous vehicles, and hoping to continue to develop the project in the coming years. My students have set up a successful rover that we can program to run a series of way points without any issue. To give the vehicle obstacle avoidance, we purchased 2 mb1242 sensors to attach to i2c on our pixhawk. When the rangefinders are activated, I can get a distance reading, but the steering always turns to the right. I have read I need to change the address of one of the sensors, but have not had any luck using an arduino. Do we need different sensors, or am I doing something wrong? Thanks for the help in advance.

Unfortunately I have only used the Maxbotics MB1240 analog sonars and have no experience with the MB1242 I2C sonars.
I suspect that you problem is that the Pixhawk cannot differentiate between the two sonars since you appear to not be able to change the second sonar’s I2C address. Also, the Pixhawk sonar code may not be setup for two I2C sonars.
Since I have successfully used two of the MB1240 analog sonars, in the triggered mode to avoid beam interference, you might want to consider doing the same.
Here is a link to using two MB1240 sonars on a Pixhawk: http://ardupilot.com/forum/viewtopic.php?f=36&t=8124
This tutorial was written before the change to the “rangefinder_x” parameter designator and used the old “sonar_x” parameter designator, but they are equivalent.

Thanks you for the reply. I was thinking that I might have to get analog sensors. I noticed that you are connecting them both to the 3.3V, and using an output for the trigger. Can you please tell me the pin connections on the sonar for the trigger wiring? Thanks again for all your help.

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.

Ok, so I guess I may have worded it wrong before, so I apologize for my ignorance (Im a visual person). On the sensor end of the wiring, is the AUX 4/5 from pixhawk going to the sonar signal input? Thanks again for all the help.


Per the Maxbotix data sheet for the MB1240:
Pin 4-RX– This pin is internally pulled high. The XL-MaxSonar-EZ sensors will continually measure range and output if the pin is left unconnected or held high. If held low then it will stop ranging. Bring high 20uS or more for range reading.
The two triggers from the Pixhawk will go to each sonar’s Pin 4-RX respectively.

has anyone done 4 sensors- 1 for each corner of the rover


Hi Tomas, me im having a maxbotix and instead of wiring it on i2c i want connect it on the pwm of the pixhawk,do you mind share me pls the parameters i must setup on MP and the correct wiring on the sonar.
Hope in a positive answer.