Arduino + official ethernet shield + SD -> all working together.

Gixxer:
... nicer and more updated one....

I'll start with a way of implementing the "updated" part. Someone else can make it "nicer."

I started with the Ethernet library WebClient example in arduino-0022. I added a few lines from the SD library DataLogger example to open a file and store the bytes in the SD card on the Ethernet Shield.

By building on "official" Arduino library examples rather than just making up a bunch of stuff on my own, my hope is that maybe the result will be useful as a reference that can be maintained more easily as the Arduino stuff evolves over subsequent releases.

Note, particularly, that with the Arduino libraries, the application sketch does not have to manipulate any of the chip select pins for alternating between accesses to the two different SD devices. Really.

I mean, I have seen some postings where people made flat statements that you had to clutter up your sketches with all of that stuff, but you don't have to. Really. The libraries take care of that.

I have used multiple SPI devices in other applications, but since this thread is about the Ethernet Shield, that's what the following simple example is for.

/*
        EthernetSD.pde
        
        
  A note from davekw7x:
  
  Code in this sketch combines code from two examples in arduino-0022:
  
  The Ethernet library WebClient example sketch
      created 18 Dec 2009
      by David A. Mellis
      
   No licensing or copyright information was explicitly given
   in the sketch, but it is part of the Arduino distribution,
   so this little program inherits whatever restrictions are
   in effect for Arduino.
   
  The SD library DataLogger example sketch:
      created  24 Nov 2010
      updated 2 Dec 2010
       by Tom Igoe
       
    That author graciously released the DataLogger code to public domain,
    and I do the same for whatever few lines that I have created for this example
    
  Citation would be the Polite Thing To Do, but is not really expected.
    
    
    Regards,
    
    davekw7x
*/

/*

  Web client example sketch from arduino-0022 with a few lines
  added by davekwy7x to store results of an HTML "get" command
  in a file on SD.
  
  Tested with genuine Arduino Ethernet Shield Version 5
  (the one with the microSd connector) and a genuine Arduino
  Duemilanove.
  
  My local net is served by a Linux machine with IP address 10.10.5.1,
  and it has an Apache web server configured in a completely conventional
  manner.
  
  There is a file named "test.php" in /var/www/html/daves.
  
  The contents of the file are between the dashed lines
  ------------------------------------------
<html>
<head>
    <Title>test.php</title>
<body>
    <?php
        print 'Hello, World!
';
        print 'From /var/www/html/daves';
    ?>
</body>
  ------------------------------------------

 After running this sketch you can take the SD card from
 the Ethernet Shield and read it on your PC (or whatever).
 
 Or you can run the SD library DumpFile example (after
 changing the file name in that sketch to match the
 file name in this one).
 
 davekw7x
 March, 2011
 
 */
#include <SD.h>
#include <SPI.h>
#include <Ethernet.h>

const int SD_CHIP_SELECT = 4; // For the Ethernet Shield
const int ETHERNET_CHIP_SELECT = 10;

//
// Enter a MAC address and IP address for your controller below.
//
// A "private" MAC address that will never be part
// of any commercial product, so shouldn't conflict
// with anything on your net (unless you are running
// something else like this that you have given
// this identical MAC address.)
byte mac[]    = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};

//
//IP address for my sandbox LAN with an Apache web server
// Change the following to whatever addresses are
// appropriate for your testing.
//
byte ip[]     = {10, 10, 5, 177};
byte server[] = {10, 10, 5, 1};

//
//HTML command to get a PHP file located in /var/www/html/daves on
// my webserver machine.
// Change it for whatever you want to test it with.
//
char  htmlCommand[] = "GET /daves/test.php";

//
// Initialize the Ethernet client library
// with the IP address and port of the server 
// that you want to connect to (port 80 is default for HTTP),
// and is used by my Apache server.
//
Client client(server, 80);

//
// Define the file name and file here so that it can be used
// in both setup() and loop()
char filename[] = "webfile.txt";
File dataFile;


void setup() {
    //
    // Start the serial library.
    Serial.begin(9600);

    //
    // Give things a second to settle down.
    delay(1000);

    Serial.print("Initializing SD card...");
    //
    // Make sure that the default chip select pin is set to
    // output, even if you don't use it.  (Note
    // from davekw7x: This isn't really necessary
    // here, since the library takes care of it,
    // but it doesn't hurt.)
    pinMode(ETHERNET_CHIP_SELECT, OUTPUT);
    digitalWrite(ETHERNET_CHIP_SELECT, HIGH);

    //
    // See if the card is present and can be initialized.
    if (!SD.begin(SD_CHIP_SELECT)) {
        Serial.println("Card failed, or not present");
        // 
        // exit() disables interrupts and enters
        // a do-nothing forever loop
        exit(1); // Value is irrelevant
    }
    Serial.println("card initialized.");

    //
    // Open the file.
    dataFile = SD.open(filename, FILE_WRITE);
    if (!dataFile) {
        Serial.println("Can't open ");Serial.print(filename);
        Serial.println(" for writing.");
        exit(1);
    }
    Serial.print("Opened file ");Serial.print(filename);
    Serial.println(" for writing.");

    //
    // Start the Ethernet connection.
    Ethernet.begin(mac, ip);
    Serial.println("Connecting...");

    // If it couldn't connect, bail out
    if (!client.connect()) {
        Serial.println("Connection failed.");
        exit(1);
    } 
    // OK! Now ready for action.
    Serial.println("Connected!");

    // Make the HTTP request.
    client.println(htmlCommand);
    client.println();

    // Return from setup() so that the results of
    // the request can be handled in loop()
}

void loop()
{

    // If there are incoming bytes available
    // from the server, read them and print
    // them and store then in the SD file.
    if (client.available()) {
        char c = client.read();
        Serial.print(c);
        dataFile.print(c);
        
    }

    //
    // If the server is disconnected, stop the client and close the file
    if (!client.connected()) {
        Serial.println();
        Serial.println("Disconnecting.");
        client.stop();
        Serial.print("Closing file ");Serial.println(filename);
        dataFile.close();
        Serial.println("Program is complete.");
        exit(0);
    }
    
    // Client is still connected.
    // Loop back for more bytes.
}

Note that the argument to open a file for writing is "FILE_WRITE" and is documented on the Arduino SD reference page. If the file does not exist, it creates a new file. If the file already exists, it appends new stuff to it. Other arguments are possible and are documented in the SdFat library, for which the Arduino SD library is a wrapper.

I have tested this with a couple of microSD cards that I have (1 GigaByte and 4 GigaByte). They came formatted "FAT32." I had no reason re-format them, so I left the formatting alone. I can read and write them in any of the various card readers on my Windows XP and my Linux workstations.

Bottom line recommendations:

1. Don't even think of trying my little program unless (and until) you can successfully run the SD DataLogger and SD FileDump examples. That way you can verify that the required SD functionality is present with your setup.

2. For the Ethernet stuff, I would probably start with the WebServer example before going to WebClient. That way you can make sure your Ethernet setup works before you try to get some HTML stuff from a web server. At any rate, make sure that WebClient works by itself before trying to combine its code with other stuff.

3. For other kinds of Ethernet applications and other kinds of SD applications (SD reading from a file to use with a WebServer, for example), you can try doing the same as I did: Test each one using Arduino library examples or make your own examples. After each one is working (perfectly), then (and only then) try to combine them.

Regards,

Dave

Footnote

To whom it may concern:
The subject of this thread when it started was about combining Ethernet and SD functions on an Ethernet Shield. I respectfully suggest that you verify correct operations of both Ethernet and SD stuff before trying to combine them. If you have problems with one or other of the separate functions, I respectfully suggest that you confer with other posts in this forum (or start your own thread) instead of tacking stuff to this one.

Thank you for such a detail explanation.

I have tried the example included in SD->Datalogger and i get this....

Initializing SD card...card initialized.
error opening datalog.txt

any idea why? I have a 2Gb card that came with my nokia N81 phone.
Ive tried formating it to fat32 and fat. noluck.

ok, i just read another post of yours. asking for the setup, when i tried the Sd i had a few things connected to the arduino, so maybe that has something to do. I will look into it with just my arduino uno and official ethernet shield.

My sd card was also a Nokia microSD card - 8GB - fat32 formatted.

Could you try my code integrally?
The only requirement is that the arduino be connected to a dhcp server, don't bother about the other ip's, the sd part should work anyway.

hi, yes i will try your code tomorrow that i will be near my hardware.

thanks for the reply, i hope its a matter of my setup.
I will report back how your code works.

btw, i noticed that one program i had running in my setup (nothing SD related) stopped working (the internet connection) when inserting the sd card.

You are right, inserting the sd into the slot is stopping Server ethernet...

Does anyone knows why about this fact ?

Bump

I just spent a painful 20 hours banging on an arduino ethernet shield with an SD card trying to get them to work together. This thread, ladyada's tutorial - all resulting in arduino crashing when switching between ethernet and SD - nothing worked.

Reason: I was using the Arduino IDE 1.0.1 - everything works when I went back to 1.0

Symptoms - garbage spat out into serial, setup() restarting, not being able to open the files, etc.

I want my weekend back :fearful:

Mine works fine together using IDE v1.0.1. I use this setup with dhcp for the w5100:

#include <SD.h>
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

void setup() {
  Serial.begin(9600);

  // disable w5100 while setting up SD
  pinMode(10,OUTPUT);
  digitalWrite(10,HIGH);

  Serial.print("Starting SD..");
  if(!SD.begin(4)) Serial.println("failed");
  else Serial.println("ok");

  Serial.print("Starting ethernet..");
  if(!Ethernet.begin(mac)) Serial.println("failed");
  else Serial.println("ok");
  // Ethernet.begin() returns with its SPI enabled, so disable it
  digitalWrite(10,HIGH);
}

void loop() {
}

What does the serial monitor say? ok or failed?
I can't give you your weekend back. :frowning:

edit: Added missing double quote. My bad. :blush:

Thank you my friend.I had many problems but your setup process worked first time. :slight_smile:

is this thread still alive? hope someone can help me. I try to implement this code for my gps data logger, when i use the code with analog input as in this thread i can successfully insert the data both to SD card and mysql database. but when i use my gps logger sketch its only write the data to SD card but not to myql database, here is my skecth :

#include <TinyGPS.h>
#include <SD.h>
#include <stdlib.h>
#include <SPI.h>
#include <Ethernet.h>

TinyGPS gps;
static char dtostrfbuffer[20];
int CS = 4;
int ETH = 10;
int LED = 13;

byte mac[] = { 
  0x90, 0xA2, 0xDA, 0x0D, 0xD2, 0xC2 };
IPAddress ip(192,168,0, 3);
IPAddress subnet(255,255,255,0);
IPAddress gateway(192,168,0,1);
IPAddress server(192,168,0,5);
EthernetClient client;

boolean SDavailable;
//Define String
String SD_date_time = "invalid";
String SD_lat = "invalid";
String SD_lon = "invalid";
String SD_speed = "invalid";
String SD_heading = "invalid";


static void gpsdump(TinyGPS &gps);
static bool feedgps();
static void print_float(float val, float invalid, int len, int prec, int SD_val);
static void print_int(unsigned long val, unsigned long invalid, int len);
static void print_date(TinyGPS &gps);
static void print_str(const char *str, int len);

void setup()
{
  //Serial interfaces
  Serial.begin(9600);
  Serial3.begin(4800);

  //set pinmode
  pinMode(ETH, OUTPUT);
  pinMode(CS, OUTPUT);

  //start ethernet
  digitalWrite(ETH, LOW); //ethernet on
  digitalWrite(CS, HIGH); //SD card off
  Ethernet.begin(mac, ip, gateway, subnet);


  //Connect to the SD Card
  Serial.println("Starting SD card...");
  digitalWrite(ETH, HIGH);
  digitalWrite(CS, LOW);
  if(!SD.begin(CS))
  {
    Serial.println("Card Failure");
    //return;
    SDavailable = false;
  }
  else
  {
    Serial.println("Card initialized"); 
    SDavailable = true;
  }
}


void loop()
{
  String dataString ="";

  bool newdata = false;
  unsigned long start = millis();

  // Ambil data setiap 2 detik
  while (millis() - start < 2000)
  {
    if (feedgps())
      newdata = true;
  }

  gpsdump(gps);

  //Tulis data ke sd card
  if (SDavailable !=false) {
    digitalWrite(CS, LOW);
    digitalWrite(ETH, HIGH);

    dataString = "CRM001, " + SD_date_time + "," + SD_lat + "," + SD_lon + "," + SD_speed + "," + SD_heading;
    if(SD_date_time != "invalid")
      digitalWrite(LED, HIGH);
    else
      digitalWrite(LED, LOW);

    //open file log.txt
    File dataFile = SD.open("LOG.txt", FILE_WRITE); 
    if (dataFile)
    {
      Serial.println(dataString);
      dataFile.println(dataString);
    }

    else
    {
      Serial.println("\nCouldn't open the log file!");
    } 
    dataFile.close(); 
  }
  //id++;
  // delay(5000);
  digitalWrite(ETH, LOW);
  digitalWrite(CS, HIGH);
  if(client.connect(server, 80))
  {        
    //Serial.println("connected...");
    //Serial.println("ARDUINO: forming HTTP request message");
    client.print("GET /arduino/insert.php?dataString=");
    client.print(dataString);
    client.println(" HTTP/1.1");
    client.println("Host: localhost");
    client.println("Connection: close");
    client.println();

    Serial.println("ARDUINO: HTTP message sent");
    //delay(2000);

    client.stop();
    //client.flush(); 
  }
  else
  {
    Serial.println("connection failure");
  }
}

static void gpsdump(TinyGPS &gps)
{
  float flat, flon;
  unsigned long age, date, time, chars = 0;
  unsigned short sentences = 0, failed = 0;

  print_int(gps.satellites(), TinyGPS::GPS_INVALID_SATELLITES, 5);
  print_int(gps.hdop(), TinyGPS::GPS_INVALID_HDOP, 5);
  gps.f_get_position(&flat, &flon, &age); 
  print_float(flat, TinyGPS::GPS_INVALID_F_ANGLE, 9, 5, 1); //LATITUDE
  print_float(flon, TinyGPS::GPS_INVALID_F_ANGLE, 10, 5, 2); //LONGITUDE
  print_int(age, TinyGPS::GPS_INVALID_AGE, 5);
  print_date(gps); //DATE AND TIME
  print_float(gps.f_altitude(), TinyGPS::GPS_INVALID_F_ALTITUDE, 8, 2, 0);
  print_float(gps.f_course(), TinyGPS::GPS_INVALID_F_ANGLE, 7, 2, 4);
  print_float(gps.f_speed_kmph(), TinyGPS::GPS_INVALID_F_SPEED, 6, 2, 3);
  print_str(gps.f_course() == TinyGPS::GPS_INVALID_F_ANGLE ? "*** " : TinyGPS::cardinal(gps.f_course()), 6);

}

static void print_int(unsigned long val, unsigned long invalid, int len)
{
  char sz[32];
  if (val == invalid)
    strcpy(sz, "*******");
  else
    sprintf(sz, "%ld", val);
  sz[len] = 0;
  for (int i=strlen(sz); i<len; ++i)
    sz[i] = ' ';
  if (len > 0) 
    sz[len-1] = ' ';
  //Serial.print(sz);
  feedgps();
}


static void print_float(float val, float invalid, int len, int prec, int SD_val)
{
  char sz[32];
  if (val == invalid)
  {
    strcpy(sz, "*******");
    sz[len] = 0;
    if (len > 0) 
      sz[len-1] = ' ';
    for (int i=7; i<len; ++i)
      sz[i] = ' ';
    //Serial.print(sz);
    if(SD_val == 1) SD_lat = sz;
    else if(SD_val == 2) SD_lon = sz;
    else if(SD_val== 3) SD_speed = sz;
    else if(SD_val== 4) SD_heading = sz;
  }
  else
  {
    //Serial.print(val, prec);
    if (SD_val == 1) SD_lat = dtostrf(val,10,5,dtostrfbuffer);
    else if (SD_val == 2) SD_lon = dtostrf(val,10,5,dtostrfbuffer);
    else if (SD_val == 3) SD_speed = dtostrf(val,10,2,dtostrfbuffer);
    else if (SD_val == 4) SD_heading = dtostrf(val,10,2,dtostrfbuffer);
    int vi = abs((int)val);
    int flen = prec + (val < 0.0 ? 2 : 1);
    flen += vi >= 1000 ? 4 : vi >= 100 ? 3 : vi >= 10 ? 2 : 1;
    for (int i=flen; i<len; ++i)
      Serial.print(" ");
  }
  feedgps();
}

static void print_date(TinyGPS &gps)
{
  int year;
  byte month, day, hour, minute, second, hundredths;
  unsigned long age;
  gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths, &age);
  if (age == TinyGPS::GPS_INVALID_AGE)
  {
    //Serial.print("*******    *******    ");
    SD_date_time = "invalid";
  }
  else
  {
    char sz[32];
    sprintf(sz, "%02d-%02d-%02d %02d:%02d:%02d   ",
    year, month, day, hour, minute, second);
    //Serial.print(sz);
    SD_date_time = sz;
  }
  print_int(age, TinyGPS::GPS_INVALID_AGE, 5);
  feedgps();
}

static void print_str(const char *str, int len)
{
  int slen = strlen(str);
  for (int i=0; i<len; ++i)
    //Serial.print(i<slen ? str[i] : ' ');
    feedgps();
}

static bool feedgps()
{
  while (Serial3.available())
  {
    if (gps.encode(Serial3.read()))
      return true;
  }
  return false;
}

If you are using an Uno, do not use D13 LED. That is one of the SPI data lines.

Without reading and displaying the server response, it is hard to tell what the problem is. I modified your GET request to send the correct request, then read the server response.

  if(client.connect(server, 80))
  {        
    //Serial.println("connected...");
    //Serial.println("ARDUINO: forming HTTP request message");
    client.print("GET /arduino/insert.php?dataString=");
    client.print(dataString);
    client.println(" HTTP/1.1");
    client.print("Host: ");
    client.println(server);
    client.println("Connection: close\r\n");

    // read server response    
    while(client.connected())
    {
      while(client.available())
      {
        inChar = client.read();
        Serial.write(inChar);
        // set connectLoop to zero if a packet arrives
        connectLoop = 0;
      }

      connectLoop++;

      // if more than 10000 milliseconds since the last packet
      if(connectLoop > 10000)
      {
        // then close the connection from this end.
        Serial.println();
        Serial.println(F("Timeout"));
        client.stop();
      }
      // this is a delay for the connectLoop timing
      delay(1);
    }

    Serial.println();
    Serial.println(F("disconnecting."));
    // close client end
    client.stop();
  }
  else
  {
    Serial.println("connection failure");
  }

What does the server return?

If you are using an Uno, it is possible you could be running out of SRAM.

My apologize i forgot, i use Mega 2560 and ethernet shield with built in sd card.

here is my server response

Starting SD card...
Card initialized
HTTP/1.1 200 OK
Date: Fri, 24 May 2013 12:15:01 GMT
Server: Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.8
X-Powered-By: PHP/5.2.8
Content-Length: 92
Connection: close
Content-Type: text/html

array(1) {
  ["dataString"]=>
  string(7) "CRM001,"
}
Array
(
    [dataString] => CRM001,
)

disconnecting.

and here is the data logged in my LOG.txt
CRM001, 2013-05-14 15:27:23 , -6.89235, 107.56865, 1.31, 275.34

looks like only the first column sent to my server.

below is insert.php code in my server

<?
var_dump($_GET);
//exit;
$val = @$_GET['dataString'];  
if(empty($_GET))
    echo "No GET variables";
else
    print_r($_GET); 

$con = mysql_connect("localhost", "root", "");
if(!$con)
      die('Could not connect: ' .mysql_error());
mysql_select_db("arduino", $con);

$result = mysql_query("INSERT INTO arduino(vid,date,lat,lon,speed,heading) VALUES ($val)");
mysql_close($con);
?>

Is that a space following "CRM001,"? That would be an illegal character in the GET request.

dataString = "CRM001, " + SD_date_time + "," + SD_lat + "," + SD_lon + "," + SD_speed + "," + SD_heading;

thank you for your help, yes it is a space following "CRM001,"
Now i remove the space from CRM001 and i got the following server response

HTTP/1.1 200 OK
Date: Fri, 24 May 2013 12:50:47 GMT
Server: Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.8
X-Powered-By: PHP/5.2.8
Content-Length: 113
Connection: close
Content-Type: text/html

array(1) {
  ["dataString"]=>
  string(17) "CRM001,2013-05-24"
}
Array
(
    [dataString] => CRM001,2013-05-24
)

disconnecting.
CRM001,2013-05-24 12:50:47,  -6.89233, 107.56870,      0.26,    137.12

I know it is because the date time format is use a space between day and hour. how can i send this date time format? or i have to use another format and format it later.

CRM001,2013-05-24 12:50:47, -6.89233, 107.56870, 0.26, 137.12

OK. You eliminated the first space, but what about the rest of those? Like between the date and time? And before latitude? And before longitude? And before speed? And before heading?

edit: Since you are already using the String data type, then you should be able to use the replace() function to replace all occurrences of " " with "+".

I know there's still a lot of thing to learn cause i'm just started to learn arduino and i have no programming background. another thing... english is not my native language so sometime i need more time to understand something that even its so simple or easy.

I'm thinking to use NMEA 0183 format and process the data later using database processing program such as php. I'm still googling to find the answer cause in this project i need to send the historical data to the database since the ethernet connection is not always available.

thank you

Not a problem. English is my native language, and I still have trouble with it. :slight_smile:

Did you see my edit above about replacing the spaces in your string with a plus(+)? As long as those are not tabs in the string, it should work.

edit: On the php end, use urldecode to change the "+" back to " ".
http://php.net/manual/en/function.urldecode.php

Now i already get the correct server response

HTTP/1.1 200 OK
Date: Fri, 24 May 2013 14:24:55 GMT
Server: Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.8
X-Powered-By: PHP/5.2.8
Content-Length: 193
Connection: close
Content-Type: text/html

array(1) {
  ["dataString"]=>
  string(57) "CRM001,2013-05-24 14:24:55,-6.89232,107.56871,0.63,147.05"
}
Array
(
    [dataString] => CRM001,2013-05-24 14:24:55,-6.89232,107.56871,0.63,147.05
)

disconnecting.
CRM001,2013-05-24+14:24:55,-6.89232,107.56871,0.63,147.05

since inserting a string to mysql must use quotes, i try to directly add quotes to CRM001 and date but i can't get it working. How to add a quotes to a string in the sketch or is it better to add the quotes in the php before insert to database?

thank you very much and forgive me for a lot of asking

I try to modify the php script but i still get get the data send to my database

<?
var_dump($_GET);
//exit;
$val = @$_GET['DBString'];  
extract($_GET);
$dbdata = "'".implode("','", explode(",", $DBString))."'";
echo $dbdata;
if(empty($_GET))
    echo "No GET variables";
else
   print_r($_GET); 
//Connect to database 
$con = mysql_connect("localhost", "root", "");
if(!$con)
      die('Could not connect: ' .mysql_error());
mysql_select_db("arduino", $con);

$result = mysql_query("INSERT INTO arduino(vid,date,lat,lon,speed,heading) VALUES ($dbdata)");
if(!$result) {
echo "Error".mysql_error();	
}
mysql_close($con);
?>

Here is the server response

 HTTP/1.1 200 OK
Date: Sat, 25 May 2013 12:41:16 GMT
Server: Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.8
X-Powered-By: PHP/5.2.8
Content-Length: 247
Connection: close
Content-Type: text/html

array(1) {
  ["dataString"]=>
  string(57) "CRM001,2013-05-25 12:41:16,-6.89240,107.56863,0.37,121.77"
}
''Array
(
    [dataString] => CRM001,2013-05-25 12:41:16,-6.89240,107.56863,0.37,121.77
)
ErrorColumn count doesn't match value count at row 1
disconnecting.

When i try to put the data directly in the web address i.e :http://localhost/arduino/insert.php?DBString=CRM001,2013-05-25%2012:38:31,-6.89240,107.56863,1.24,152.30 i can successfully send the DBString data to my database.