ESP8266IOT Projects

Nodemcu firebase database Tutorial

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:

12v Adaptor:

Arduino Uno

Arduino Nano

Mega 2560:

Potentiometer:

Nodemcu ESP8266 WiFi Module:

LM7805 Voltage Regulator:

470uf capacitor:

330-ohm resistor:

DC Female Power Jack:

Female Headers:

Male Headers:

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!


Nodemcu Firebase Account Setup:

Open your internet browser and go to console.firebase.google.com,

firebase

Click on the add project.

firebase

Write the project name

firebase

check all the boxes and then click on the create project.

firebase

Click continue.

if you click on the develop you will see

Authentication

Database

Storage

Hosting

Functions and

ML kit

firebase

First, let’s start with the project settings…

firebase

click on the service accounts…

firebase

click on the database secrets…

firebase

click show and copy ….

firebase

then open the program and paste this in the firebase authentication…

firebase

now for the firebase host…click on the database…

firebase

select realtime database…

firebase

copy this link and paste it in the programming…

firebase

firebase

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:

firebase

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

#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);            
}

Nodemcu ESP8266 Firebase, Watch Video Tutorial:

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

7 Comments

  1. 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

  2. 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

  3. 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?

  4. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button