I'm able to view my co-ords on the Serial Monitor using Serial.println(gps.location.lat(), 6);

I believe the data type returned by gps.location.lat() is double. I need to pass this value to a webservice with AT commands over GPRS.

double latitude = gps.location.lat()

Later in my code I execute AT commands to begin HTTP POST. I would like to know how to pass these double values in my paramaters.

gsm.println("AT+HTTPPARA=\"URL\",\"http://webservice/service1\""); gsm.println("AT+HTTPDATA=192,10000"); gsm.println("latitude=" + latitude); < This is not allowed.

How can I pass this parameter to my web service.


One solution may be to split the commands:


I'm not sure how you should pass multiple parameters; if it is the usual syntax you can write something like


If I have the time I'll research into this a bit.

To check what is the problem, you may try to send "static" messages, like


To check if this format is the correct one

EDIT: after a very quick research

It looks like the AT commands are a bit more complicated. In order to send the parameters, at least on a SIM800L, you should:

  • send the HTTPDATA command (the first parameter is the length of the payload)
  • wait for the board to send you the command DOWNLOAD
  • Send the body of the request, which is formatted as a JSON object. This means you have to send something like { "latitude" : 12.345, "longitude": 98.765 }

After all, it is much faster to use a library already developed for this, for instance ArduinoSIM800L (check a library available for your GPRS modem, or modify this one)

  • 1
    Seperating the values in individual print commands was the trick. Thanks! Aug 3 '18 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.