I have installed a I2C MB1242 sonar on my Pixhawk 4 board running PX4 ( on the I2C port).
I have enabled the flag SENS_EN_MB12XX in the
parameter-> Sensors list.
I have read all info I could find on the web including this forum, but it seems that the info is rapidly out of date, which is why I make this post.
My question is : Where can I read the sensor data in QGC (3.4.4 on Mac OS X) ? At present, I have no way to know if my configuration is working or not .
Thanks for any hint.
You can see sensor data if you go on the widget menu (top of the page) and go on “analyze”. In there you can see all the mavlink streams. The one you are looking for is “distance_sensor”. You can also go into the mavlink shell and type:
mb12xx status to see if the driver is running and
listener distance_sensor to see the topic that is published by the driver (containing the measurements).
Thanks for the answer.
In the MAVlink window, I got the error message
ERROR [mb12xx] driver not running
How can I make this driver run ?
If you set the parameter the driver tries to start but something is failing. You can try to start it from the mavlink shell with the following command
mb12xx start -a and check what output you get.
By the way to which i2c port are you connected to? i2c-a or i2c-b?
I connected to the I2C-A
here is the log ( Why cannot just copy/paste ?)
nsh> mb12xx start -a
WARN [mb12xx] Unknown option !
Ok then the issue is that the support for i2c-a was added after the 1.8 release so you would have to flash master to get it to work. If you flash master and set the SENS_EN_MB12XX parameter it should work.
I have upgraded to 1.8.1
I still have the same answers
I have also verified separately that my sensor is working using an arduino and the library from Maxbotix.
I have tested the voltage at the I2C-A and I2C-B pins
in both cases, I have power on the VCC ( 5V) and 3.26 V on the SDA and SCL pins.
Although this does not mean that the ports are software activated.
To check if this feature was added to your release try to run again the command with the -a flag… if this is not recognized then the only solution is to move to master for the time being.
Thanks for your help Daniele, but I am quite new to this game.
What do you mean by “move to master for the time being” ?
Do you mean compiling my own version of PX4 from source ?
If Yes, can you provide a link where this is shown.
I have quite some experience with microcontrollers, so I may be able to do it.
Compiling from source is one option, although you can also flash via qgc from the firmware tab. When you have to choose the release you can choose the developer one and that is basically the binary from the master branch on GitHub. If instead you want to build your own code you can follow the toolchain installation and build tutorial from this link on the px4 dev guide: https://dev.px4.io/en/setup/getting_started.html
I have understood what flashing hte master firmware means. I used the advanced options in the firmware section, and did it.
I have now different answer from the console, but it still is not working
This is what I have
or searching for all options available
So this si still mysterious.
The good thing is that I could now find where the second GPS was hiding, which was also one of my questions
Just starting the driver with the
mb12xx start won’t work because the default i2c port is not i2c-a. With
mb12xx start -a it will scan all i2c busses on the board.
I try that also,
but it did not work
This is strange because the -a option scans all busses. Can you double check your wiring. From left to right on the pixhawk 4 pin JST-GH connector you have 5V, SCL, SDA, GND right? In the mean time I will look if I find your same sensor to test.