I have problem sending data to firebase using gsm 800l

Please help me where I went wrong, I am a graduating student and this is the biggest project I have to carry out my thesis. I’m a first timer using the Arduino.

I want to send GPS location to Google Firebase using GSM sim800l and Arduino but it doesn’t work.

This is my code:

#define TINY_GSM_MODEM_SIM800
#define TINY_GSM_RX_BUFFER 256

#include <TinyGsmClient.h>
#include <ArduinoHttpClient.h>
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include <AltSoftSerial.h>

#define rxPin 7
#define txPin 8

SoftwareSerial sim800(txPin, rxPin);

AltSoftSerial neogps(0,1);

TinyGPSPlus gps;

const char FIREBASE_HOST[] = “xxxxxx”;
const String FIREBASE_AUTH = “xxxxx”;
const String FIREBASE_PATH = “/”;
const int SSL_PORT = 443;

char apn[] = “internet.globe.com.ph”;
char user[] = “”;
char pass[] = “”;

TinyGsm modem(sim800);

TinyGsmClientSecure gsm_client_secure_modem(modem, 0);
HttpClient http_client = HttpClient(gsm_client_secure_modem, FIREBASE_HOST, SSL_PORT);

unsigned long previousMillis = 0;

void setup()
{
Serial.begin(115200);
neogps.begin(9600);
Serial.println(F(“device serial initialize”));

sim800.begin(9600);
Serial.println(F(“SIM800L serial initialize”));

Serial.println(F(“Initializing modem…”));
modem.restart();
String modemInfo = modem.getModemInfo();
Serial.print(F("Modem: "));
Serial.println(modemInfo);

http_client.setHttpResponseTimeout(10 * 1000); //^0 secs timeout
}

void loop()
{

Serial.print(F(“Connecting to “));
Serial.print(apn);
if (!modem.gprsConnect(apn, user, pass))
{
Serial.println(F(” fail”));
delay(1000);
return;
}
Serial.println(F(" OK"));

http_client.connect(FIREBASE_HOST, SSL_PORT);

while (true) {
if (!http_client.connected())
{
Serial.println();
http_client.stop();// Shutdown
Serial.println(F(“HTTP not connected”));
break;
}
else
{
gps_loop();
}

}

}

void PostToFirebase(const char* method, const String & path , const String & data, HttpClient* http)
{
String response;
int statusCode = 0;
http->connectionKeepAlive();
String url;
if (path[0] != ‘/’)
{
url = “/”;
}
url += path + “.json”;
url += “?auth=” + FIREBASE_AUTH;
Serial.print(“POST:”);
Serial.println(url);
Serial.print(“Data:”);
Serial.println(data);

String contentType = “application/json”;
http->put(url, contentType, data);

statusCode = http->responseStatusCode();
Serial.print(F("Status code: "));
Serial.println(statusCode);
response = http->responseBody();
Serial.print(F("Response: "));
Serial.println(response);

if (!http->connected())
{
Serial.println();
http->stop();// Shutdown
Serial.println(F(“HTTP POST disconnected”));
}

}

void gps_loop()
{
String latitude = String(gps.location.lat(), 6);
String longitude = String(gps.location.lng(), 6);
delay(100);

// Serial.print("Latitude= “);
// Serial.print(latitude);
// Serial.print(” Longitude= ");
// Serial.println(longitude);

String Data = “{”;
Data += ““latitude”:” + latitude + “,”;

Data += ““longitude”:” + longitude + “”;
Data += “}”;

PostToFirebase(“PATCH”, FIREBASE_PATH, Data, &http_client);

}

This is the result:

SIM800L serial initialize
-> Initializing modem...
-> device serial initialize
-> SIM800L serial initialize
-> Initializing modem...
-> Modem: 
-> Connecting to internet.globe.com.ph OK
-> 
-> HTTP  not connected
-> Connecting to internet.globe.com.ph OK
-> 
-> HTTP  not connected
-> Connecting to internet.globe.com.ph OK
-> 
-> HTTP  not connected
-> Connecting to internet.globe.com.ph OK

can someone help me please I already solve the above problem and there has another problem I got can you help me guys… it always has zero result in longitude and latitude

this is the result look a like:

POST:/Jeepney1.json?auth=yzZb6JRN6pHMoDxdtUPHhyhrCL0R1WtP9TPBWKM3
Data:{"Latitude":0.000000,"Longitude":0.000000}
Status code: 200
Response: {"Latitude":0.Longitude":0.0}
O
POST:/Jeepney1.json?auth=yzZb6JRN6pHMoDxdtUPHhyhrCL0R1WtP9TPBWKM3
Data:{"Latitude":0.000000,"Longitude":0.000000}
Status code: 200
Response: {"Latitude":0.Lngitude":0.0}
OK

and this is my code I used:

#define TINY_GSM_MODEM_SIM800
#define TINY_GSM_RX_BUFFER 256
 
#include <TinyGsmClient.h> 
#include <ArduinoHttpClient.h>  
#include <TinyGPS++.h>
#include <SoftwareSerial.h>

static const int RXPin = 4, TXPin = 3;
TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);

#define rxPin 7
#define txPin 8
SoftwareSerial sim800(txPin, rxPin);
 
const char FIREBASE_HOST[]  = "famous-segment-319603-default-rtdb.firebaseio.com";
const String FIREBASE_AUTH  = "yzZb6JRN6pHMoDxdtUPHhyhrCL0R1WtP9TPBWKM3";
const String FIREBASE_PATH  = "Jeepney1";
const int SSL_PORT          = 443;
 
char apn[]  = "internet.globe.com.ph";
char user[] = "";
char pass[] = "";
 
 
TinyGsm modem(sim800);


TinyGsmClientSecure gsm_client_secure_modem(modem, 0);
HttpClient http_client = HttpClient(gsm_client_secure_modem, FIREBASE_HOST, SSL_PORT);
 
unsigned long previousMillis = 0;
 
 
void setup()
{
  Serial.begin(9600);
  ss.begin(96000);
  Serial.println(F("device serial initialize"));
 
  sim800.begin(9600);
  Serial.println(F("SIM800L serial initialize"));
 
  Serial.println(F("Initializing modem..."));
  modem.restart();
  String modemInfo = modem.getModemInfo();
  Serial.print(F("Modem: "));
  Serial.println(modemInfo);
 
  http_client.setHttpResponseTimeout(10 * 1000); //^0 secs timeout
}
 
void loop()
{
 
  Serial.print(F("Connecting to "));
  Serial.print(apn);
  if (!modem.gprsConnect(apn, user, pass))
  {
    Serial.println(F(" fail"));
    //delay(1000);
    return;
  }
  Serial.println(F(" OK"));
 
  http_client.connect(FIREBASE_HOST, SSL_PORT);
 
  while (true) {
    if (!http_client.connected())
    {
      Serial.println();
      http_client.stop();// Shutdown
      Serial.println(F("HTTP  not connected"));
      break;
    }
    else
    {
      gps_loop();
    }
 
  }
 
}

void PostToFirebase(const char* method, const String & path , const String & data, HttpClient* http)
{
  String response;
  int statusCode = 0;
  http->connectionKeepAlive(); 
  String url;
  if (path[0] != '/')
  {
    url = "/";
  }
  url += path + ".json";
  url += "?auth=" + FIREBASE_AUTH;
  Serial.print("POST:");
  Serial.println(url);
  Serial.print("Data:");
  Serial.println(data);
 
  String contentType = "application/json";
  http->put(url, contentType, data);
 
  statusCode = http->responseStatusCode();
  Serial.print(F("Status code: "));
  Serial.println(statusCode);
  response = http->responseBody();
  Serial.print(F("Response: "));
  Serial.println(response);
  
  if (!http->connected())
  {
    Serial.println();
    http->stop();// Shutdown
    Serial.println(F("HTTP POST disconnected"));
  }
 
}
 
void gps_loop()
{
//  
      //gps.encode(ss.read());
    
   //if (gps.location.isUpdated()) {   
    String  latitude = String(gps.location.lat(),6);
    String  longitude = String(gps.location.lng(), 6);
    
  String Data = "{";
  Data += "\"Latitude\":" + latitude + ",";
  Data += "\"Longitude\":" + longitude + ""; 
  Data += "}";
   
  PostToFirebase("PATCH", FIREBASE_PATH, Data, &http_client);
   
   // }
}