Go Down

Topic: Bathymetry Measuring Apparatus (Read 3087 times) previous topic - next topic

GeoGuy

Hey all:

I am a geoscientist trying to build a device that will measure the depth of the water and correlate the measurement with a lat/long through a GPS receiver. I want the data to then be recorded on an SD card in a CSV file format- or something I can load into an excel file. I want to then put it in a GIS program and make my own bathymetry maps.

I have a transducer, a gps chip, an Arduino Uno, a sensor shield, and an SD card shield.  I am at a loss as to how to connect these, but I am determined to figure it out.

Questions
-I am really curious as to if anyone has done something like this before and wouldn't mind giving a complete novice some advice?
-Can I correlate two serial inputs into a single file through the Arduino?
-I have three example programs, one for each device going into the Arduino (transducer, SD card reader, GPS). Do I need to upload these separately? Or should the program be one continuous line of code?

I'm definitely in over my head and I know this, but ima figure it out. Any advice from a knowledgeable person who has the time is appreciated.

pylon

Quote
I am really curious as to if anyone has done something like this before and wouldn't mind giving a complete novice some advice?


Cannot help you with that, not my area.

Quote
Can I correlate two serial inputs into a single file through the Arduino?


You can but to keep you from problems with software emulated serial interfaces I'd suggest you get an Arduino Mega 2560 which has 4 hardware serial ports.

Quote
I have three example programs, one for each device going into the Arduino (transducer, SD card reader, GPS). Do I need to upload these separately? Or should the program be one continuous line of code?


An Arduino can only run one program at a time. So if you wanna have the functionality of the three programs you have to integrate them into one sketch and upload that.

Far-seeker


I have a transducer, a gps chip, an Arduino Uno, a sensor shield, and an SD card shield.  I am at a loss as to how to connect these, but I am determined to figure it out.


Start by looking in the Playground, the examples for interefacing with hardware usually include some information on physical connections as well as code.  Also regarding the shields, you can search for your specific shields on www.shieldlist.org.  While not perfect, it is perhaps the most comprehensive listing of Arduino compatiable shields on the Internet and includes board pin-outs and links to any documentation provided by the producers of a given shield.  Even if this doesn't give you all the information you need, it should be enough so you can come back with some specific questions. ;)

radman

Quote
I am a geoscientist trying to build a device that will measure the depth of the water and correlate the measurement with a lat/long through a GPS receiver.


You should try to be more precise about what you want to do. Most ships have depth sounders and navigation equipment. Are you trying to integrate readings from these? On the other hand the subject line Bathymetry suggests a submersible vehicle, so are you trying to measure its depth, or the depth of water it is in?

As you can see these are very different problems and there are probably loads of different interpretations that can be put on what you wrote. First rule is to try to be precise about the problem and what you want to achieve.

GeoGuy

Thanks for the replies. Bathymetriy is basically like underwater topography. Yes ships have devices to study this- my boat has this, my lab has equipment that costs $100k strictly for this. I simply want to make my own with an arduino. It will be attached to my kayak.
A GPS receiver spits out a NMEA stream, as does a transducer. What I want to do essentially is log a GPS position every time a depth sounding is taken by the transducer. You can then create what amounts to a Cartesian graph representing the terrain of a lake bottom, ocean floor, etc., with X, Y, and Z coordinates provided by the lat and long from the GPS and the depth value from the transducer. You continuously take these measurements, like 2 per second, and go back and forth across the lake and you get a 3D plot that represents the bottom.

So...

I need to plug a transducer into one serial port, a GPS into the other, and have the arduino record the XYZ data coming in into a CSV file on the SD card.

The Mega was a good suggestion. I'm thinking that's gonna have to be the way. And thank you for the info about the programming.

There's a gentleman on here that actually built an autonomous boat that does this. I got the example programs from him. His programs are in three separate sketches, which is why I asked. Plus they're in Scandinavian, so even the non code is indiscernable to me lol. Thanks for the help.

wildbill

A mega will certainly do the job, but generally, NMEA emitting devices use a fairly slow baud rate and GPS is usually only one update a second, so an Uno will probably do fine using soft serial.

GeoGuy

Also-  I bought a gps unit that simply has a six strand harness coming out. I was wondering the best way to connect this to the arduino. Do I cut off the harness, trim the wires, and run them through a breadboard? Do I need to just go ahead and get a gps shield? Is there some kind of adapter?

Mine looks like this minus the circuit board under the gps chip. Just the chip and the small wiring harness coming out of it:

http://www.ladyada.net/make/gpsshield/gpstest.html

I have no problem buying a gps logging shield if that would make this project easier, but I do need to record the transducer reading at the same time the gps records a position.

dolt

This sounds really interesting did you manage to get it working?

giantsfan3

#8
Dec 08, 2012, 02:41 am Last Edit: Dec 08, 2012, 02:43 am by giantsfan3 Reason: 1
Seems like a neat project. How are you measuring the depth to the ocean floor? You mentioned a transducer, but what kind -- an off-the-shelf product? I'm guessing a sonar-based method

GeoGuy

I've been distracted by other research but now I've got some time to make some progress. I'm such a noob that this stuff is like learning a new language. I've been reading a few books on sketching to get it going.
Equipment list:
-Airmar Transducer: off the shelf, basically a piezo-electric sensor that pings and receives. Sound travels ~1560 m/s through water depending on temperature, 2 way travel time between the ping and reception of the ping will then be used to calculate depth in meters. I plan on using an adaptation of the "Ping" sketch to operate the depth sounder.
-Arduino: Controlling and computing
-EM406 GPS: Location reference
-SD Card Shield: Data logging

The hardest part is getting the GPS to log the location and the Transducer to log the depth simultaneously in one file on the SD card.

My Sparkfun package arrives this weekend with the missing prototyping components. I'll be sure to post if I get things pinging.

Any tips/suggestions are always a appreciated. I did get a Arduino Mega as suggested btw.

GeoGuy

#10
Feb 25, 2013, 11:57 pm Last Edit: Feb 26, 2013, 12:31 am by Coding Badly Reason: 1
I've basically gotta combine the following sketches:

This guy used this sketch to take accelerometer readings at GPS coordinates. I want to do the same thing, but instead take depth readings at GPS coordinates by calculating the two way travel time measured by a transducer


Code: [Select]
// ====================== START PROGRAM ==========================
/*

PROJECT: Bump-O-Meter (Geo Data Logger for Sensors )

DEVELOPER:  Hazim Bitar (techbitar at gmail dot com)

DESCRIPTION:  This program reads the ADXL335 accelerometer sensor data (X,Y,Z)  or any
sensor data then saves   this data to an SD card along with geo-location and a date/time stamp
generated by the LS20031 GPS receiver

LICENSE:      I am placing this code in the public domain

DATE:         NOV 16, 2012

*/

#include
#define LED 8           // status LED for SD operations
#define BUFF_MAX 100   // size of GPS & SD buffers

File GPSlog;

void setup()
{
  Serial.begin(4800); // The LS20031 GPS receiver must be set to 4800 for program to work

  // You can use the statements below to send configuration commands to the LS20031 GPS.
  // But for this to work, the baud rate must be set on the LS20031 GPS receiver to 4800.
  // You can use the MiniGPS 1.4 utility to configure or query the LS20031 GPS receiver.
  //
  // LS20031 COMMANDS:
  // Serial.print("$PMTK251,4800*27\r\n");  // Set GPS baud rate
  // Serial.print("$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*2C\r\n"); // Set RMC to 5 fixes/second.
  // Serial.print("$PMTK220,200*2C\r\n");  // GPS update rate at 5Hz

  pinMode(10, OUTPUT);   // Per SD library notes, pin 10 must be set to output
  pinMode(LED, OUTPUT);

  if (!SD.begin(4)) {        // SD card detected?
    digitalWrite(LED,LOW);   // turn off status LED if SD detection fails
    return;
  }
  else   digitalWrite(LED, HIGH); // turn on LED if SD detection is OK

  GPSlog = SD.open("GPS.log", O_CREAT | O_WRITE);  // open/append to a file GPS.log
  if (!GPSlog) {               // test if file can be opened
    digitalWrite(LED,LOW);     // turn off status LED if file open fails
    return;
  }
  else digitalWrite(LED, HIGH);  // turn on status LED if file open is OK
}

void loop()
{
  char inBuffer[BUFF_MAX];    // buffer used to read NMEA lines from GPS
  byte outBuffer[BUFF_MAX];   // buffer used to write NMEA lines to SD card
  int sizeBuffer = 0;        // counter of how many chars per line

// HERE WE DECLARE MORE OR LESS ANALOG SENSOR VARIABLES
  char an0[4], an1[4], an2[4];  // char variables to store analog pin values. Total 6 pins from 0-5

  while (Serial.available()>0)  // if serial data available from GPS
  {         
    sizeBuffer = Serial.readBytesUntil('\n', inBuffer, BUFF_MAX);  // read one NMEA line from GPS until end of line

//  THIS IS WHERE WE READ SENSOR VALUES
    itoa (analogRead(A0),  an0, 10);    // X read and convert numeric analog pin to char
    itoa (analogRead(A1),  an1, 10);    // Y  ..
    itoa (analogRead(A2),  an2, 10);    // Z  ..
    for (int i = 0; i < BUFF_MAX; i++) outBuffer[i] = inBuffer[i];   // create CSV file on SD
    int j = 0;

    // THIS IS WHERE WE WRITE SENSOR DATA TO THE SD FILE
    if (GPSlog) {
      GPSlog.print(an0);    // write ANALOG0 (X) to SD
      GPSlog.print(" , ");     
      GPSlog.print(an1);    // write ANALOG1 (Y) to SD     
      GPSlog.print(" , ");     
      GPSlog.print(an2);    // write ANALOG2 (Z) to SD
      GPSlog.print(" , ");     
      // If you only want NMEA output logged, comment out all above GPSlog.print statements
      GPSlog.write(outBuffer, sizeBuffer);  // write GPS NMEA output to SD
      GPSlog.print("\r\n");     
      GPSlog.flush();
      digitalWrite(LED, HIGH);  // Keep LED on so long as SD logging is working.
    }
    else {
      // if the file didn't open, turn LED off
      digitalWrite(LED, LOW);  // turn LED off if writing to file fails
    }
  }
}
// ================ END PROGRAM =====================


For the transducer, I need to use a sketch similar to the following, and work it into the sketch above.

Code: [Select]
/*  This code initializes a Ping))) sensor on pin 13 and
outputs the information over a serial connection */
#include <Ping.h>

Ping ping = Ping(13,0,0);

void setup(){
  Serial.begin(115200);
}

void loop(){
  ping.fire();
  Serial.print("Microseconds: ");
  Serial.print(ping.microseconds());
  Serial.print(" | Inches ");
  Serial.print(ping.inches());
  Serial.print(" | Centimeters: ");
  Serial.print(ping.centimeters());
  Serial.println();
  delay(1000);
}


Easy enough. Once I get my stuff this weekend I'll agonize over it some more.


Moderator edit: [code] [/code] tags added.

PaulS

Code: [Select]
  char an0[4], an1[4], an2[4];  // char variables to store analog pin values. Total 6 pins from 0-5
What does that comment have to do with the code? The arrays are too small. The values being stored in the arrays can range from 0 to 1023. With the terminating NULL, that's 5 characters.

Quote
I've basically gotta combine the following sketches:

So, basically, what's the problem?

The GPS logger logs data as fast as the GPS spits out a complete sentence. Log the ping data at the same rate.

GeoGuy

I have not had an opportunity to really tinker with it yet. I've been involved in other research (geoscientist) and haven't had time to commit other than background research. I hope to make some progress this weekend.

These are just two sketches I pulled off the web to give me a starting point. But any suggestions you have will be appreciated. You stated my plan exactly: make the ping(transducer) sample at the same rate as the GPS. And then I need that data to go into the CSV file with the GPS data. So at a point, the GPS read (X,Y), the ping simultaneously read Z, and the point was saved as (X,Y,Z) on the SD card. This is really basic stuff for any electronics hobbyist I'm sure. I'm trying to learn.

And I do not know what the code concerning the analog inputs is all about. I don't plan on using analog inputs for this project. That guy ran his accelerometer through an analog input, and his GPS through a serial. I was actually wondering if I should run the ping through a separate serial port. I have a mega if that is the case.

PaulS

Quote
I was actually wondering if I should run the ping through a separate serial port.

The GPS is a serial device. The ping sensor is not. Perhaps that will influence your decision.

GeoGuy

Yeah after reading a few sketches with similar sensors I was thinking that. But it shows my ignorance. Thanks for confirming and thanks for following up instead of leaving me here lost.

Go Up