-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Description
Hello, I'm currently working on project tasked with developing a GPS tracking device within a tight timeframe (just three days). The goal is to build a basic GPS tracker for vehicles utilizing a NEO-6M GPS module, a SIM800L GSM module, an Arduino Nano, and assorted ancillary components. Well I know it is a bit outdated but one of the project's objectives is to make it as budget-friendly (you can call it "as cheap as possible").
Could you please guide me on the process of transmitting GPS data to a Firebase database using the SIM800L module?
as for the code this is the one I've been trying with:
#define TINY_GSM_MODEM_SIM800
#include <TinyGsmClient.h>
#include <ArduinoHttpClient.h>
#include <SoftwareSerial.h>
SoftwareSerial sim800(6, 5);
const char FIREBASE_HOST[] = "tracker-2b0fc-default-rtdb.asia-southeast1.firebasedatabase.app";
const String FIREBASE_AUTH = "Qv2aKCsQjBhbO8jNfLM3q55FVQRNFiPzoAXcNCXj";
const String FIREBASE_PATH = "/";
const int SSL_PORT = 443;
char apn[] = "internet";
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);
Serial.println("device serial initialize");
sim800.begin(9600);
Serial.println("SIM800L serial initialize");
Serial.println("Initializing modem...");
modem.restart();
http_client.setHttpResponseTimeout(10 * 1000); //^0 secs timeout
Serial.print(F("Connecting to "));
Serial.print(apn);
}
void loop()
{
if (!modem.gprsConnect(apn, user, pass))
{
Serial.print(F("Connecting to "));
Serial.print(apn);
Serial.println(" fail");
delay(1000);
return;
}
else
{
Serial.println("GPRS Connected");
delay(1000);
while(1);
}
}
Metadata
Metadata
Assignees
Labels
No labels