Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP8266 not connecting to firebase! #373

Open
JaysArtworks opened this issue Aug 4, 2018 · 78 comments
Open

ESP8266 not connecting to firebase! #373

JaysArtworks opened this issue Aug 4, 2018 · 78 comments
Labels

Comments

@JaysArtworks
Copy link

I've a problem connecting the ESP8266 board to Firebase (sketch is correct), but the board connects to the wi-fi, I've already updated the Arduino Json Library and i reinstalled the Firebase library, but nothing (2 months ago I had no problems with the connection).

@ghost
Copy link

ghost commented Aug 4, 2018

Same for me, it fails to read and write. Although Firebase.begin gives success. I am using DB Secret.

@ghost
Copy link

ghost commented Aug 4, 2018

try this : #369

@JaysArtworks
Copy link
Author

JaysArtworks commented Aug 4, 2018

I'll try this solution later.

@JaysArtworks
Copy link
Author

@prj-x I've I tried to change the Firebase fingerprint, but nothing...it is working for you?
I'm a bit worried, beacuse i have to finish a project for school...

@santoshn547
Copy link

santoshn547 commented Aug 6, 2018

I have tried changing the Firebase fingerprint as well as updating the library itself but no use ?
Firebase begins connection without any error but
Unable to read data from firebase and streaming also fails,
Does Anyone know the solution ?

@prj-x
@JaysArtworks
@adamrabbani

@heriveltogabriel
Copy link

I Changing the firebase fingerprint, nothing. I'm try get new firebase library complete, but don't work.
Help-us!!

@prj-x
@JaysArtworks
@adamrabbani

@adamrabbani
Copy link

adamrabbani commented Aug 7, 2018

@heriveltogabriel @santoshn547 @JaysArtworks

try use old libary for a while..
This link --> https://github.com/RaemondBW/firebase-arduino

but this library doesn't work for stream function
just simple function like "get" and "set" is work.

download and edit to newest fingerprint.. (FirebaseHttpClient.h)
6F D0 9A 52 C0 E9 E4 CD A0 D3 02 A4 B7 A1 92 38 2D CA 2F 26

@santoshn547
Copy link

@adamrabbani

Using the old library in esp8266 it is reseting.

it shows the following exception :
Exception (28):
epc1=0x4020e636 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

and it continuously resets .
I can say that my sketch is error free, Its because of using old library .
Does anyone know the solution ?
Stuck in a project thats in due.

@adamrabbani
Copy link

@santoshn547 can i see the code ?

@santoshn547
Copy link

santoshn547 commented Aug 7, 2018

@adamrabbani
`#include <Firebase.h>
#include <FirebaseArduino.h>
#include <FirebaseCloudMessaging.h>
#include <FirebaseError.h>
#include <FirebaseHttpClient.h>
#include <FirebaseObject.h>
#include <ESP8266Ping.h>
#include <ESP8266WiFi.h>//https://github.com/esp8266/Arduino
//needed for library
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager

#define firebaseURl "****"
#define authCode "*****"

FirebaseArduino FirebaseStream;
FirebaseArduino MyFirebase;
String chipId = "123";
WiFiManager wifiManager;

int leds[4] = {D1, D2, D3, D4};
volatile int states[4] = {LOW, LOW, LOW, LOW};

#define BOUNCE_DURATION 20 // define an appropriate bounce time in ms for your switches
volatile unsigned long bounceTime=0; // variable to hold ms count to debounce a pressed switch
String path = chipId + "/status";
String devicePath ;

#define DEBOUNCE 20
byte buttons[] = {D5, D6, D7, D8};
#define NUMBUTTONS sizeof(buttons)

void setup() {
// put your setup code here, to run once:
Serial.begin(115200);

setupLeds();
setupButtons();
attachInterrupt(digitalPinToInterrupt(D5),hello,CHANGE);
attachInterrupt(digitalPinToInterrupt(D6),changeState,CHANGE);

setupLeds();
setupButtons();    
wifiManager.autoConnect("AutoConnectAP");
Serial.println("connected...yeey :)");

bool ret = Ping.ping("www.google.com");
if (ret == true){
MyFirebase.begin(firebaseURl,authCode);
FirebaseStream.begin(firebaseURl,authCode);
FirebaseStream.stream(chipId + "/status"); 
};  

}

void loop() {

detachInterrupt(D5);
detachInterrupt(D6);

if (FirebaseStream.failed()) {
FirebaseStream.stream(chipId + "/status");
Serial.println("streaming error");
Serial.println(Firebase.error());
}

if (FirebaseStream.available()) {
FirebaseObject event = FirebaseStream.readEvent();
String eventType = event.getString("type");
Serial.print("event: ");
getData();
Serial.println(eventType);
if (eventType == "put") {
Serial.print("data: ");
getData();
}
}

  byte btn = pressed();
  String devicePath;

switch (btn)
{
case 0:
Serial.println("button one pressed");
devicePath = chipId + "/status/001";
doOnOffLed(btn, devicePath);
break;
case 1:
Serial.println("button two pressed");
devicePath = chipId + "/status/002";
doOnOffLed(btn, devicePath);
break;
case 2:
Serial.println("button three pressed");
// devicePath = chipId + "/status/003";
// doOnOffLed(btn, devicePath);
break;
}

}

void getData() {

FirebaseObject object = MyFirebase.get(path);
bool led1 = object.getBool("001");
bool led2 = object.getBool("002");

digitalWrite(leds[0], led1);
digitalWrite(leds[1], led2);

Serial.println(led1);
Serial.println(led2);

int D1state = led1;
states[leds[0]] = D1state;

int D2state = led2;
states[leds[1]] = D2state;
}

void hello(){
if(millis() > bounceTime)
{
btn1Changed = true;
int state = !states[0];
states[0] = state;
Serial.println(state);
digitalWrite(D1, state);
bounceTime = millis() + BOUNCE_DURATION; // set whatever bounce time in ms is appropriate
}

}

void changeState(){
if(millis() > bounceTime)
{
btn2Changed = true;
int state = !states[0];
states[0] = state;
Serial.println(state);
digitalWrite(D2, state);
bounceTime = millis() + BOUNCE_DURATION; // set whatever bounce time in ms is appropriate
}
}`
The above Sketch was working fine before 5 days.

@kabir1995
Copy link

Hi everyone
here is the solution that is working for me.

  1. download the file from the link : https://github.com/firebase/firebase-arduino/files/2268787/firebase-arduino-master.zip
  2. extract the zip file.
  3. copy everything from the file and paste and replace into the location C:\Users\hossa\Documents\Arduino\libraries\firebase-arduino-master
  4. now download this file from the link https://github.com/firebase/firebase-arduino/files/2268800/FirebaseHttpClient.zip
  5. extract it and paste and replace the file into C:\Users\hossa\Documents\Arduino\libraries\firebase-arduino-master\src

image
image

@adamrabbani
Copy link

adamrabbani commented Aug 8, 2018

@santoshn547
sorry the old library doesn't work for stream function
but basic function like "get" and "set" is work.

@santoshn547
Copy link

santoshn547 commented Aug 8, 2018

@adamrabbani
Using the below code only returns 0 while the data in firebase is 1.
I am not getting data from firebase it is blank when converted to String.
My Url and Authcode is right.
MyFirebase.begin(firebaseURl,authCode);

FirebaseObject object = MyFirebase.get(path);
bool led1 = object.getBool("001");
bool led2 = object.getBool("002");

Is my code right for the old library ?

@kabir1995 What code are you using to begin connection as well as to get bool from firebase ?

@JaysArtworks
Copy link
Author

JaysArtworks commented Aug 8, 2018

@kabir1995 Thank you very much man! Now the code is working, I did all the steps which you said above, and i deleted the #include <ArduinoJson.h> from the code, because when i upload the code with the Json Library included, it gives me errors, anyway all is working, so thank you again!

@santoshn547
Copy link

@JaysArtworks
What code are you using for reading data from firebase ?

@JaysArtworks
Copy link
Author

JaysArtworks commented Aug 8, 2018

 n=Firebase.getString("FAN_STATUS").toInt();
 Serial.println(n);
  // handle error
  if (n==1) {
      Serial.println("Fan ON");
      digitalWrite(Fan,HIGH);
      return;
      delay(100);
  }
 else{
  Serial.println("Fan OFF");
  digitalWrite(Fan,LOW);
 }

@santoshn547 These are the lines of code which i'm using to get the value from Firebase, when the value is 1 the fan turns on and when is 0 it turns off.

@santoshn547
Copy link

santoshn547 commented Aug 8, 2018

@JaysArtworks
How do you begin connection to firebase ?
How do you give path of where your string is located in firebase ?

@adamrabbani
Copy link

@karan13421
Copy link

@kabir1995 Thank you so much friend. Your solution worked and saved my project.

@Wagnerviana
Copy link

HELLO PERSONAL I HAD A PROJECT WITH ESP8266, WHERE IT WORK PERFECTLY, BUT AFTER THAT CHANGE EVERYTHING WAS ONLY, I COULD CONNECT THE INVENTOR APP WITH THE DATABASE, BUT THE ESP8266 HE SHOWS CONNECTED THE WAFI, BUT IT DOES NOT CONNECT TO THE DATA BANK FROM FIREBASE

@Wagnerviana
Copy link

@adamrabbani I do not understand why my copila is not what is being the mistake?
here in mine
of the board error

@karan13421
Copy link

@Wagnerviana apply @kabir1995 solution written above. I am also facing similar problem and finally kar it's solution work.

@proppy
Copy link
Collaborator

proppy commented Aug 16, 2018

Can you confirm that was fixed with #368 ?

@proppy proppy added the bug label Aug 16, 2018
@Wagnerviana
Copy link

@karan13421
let me ask you ?
Are you using ESP 8266?
THE ARDUINO

@Wagnerviana
Copy link

@karan13421
THEN KNOW, THAT MY PROJECT, I HAD ALREADY HAD IT UP TO THIS FIREBASE CHANGE, BUT AGR PR APPLY, IN MY RESIDENTIAL AUTOMATION, WHERE I OPEN MY GATE WINDOW, AIR DEFINITIONED TELEVISION, I AM NOT GONNA APPLY.
TRY IT TO A HERE CODE OF @adamrabbani BUT TA DAMAGE PLATE ERROR, MY ANCIENT CODE WILL CONNECT TO THE WIFI BUT DOES NOT SEND AND NOR RECEIVE THE FIREBASE INTENDI.
SOMEONE WHO CAN HELP ME?

@Wagnerviana
Copy link

BOMM I CAN CONTAIN EVERYTHING OK,

NO DATA BANK MAKES READINGS
BUT I NEED TO TRANSPORT MY DESIGN OF IOT AND AUTOMATION RESINDENTIAL, THAT WAS FUNCTIONING, FOR THAT NEW DEMANDS THAT CREATED, In order for this to work my code within this new version

@adamrabbani
Copy link

@Wagnerviana CAN YOU SHARE THE CODE ?

@ViniciusRicciChamps
Copy link

@kabir1995
MUITO OBRIGADO
MUITO OBRIGADO MESMO
SALVOU MEU TRABALHO DE CONCLUSÃO DE CURSO
MUITO OBRIGADO
FUNCIONOU SUA DICA

@AbdelrahmanElazhary
Copy link

@prj-x
@JaysArtworks
@adamrabbani
@kabir1995

I have a problem with nodemcu and firebase ......when nodemcu start working it connects to wifi then connects to the firebase then i send int and every thing is working fine ......
but if nodemcu lost it connection to wifi and then reconnect again successfully then it can't connect to firebase again untill i use ESP.restart();

@bluecorei3
Copy link

help me, i can connect to firebase 2019

@Jagdish05
Copy link

Jagdish05 commented Mar 10, 2019

blow line in file FirebaseHttpClient.h this file found inside you library of Arduino

static const char kFirebaseFingerprint[] = "E2 34 53 7A 1E D9 7D B8 C5 02 36 0D B2 77 9E 5E 0F 32 71 17";

@bluecorei3
Copy link

bluecorei3 commented Mar 10, 2019 via email

@xxchibas
Copy link

blow line in file FirebaseHttpClient.h this file found inside you library of Arduino

static const char kFirebaseFingerprint[] = "E2 34 53 7A 1E D9 7D B8 C5 02 36 0D B2 77 9E 5E 0F 32 71 17";

how do u know these changes?

@riskiadi
Copy link

blow line in file FirebaseHttpClient.h this file found inside you library of Arduino
static const char kFirebaseFingerprint[] = "E2 34 53 7A 1E D9 7D B8 C5 02 36 0D B2 77 9E 5E 0F 32 71 17";

how do u know these changes?

C:\Users\YOURPCNAME\Documents\Arduino\libraries\firebase-arduino-master\src ==> open file FirebaseHttpClient.h
image

@kiralikbeyin
Copy link

@xxchibas

https://www.grc.com/fingerprints.htm

@eminguney
Copy link

thanks ALOT @kabir1995 THAT'S WORKS

@bluecorei3
Copy link

again, firebase update 19/04/2019 can't connect to firebase again

@MaiVanThanh197
Copy link

19/04/2019 can not conenct Firebase data base ...

@MaiVanThanh197
Copy link

"B6 F5 80 C8 B1 DA 61 C1 07 9D 80 42 D8 A9 1F AF 9F C8 96 7D"; // 2019-04

@karan13421
Copy link

Thanks, @MaiVanThanh197 Now it is working. From where did you find the new key.

@TrickSumo
Copy link
Contributor

@karan13421

Use this site and check for Test.firebaseio.com :-
https://www.grc.com/fingerprints.htm

@raghavendralg
Copy link

sir can send me how to insert a data from nodemcu to firebase.

@TrickSumo
Copy link
Contributor

TrickSumo commented Apr 28, 2019

@karan13421
Copy link

@raghavendralg, you can check out the examples that are given in ArduinoFirebase library in Arduino IDE

@jyotirmoymaschatak
Copy link

I am facing this problem from 2 weeks, Firebase is readable and writeable from my mobile app but from Node MCU it is not accessible. I did all possible work, upgraded library, applied the latest fingerprints, but nothing is working. In the demo program in examples, its showing setting number failed, Please help me as I have to submit this project.

@darnamoo
Copy link

darnamoo commented May 9, 2019

"B6 F5 80 C8 B1 DA 61 C1 07 9D 80 42 D8 A9 1F AF 9F C8 96 7D"; // 2019-04

it is working for me , thanks man @MaiVanThanh197 you saved me.

@banyucenter
Copy link

hey, alternate to firebase data is https://github.com/mobizt/Firebase-ESP8266

@BCSJH
Copy link

BCSJH commented Nov 4, 2019

I followed as you explained. But it doesn't get the Firebase value. Help me

#include <FirebaseArduino.h>
#include <ESP8266WiFi.h>

#define FIREBASE_HOST "Host"
#define FIREBASE_AUTH "Auth"
#define WIFI_SSID "gg"
#define WIFI_PASSWORD "gg"

void setup() {
Serial.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());

// put your setup code here, to run once:
Firebase.begin (FIREBASE_HOST, FIREBASE_AUTH);
}

void loop() {

delay(1000);
// put your main code here, to run repeatedly:
if (Firebase.failed()){
Serial.print("Error");

delay(1000);

}
else{
Serial.print("Here");
Serial.println(Firebase.getString("Hello"));

delay(1000);

}

}
1
2

@riskiadi
Copy link

riskiadi commented Nov 4, 2019

I followed as you explained. But it doesn't get the Firebase value. Help me

#include <FirebaseArduino.h>
#include <ESP8266WiFi.h>

#define FIREBASE_HOST "Host"
#define FIREBASE_AUTH "Auth"
#define WIFI_SSID "gg"
#define WIFI_PASSWORD "gg"

void setup() {
Serial.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());

// put your setup code here, to run once:
Firebase.begin (FIREBASE_HOST, FIREBASE_AUTH);
}

void loop() {

delay(1000);
// put your main code here, to run repeatedly:
if (Firebase.failed()){
Serial.print("Error");

delay(1000);

}
else{
Serial.print("Here");
Serial.println(Firebase.getString("Hello"));

delay(1000);

}

}
1
2

Can you screenshoot your full json?, maybe you missing your parent path.

@BCSJH
Copy link

BCSJH commented Nov 5, 2019

I followed as you explained. But it doesn't get the Firebase value. Help me
#include <FirebaseArduino.h>
#include <ESP8266WiFi.h>
#define FIREBASE_HOST "Host"
#define FIREBASE_AUTH "Auth"
#define WIFI_SSID "gg"
#define WIFI_PASSWORD "gg"
void setup() {
Serial.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());
// put your setup code here, to run once:
Firebase.begin (FIREBASE_HOST, FIREBASE_AUTH);
}
void loop() {
delay(1000);
// put your main code here, to run repeatedly:
if (Firebase.failed()){
Serial.print("Error");

delay(1000);

}
else{
Serial.print("Here");
Serial.println(Firebase.getString("Hello"));
delay(1000);
}
}
1
2

Can you screenshoot your full json?, maybe you missing your parent path.

Ah I found.
I don't know how to do it this way.
So I use
#include "FirebaseESP8266.h" //Firebase
#include <ESP8266WiFi.h> //WIFI
FirebaseData firebaseData;
FirebaseJson json;
void printResult(FirebaseData &data);

@ghost
Copy link

ghost commented Dec 13, 2019

hi, i'm trying to get and set values on the firebase using nodemcu esp8266 module, but i'm unable to do it, there's no error but firebase doesn't get updated!, ssid, password, firebasehost, database secret all are correct and when i try to upload same code on my friend's pc it starts working, please help me!

@riskiadi
Copy link

hi, i'm trying to get and set values on the firebase using nodemcu esp8266 module, but i'm unable to do it, there's no error but firebase doesn't get updated!, ssid, password, firebasehost, database secret all are correct and when i try to upload same code on my friend's pc it starts working, please help me!

"but i'm unable to do it,". do it from where ? from web or android studio

@priyatmokoangga
Copy link

I use this method and everything work good.
Screen Shot 2020-01-03 at 21 36 13

@ghost
Copy link

ghost commented May 2, 2020

I use this method and everything work good.
Screen Shot 2020-01-03 at 21 36 13

bro can you please tell me your Arduino json library version, firebase-arduino library version?

@ghost
Copy link

ghost commented May 2, 2020

hi, i'm trying to get and set values on the firebase using nodemcu esp8266 module, but i'm unable to do it, there's no error but firebase doesn't get updated!, ssid, password, firebasehost, database secret all are correct and when i try to upload same code on my friend's pc it starts working, please help me!

"but i'm unable to do it,". do it from where ? from web or android studio

i am uploading code through arduino ide, using nodemcu esp8266 module. for the reference i am following this method
https://www.instructables.com/id/Esp8266-Firebase-Connection/

@TrickSumo
Copy link
Contributor

TrickSumo commented May 2, 2020

I use this method and everything work good.
Screen Shot 2020-01-03 at 21 36 13

bro can you please tell me your Arduino json library version, firebase-arduino library version?

Hi @Saadi986

Use ArduinoJson5.x library :-

https://m.youtube.com/watch?v=6oWI_xhAtrY

https://github.com/bblanchon/ArduinoJson/tree/5.x

Checkout how to upload code to NodeMCU ESP8266 using Arduino IDE:-
https://m.youtube.com/watch?v=AaWbRhCl0XI

Thanks

@solomonitotia
Copy link

Firebase issue on esp8266

  1. Visit this site

  2. https://www.grc.com/fingerprints.htm

  3. search your newest fingerprint by typing * test.firebaseio.com *

  4. take your fingerprint

  5. look for this library and replace it here your in :

"Arduino/libraries/firebase-arduino-master/src/FirebaseHttpClient.h"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests