Sending data to computer

Hello there,

I'm a student and got my GPS sensor working. This is my code which prints they x and the y in the arduino console.

void displayInfo()
{
  Serial.print(F("Location: "));
 delay(10000); 
  if (gps.location.isValid())
  {
    Serial.print(gps.location.lat(), 6);
    Serial.print(F(","));
    Serial.print(gps.location.lng(), 6);
    delay(5000); // after testing please set the delay as 5000.
    
    x = (gps.location.lat());
    y = (gps.location.lng());
    
    Serial.println();
    Serial.print("X");
    Serial.println(x);
    Serial.print("Y");
    Serial.println(y); 
  }
  else
  {
    Serial.print(F("INVALID"));
  }
}

I want to send this to a server. I've decided to skip a GPRS module because it is simply to hard for me and I have a deadline next week. How can I send this data to a webserver? I tried ArduGate but the program is broken for me. Someone a suggestion?

I want to send the data like xxx/input.php?x=xxxx&y=xxxx
Thanks,
Marijn

Is the arduino attached to a usb port on the webserver. If so you can use php to read data from the port?

The Arduino is attached to my pc, webserver needs to collect it from my pc

Well if you want a quick and dirty solution, you could download realTerm. Have this running on your machine. realterm can echo the serial port to a tcp/ip port. Your webserver can then collect it from your machine. I'd suggest you get your arduino to use JSON format, then the webserver implementation would be a piece of cake.

Thanks for the program!

Shouldn;t the data come out of the terminal?

But if you get realTerm to “echo” the serial port to, a tcp/ip, then it just acts as a bridge between your arduino and your webserver.

BTW you don’t have to use port 23. You can pick any port you like. If you don’t have any webserver running on your machine, port 80 is probably as good as any.

But can't I send it like 'xxx/input.php?x=xxxx&y=xxxx' to a page? I've already setup a page which copies the x and y in a database.

Well it's not quite that simple. If you were to build a properly formed http request. (not just a url) then it just MIGHT work. I've never tried it.

This is becoming a dirtier solution by the minute I suggest your research starts here.:slight_smile:

It's to showcase the GPS and Maps intergration will work. Just once, but it is pretty important ..

But just making something which use the x and y variable out the Arduino code and goes to a url with those variables it something which is hard?

As far as I understand it, you have an Arduino program that can send data to a PC.
And you have a webserver running on a different PC, perhaps in a completely different location.

Then you need a PC program that can receive the Arduino data, connect to the webserver and send the data.

...R

And does a program like that exists ?

And does a program like that exists ?

It will when you get done writing it. It is not terribly difficult to read from the serial port. It is not terribly difficult to make HTTP type requests - GET, PUT, or POST.