Forum >Has anyone try sending sim808 gps data to firebase using nodemcu??
Has anyone try sending sim808 gps data to firebase using nodemcu??

So i was integrating my sim808 with my esp8266 nodemcu and tried to send the acquired gps data coordinates and then sending it to my firebase realtime database. and after integrating it i was sending zero data to my firebase.
attach below is the code that i am using hope someone can share their thoughts and ideas.
attach below is the code that i am using hope someone can share their thoughts and ideas.
Code: Select all
#include <ESP8266WiFi.h> #include <FirebaseArduino.h> #define FIREBASE_HOST "mcuu-xxxx.firebaseio.com" #define FIREBASE_AUTH "xxxxxxxxxxxxx" #define WIFI_SSID "xxxxxxx" #define WIFI_PASSWORD "xxxxxxxxxx" #include <DFRobot_sim808.h> #include <SoftwareSerial.h> #define PIN_TX 4 #define PIN_RX 5 SoftwareSerial mySerial(PIN_TX,PIN_RX); DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR, void setup() { Serial.begin(9600); mySerial.begin(9600); // connect to wifi. WiFi.begin(WIFI_SSID, WIFI_PASSWORD); Serial.print("connecting"); while (WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(500); } Serial.println(); Serial.print("connected: "); Serial.println(WiFi.localIP()); Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); while(!sim808.init()) { delay(1000); Serial.print("Sim808 init error\r\n"); } //************* Turn on the GPS power************ if( sim808.attachGPS()) Serial.println("Open the GPS power success"); else Serial.println("Open the GPS power failure"); } int n = 0; void loop() { Serial.print("Latgps: "); Serial.println(sim808.GPSdata.lat, 8); Serial.print("Longps: "); Serial.println(sim808.GPSdata.lon, 8); // set value Firebase.setFloat("latitude",sim808.GPSdata.lat); // handle error if (Firebase.failed()) { Serial.print("firebase connection failed"); Serial.println(Firebase.error()); return; } delay(1000); // update value Firebase.setFloat("longitude", sim808.GPSdata.lon); // handle error if (Firebase.failed()) { Serial.print("firebase connection failed"); Serial.println(Firebase.error()); return; } delay(1000); // get value Serial.print("latitudefire: "); Serial.println(Firebase.getFloat("latitude")); Serial.print("longitudefire: "); Serial.println(Firebase.getFloat("longitude")); delay(1000); // set string value Firebase.setString("message", "xxxxxxxx"); // handle error if (Firebase.failed()) { Serial.print("setting /message failed:"); Serial.println(Firebase.error()); return; } delay(1000); } SERIAL MONITOR: connected: 192.168.1.6 Open the GPS power success Latgps: 0.00000000 Longps: 0.00000000 latitudefire: 0.00 longitudefire: 0.00 Latgps: 0.00000000 Longps: 0.00000000 latitudefire: 0.00 longitudefire: 0.00 Latgps: 0.00000000 Longps: 0.00000000 latitudefire: 0.00 longitudefire: 0.00