Ping Sonar Altimeter and Echosounder with Arduino Mega, battery pwr and sd storage

Hello, this hopefully makes its way to @patrickelectric since I’ve been reading his responses to many similar topics.
I am planning to purchase the Ping Sonar Altimeter and Echosounder, but want to make sure my plan is solid. My goal is to use the sonar device with an Arduino Mega powered by a 9V, 600 mAh battery pack, and save the depth/confidence data to a microSD card module onboard the Mega. I will also have an RTC module for a timestamp. This timestamp will be used to compare the depth data with GPS data to create a bathymetric map. Looking at the ping1d-simple-mega example, I think this should be fairly straightforward, after initializing the SD card/ creating the logfile and the RTC (which will have a baud 9600, so Serial1 for the Ping will be 115200) , I will just need to change all of the “serial.print” in the loop to “logfile.print”.
Are there any glaring issues with this plan? I have done this exact thing before with analog sensors, an RTC and SD module.
Also, is there a need for me to purchase a USB to TTL Serial adapter?
Thanks!

Hi @KG_ocean_chem,

What you want to do sounds feasible, it’s only a matter to do the proper hardware connections and code.
The TTL/USB adapter is not necessary since you can connect the Arduino direct on Ping;

The shield I’m using for the Mega has a slot for a microSD , the RTC module uses i2c communication (SCL/SDA pins) and a Baud rate of 9600, and the Ping will be on Serial1 w/ Baud 112500. I am thinking of using a NEO-6M GPS module for datetime and location data rather than the RTC, and that also has a default Baud rate of 9600. Lastly, I’ll use an LCD screen which uses SPI and digital pins which I don’t think interfere with any of the other components.

To clarify, I can just use the Arduino IDE interface rather than the Ping Viewer ? Or would the USB connection from the Arduino cause the device to be detected by the Ping Viewer software? Realistically I don’t need to see the data in the software, I will be printing depth to the LCD screen in real time and saving the data to the SD card for later viewing.

Hi @KG_ocean_chem, welcome to the forum :slight_smile:

I don’t expect so. Depending on the libraries you’re using for the other aspects there may be a timer clash (or other library conflicts or incompatibilities), but given you’re using a Mega that’s less likely to start with, and is likely possible to work around even if it does occur.

When you’re using an Arduino you’re running your own code, so you can make it do what you want. In the case of our ping-simple-mega.ino example that you mentioned, that code is reading values, printing them over serial, and flashing an LED - there’s no communication of ping protocol messages to or from the surface, and accordingly there’s no way for a program like Ping Viewer to connect to or do anything with the sensor (they’re unrelated use-cases).

As Patrick mentioned, a BLUART or similar adaptor is not required for connecting to and communicating with the sonar using an Arduino.

That said, we do generally recommend having one so that

  • you can use Ping Viewer
    • to see the effects on the profiles of different settings and in different environments,
    • for troubleshooting, and
    • for firmware updates,
  • you can do other programmatic control from a computer
    • e.g. I find it can be useful for more complex development to communicate directly with the sonar from a Python shell, which is more ad-hoc than is generally possible via Arduino programs

I expect it would be convenient to have one when you’re starting out, or if you run into any issues, but if you’re sticking to the basic use-case that you’ve stated then those features may be optional conveniences :slight_smile: