Arduino Underwater Sonar/Altimeter

I went through the spec and as I had a couple hours available this morning, I threw some test code together (attached below)

That could form a first exploration path for your device from an Arduino and later made into a class/library.

Of course I don't have the device, so this is based on high level read of the spec and a couple of hours of work, so not much is implemented nor even tested (I just know this compiles :slight_smile: )

if you run this code on an ARDUINO MEGA, with your board attached on Serial1 (pins 18 and 19 - careful 5V) and join grounds, and if your device does communicate at 115200 bauds in SERIAL_8N1 mode, then may-be you should be able to see some action...

The Serial config is defined at the very top of the code by

#define KS_SERIAL_BAUD_RATE (115200)
#define KS_SERIAL_CONFIG (SERIAL_8N1) // see options @ https://www.arduino.cc/reference/en/language/functions/communication/serial/begin/
#define KS_SERIAL Serial1

Opens the Arduino Serial monitor @115200 bauds

The program will display

[color=purple]Enter Command:
1. CMD_YPR
2. CMD_QUAT
3. CMD_TEMP
4. CMD_VERSION
------------------------------
[/color]

type either 1,2,3 or 4 and enter

A command request frame (hopefully according to your spec) is built and sent over the Serial port to your device.

The program listens for any correct frame asynchronously (there is a state machine to wait for the SYNC1 and SYNC2 bytes and then read the frame of the right length till the Check Sum bytes).

When I get a well formed frame back (ie the checksum was correct), I print some information.

I did not implement any data extraction and of course only basic commands, it's not memory optimized either.

I don't have much time at the moment, but may be that could help get things started from this community.

KoggerSonic.ino (12.8 KB)