[SOLVED] FONA808 sending GPS data to ubidots server


I’m trying to use Fona 808 GSM + GPS module to send its GPS data to ubidots server.

Here is my code combining Fona’s GPS library and UbidotsSendmultiplevlaues but I just can’t seem to make it work.

#include <UbidotsFONA.h>
#include <SoftwareSerial.h>
#include "Adafruit_FONA.h"

#define APN  "internet.globe.com.ph" 
#define USER ""  
#define PASS ""  
#define TOKEN "A1E-IrSd1VHUgdSCq4XPklNE1ncmAKFbzE" 
#define VARIABLE_LABEL_1 "lat1"
#define VARIABLE_LABEL_2 "lon1" 

Adafruit_FONA fona = Adafruit_FONA(FONA_RST);

Ubidots client(TOKEN);

void setup() {
  Serial.println(F("Enabling GPS..."));

void loop() {
  boolean tapos = false;;

  float latitude, longitude, speed_kph, heading, speed_mph, altitude;

  // if you ask for an altitude reading, getGPS will return false if there isn't a 3D fix
  boolean gps_success = fona.getGPS(&latitude, &longitude, &speed_kph, &heading, &altitude);

  if (gps_success) {

    Serial.print("GPS lat:");
    Serial.println(latitude, 6);
    Serial.print("GPS long:");
    Serial.println(longitude, 6);
    Serial.print("GPS speed KPH:");
    Serial.print("GPS speed MPH:");
    speed_mph = speed_kph * 0.621371192;
    Serial.print("GPS heading:");
    Serial.print("GPS altitude:");

  } else {
    Serial.println("Waiting for FONA GPS 3D fix...");

  // Fona 3G doesnt have GPRSlocation :/
  if ((fona.type() == FONA3G_A) || (fona.type() == FONA3G_E))
  // Check for network, then GPRS 
  Serial.println(F("Checking for Cell network..."));
  if (fona.getNetworkStatus() == 1) {
    // network & GPRS? Great! Print out the GSM location to compare
    boolean gsmloc_success = fona.getGSMLoc(&latitude, &longitude);

    if (gsmloc_success) {
      Serial.print("GSMLoc lat:");
      Serial.println(latitude, 6);
      Serial.print("GSMLoc long:");
      Serial.println(longitude, 6);
      tapos = true;
    } else {
      Serial.println("GSM location failed...");
      Serial.println(F("Disabling GPRS"));
      Serial.println(F("Enabling GPRS"));
      if (!fona.enableGPRS(true)) {
        Serial.println(F("Failed to turn GPRS on"));  
  if(tapos == true)
  while(!client.setApn(APN, USER, PASS));
  float value1 = 14;
  float value2 = 13;
  client.add(VARIABLE_LABEL_1, value1);
  client.add(VARIABLE_LABEL_2, value2);
    Serial.println("values sent properly");



Dear @jppallarca,

Regrettably at the moment is out of my scope trying to replicate your issue because I don’t have the GPS module, but I can give you some tips in order to make it work!!!

As I can see you are trying to combine the Adafruit_FONA library with the Ubidots one which already use the Adafuit_FONA. Maybe, both library are trying to initialize the module and the issue can be related with this, it’s an option.

First, I recommend you see the following guide to ensure that the step by step it’s okay.

Then, you should try using one of the examples provided in the Adafruit_FONA library in order to test if the module is able to make request to any server(e.i: google.com ( If everything works okay, modify the successful request to the Ubidots Server, for the documentation please see here.

I hope this would help you.

All the best,
Maria C.


Yes, thank you for the help. :slight_smile: We are now trying to edit the library so it works in our favor :slight_smile:


Where you able to solve the problem? And if so how?