The ESP8266 can't send any data to the firebase even when it's connected to the internet, the code is correct but I don't know what happened. NOTE: this code was working but after a while, it can't send any data. NOTE: the firebase HOST and AUTH are correct. NOTE: the fingerprint is updated to the newest fingerprint.
#include <Firebase.h>
#include <Adafruit_NeoPixel.h>
#include <DHT.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>
#define DHTTYPE DHT11 // DHT 11
const byte DHTPIN = 14; // D1 Digital pin connected to the DHT sensor
LiquidCrystal_I2C lcd(0x27, 16, 2);
DHT dht(DHTPIN, DHTTYPE);
#define FIREBASE_HOST "FIREBASE_HOST"
#define FIREBASE_AUTH "FIREBASE_AUTH"
#define WIFI_SSID "SHARM"
#define WIFI_PASSWORD "***********"
float temperature = 0;
float humidity = 0;
float GasValue = 0;
void PrintTemp()
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Temp is ");
lcd.setCursor(9, 0);
lcd.print(temperature);
lcd.setCursor(0, 1);
lcd.print("Humidity is ");
lcd.setCursor(12, 1);
lcd.print(humidity - 40
);
Serial.println(humidity);
delay(100);
}
void setup()
{
lcd.init();
lcd.backlight();
lcd.begin(16, 2);
pinMode(DHTPIN, INPUT);
Serial.begin(9600);
dht.begin();
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("connecting");
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(500);
}
Serial.println("IP : ");
Serial.println(WiFi.localIP());
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
Serial.println(FIREBASE_AUTH);
}
void loop()
{
Serial.println(GasValue);
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
humidity = dht.readHumidity();
Firebase.setFloat("Humidity", humidity - 40);
// Read temperature as Celsius (the default)
temperature = dht.readTemperature();
Firebase.setInt("Temp", temperature);
PrintTemp();
GasValue = analogRead(A0);
Serial.println(GasValue);
if (GasValue > 300)
{
lcd.clear();
lcd.setCursor(5, 0);
lcd.print("Gas Leakage ");
delay(1000);
Firebase.setFloat("Gas", 1);
PrintTemp();
Serial.println("Gas Lekage");
}
else
{
delay(10);
Firebase.setFloat("Gas", 0);
lcd.clear();
PrintTemp();
}
}