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

Thank you very much.
We will conduct tests as quickly as possible,
We will share data and results.

There is no separate part of the Arduino source code that I need to modify, right?

no its a simple sensor, it doesn’t need any libraries.

Thank you very much.
We will conduct the test as soon as possible and share the results.

1 Like

I have rewritten the sonar code using an existing example, so it should have a better chance of working

3 Likes

compilation errors:
_rxPin’ was not declared in this scope
_txPin’ was not declared in this scope

1 Like

I forgot to upload the modified GL042MT.cpp and GL042MT.h download those files again.

1 Like

for a moment,
Upload the .cpp and .h files you uploaded to the library before uploading them to Arduino.
The .ino file is Arduino’s coded file, right?

have all 3 files in a folder called I2C_Ardupilot_Adapter and open I2C_Ardupilot_Adapter.ino

thank you
I will try it as soon as possible and let you know the results.

It seems to me that in the sketch you need to convert the value from millimeters to centimeters.

I’ve tried various methods, but it doesn’t work. But is it normal to not be able to check any information on the Arduino serial monitor?

It should do that on line 83, but serial monitor will show millimeter as thats what the sensor outputs.
distance = (average / 10);

1 Like

you should be getting something, I have updated it and added some code to turn the LED on if it gets valid data from the sonar.

@geofrancis and @Peter_Kim , do you have this module now?? Mine hasn’t been delivered yet. Can you check this sketch, is there any data in the port monitoring?
test sonar.zip (536 Bytes)

I dont have one to test. The version I made can simplified a lot, I made it with minimal changes to the sonar example code to limit the chance of breaking something since I didn’t have one to test it with.

The stock baud rate is, 115200 for the sonar but the docs say it can work all the way down to 2400 so don’t think it sends much data.

1 Like

I have a GL041MT sonar sensor,
I tested it with the data uploaded by geofrancis,
It was impossible to check data on the serial output monitor.
So, I am looking for various methods, such as contacting GPT.

Is there a difference between the GL041MT sonar sensor and the GL042MT sensor?
Is there only a difference in the measurable distance?

did you get any error messages at all? at the very least you should see “STARTUP”

Separately, the LED lights indicating RX/TX of Arduino do not blink. The light doesn’t come on.

can you connect your usb serial to the sonar directly to see what you get?