Nodemcu firebase database Tutorial
Table of Contents
Description:
Nodemcu firebase– In This tutorial, you will learn how to create your own firebase account and create your first project to monitor a sensor in real-time from anywhere around the world. As this is a getting started tutorial on how to use the firebase with Nodemcu esp8266 wifi module, that’s why I decided to use a variable resistor as the sensor to keep things simple. If you want to make something advanced like a student’s attendance system using RFID, GSM, and 16X2 LCD with the Google Firebase Database. Then read my article on “Arduino Firebase Database, Students Attendance System using RFID and GSM“. If you want to use the FIREBASE database with the ESP32, then consider reading my article on “ESP32 Firebase Tutorial, Send Sensor Data to Google Firebase Database“.
For the detailed step by step explanation watch video Tutorial given at the end of this article.
Amazon Links:
*Disclosure: These are affiliate links. As an Amazon Associate I earn from qualifying purchases.
Nodemcu Firebase Account Setup:
Open your internet browser and go to console.firebase.google.com,
Click on the add project.
Write the project name
check all the boxes and then click on the create project.
Click continue.
if you click on the develop you will see
Authentication
Database
Storage
Hosting
Functions and
ML kit
First, let’s start with the project settings…
click on the service accounts…
click on the database secrets…
click show and copy ….
then open the program and paste this in the firebase authentication…
now for the firebase host…click on the database…
select realtime database…
copy this link and paste it in the programming…
now our settings are completed, now we can click on the verify button to compile our program and check for any errors.
Now let’s discuss the Circuit diagram…
Nodemcu Firebase Circuit Diagram:
The circuit diagram as you can see is really easy. Connect the rightmost and leftmost legs of the variable resistor with the Nodemcu esp8266 wifi module 3.3v and GND. Connect the middle leg of the variable resistor with the A0 pin of the Nodemcu. To power up the Nodemcu ESP8266 Wifi Module you can use a 5V regulated power supply based on the LM7805 Voltage regulator. Simply connect the 5 Volts from the regulated power supply with the Vin pin of the Nodemcu Module and connect the ground of the 5V regulated power supply with the ground pin of the Nodemcu ESP8266 Wifi Module.
If you want to learn in detail, how to design the power supply PCB board for the Nodemcu ESP8266 Wifi Module then watch my tutorial given below.
Nodemcu Firebase Programming:
Arduino Jason:
https://github.com/bblanchon/ArduinoJson
FirebaseArduino library:
https://bit.ly/2XdfIuk
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
#include <ESP8266WiFi.h> #include <SoftwareSerial.h> #include <FirebaseArduino.h> #include <ArduinoJson.h> #include <ESP8266HTTPClient.h> // Set these to run example. #define FIREBASE_HOST "fahad-ba398.firebaseio.com" #define FIREBASE_AUTH "d0vy3ZgNMiwszDZsZ3iT1jg9enRLbKypvadDEPz1" #define WIFI_SSID "ZONG MBB-E8231-6E63" #define WIFI_PASSWORD "08659650" String myString; int vr = A0; // variable resistor connected int sdata = 0; // The variable resistor value will be stored in sdata. void setup() { // Debug console Serial.begin(9600); pinMode(vr ,INPUT); // connect to wifi. pinMode(D0,OUTPUT); 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); Firebase.setString("Variable/Value","fahad"); } void loop() { sdata = analogRead(vr); myString = String(sdata); Serial.println(myString); Firebase.setString("Variable/Value",myString); delay(1000); } |
Hi, may you check FirebaseArduino library link, please? It´s broken. Thank you!
hey man , i tried everything is working peacefully but the sensor data , its not getting uploaded to firebase , i checked for libraries also its working peaceful.please help me , thanks in advance
thanks very much for taking the time to put this together. I’m trying to work through but running into a brick wall. followed all steps and no errors, confirmed program running by monitoring the serial port. when I view the realtime database, I only get the Name followed by Null with the + X
Where does the word “Variable Resistor” come from? Do you need to add a child at this time?
Thanks in advance
JB
Thank you so much for the great video…….. I was able to follow your steps and get it working! I have one silly question: we only see the recent value in firebase. How can i see all the data that was sent?
How?? Could you help me?
In case of Wifi SSID and password from where do you obtain
i am not able to compile the code
its showing multiple libraries missing
Arduino: 1.8.13 (Windows 10), Board: “Generic ESP8266 Module, 80 MHz, Flash, Disabled, All SSL ciphers (most compatible), ck, 26 MHz, 40MHz, DOUT (compatible), 512K (no SPIFFS), 2, nonos-sdk 2.2.1 (legacy), v2 Lower Memory, Disabled, None, Only Sketch, 115200”
FirebaseDemo_ESP8266:1:25: fatal error: ESP8266WiFi.h: No such file or directory
#include <ESP8266WiFi.h>
compilation terminated.
exit status 1
ESP8266WiFi.h: No such file or directory
This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.