How can I add a mini sonar sensor GL041MT GL042MT to my ArduRover firmware?

If you connect the sonar sensor to Arduino using another example code, you can check the data normally.

However, I have not checked it using the USB serial converter module.

what example do you have that works?

Would you like to take a look?

GL041MT_Test.zip (499 Bytes)

1 Like

I will make a new version, it shouldn’t take long.

the problem was it needed to have the data requested by sending 0X55, there might be a different version that sends data out automatically or can be set to.

I have uploaded it again, there is a mode selector at the start,

mode 1 will request data every 100ms
mode 2 will request data every time ardupilot requests data, so it should produce data only when connected to ardupilot.

Data other than Startup cannot be confirmed in the serial monitor.

I forgot to initialise softserial.

It seems the same.

Sonar data is read every few seconds??

The RX LED on the Uno board initially blinks once and does not blink after that.

I think the software serial might be interfering with i2c when running at 115200 I have commented out i2c on this to see if thats the issue. if it is then we just need to reverse the serial ports with the sonar on the hardware port.

I think this is a painful message.

1 Like

I missed a few lines when commenting out i2c.

When operating normally

What message should be displayed on the serial monitor?

it should just operate like the example,try this, I think there was a mixup with distances and Distances.

the led should come on when it requests sonar data and go off when it gets a valid packet.

ping-ping-ping-ping
Only these characters are displayed.
And the Arduino’s RX LED blinks quickly.

this is strange, ok this is just a straight copy and paste from your example, i cant see why this wont work.

I think it’s too difficult.

can you try your example again just to verify that the sensor is still working

That last one I sent you was just your example, all my code was commented out so it should have worked.

yes i spaced it out so you could see where the parts of the code were, can you try your example again to verify that it still works.

all the other code is commented out it shouldn’t make any difference, that’s why I think there is some kind of hardware issue.

I don’t understand either.
I only added information related to I2C connection.
Why the error occurs.