Header Ads

ESP8266 -01 connect with Firebase Database ESP-01 Module

Today i will share you how to get started with your ESP8266 or esp-01 module & google firebase. We will do a simple demo to connect and set ESP-01 connection with firebase and we will also push values in firebase database using our ESP8266-01 module. Without having
 more say let’s get started: -



First let's talk about the hardware requirement's of course we will need an ESP8266 module and we will require some Jumper wires, USB to TTL, we will use a led just to have an indication of power supply.

Hardware Requirement:
=> ESP8266-01 Module
=>Jumper Wires
=>USB to Serial
=>L.E.D
 Connection Diagram:

ESP8266-01 Firebase Connection Diagram


Talking about the connections we will connect the CHPD and 3.3 V of the module to the 3.3 V of the USB to serial module then the RX pin of one device is connected to TX pin of other and TX pin of one is connected to RX of other and most importantly GPIO 01 of the esp module is connected to ground GND this is done because we need to burn programs for that it must be in programming mode. By default our esp module comes with AT firmware which breaks down
when we burn  program in esp module to upload A.T. firmware again i will share knowledge later.

Once you are done with your circuit connections you need to setup your arduino IDE. I already have an firebase account if you need help to set up an account you can see my previous Post Without wasting much of your time let me show you the values that are pushed in the firebase . Go to Firebase Demo here you will see software setup and configuration using this we will pump arbitrary values in our firebase use 1.6.9 library that has to be installed. Once this installation is done let me show you the code.

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}
You can see it is simple program of led blink for this i must have the led connected to GPIO 01 connected to GND of USB to serial so let's just burn this code and if led blinks fine then our esp-01 is working fine. Go to the tools and be sure you are connected to the correct port and click on the upload button it may take a little time in compilation it will burn there after showing percentage of completion.


Let's talk about how are the values pushed to firebase. Since we have installed the libraries of firebase you will see Firebase Arduino in the example dropdown in this you will click on -> Firebase demo:

#include <ESP8266WiFi.h> #include <FirebaseArduino.h>
// Set these to run example.
#define FIREBASE_HOST "example.firebaseio.com"
#define FIREBASE_AUTH "token_or_secret"
#define WIFI_SSID "SSID"
#define WIFI_PASSWORD "PASSWORD"
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());
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
}
int n = 0;
void loop() {
// set value
Firebase.setFloat("number", 42.0);
// handle error
if (Firebase.failed()) {
Serial.print("setting /number failed:");
Serial.println(Firebase.error());
return;
}
delay(1000);
// update value
Firebase.setFloat("number", 43.0);
// handle error
if (Firebase.failed()) {
Serial.print("setting /number failed:");
Serial.println(Firebase.error());
return;
}
delay(1000);
// get value
Serial.print("number: ");
Serial.println(Firebase.getFloat("number"));
delay(1000);
// remove value
Firebase.remove("number");
delay(1000);
// set string value
Firebase.setString("message", "hello world");
// handle error
if (Firebase.failed()) {
Serial.print("setting /message failed:");
Serial.println(Firebase.error());
return;
}
delay(1000);
// set bool value
Firebase.setBool("truth", false);
// handle error
if (Firebase.failed()) {
Serial.print("setting /truth failed:");
Serial.println(Firebase.error());
return;
}
delay(1000);
// append a new value to /logs
String name = Firebase.pushInt("logs", n++);
// handle error
if (Firebase.failed()) {
Serial.print("pushing /logs failed:");
Serial.println(Firebase.error());
return;
}
Serial.print("pushed: /logs/");
Serial.println(name);
delay(1000);
}
and you will just to replace the firebase AUTH you will find these details in firebase itself in the project setting and firebase secrets now check the port from the Tools drop-down and click upload button, so this will burn our program. you may get a memory error which is very irritating you to resolve this I must tell you have to reset ESP using reset pin and attach it to ground or short them with another ground wire this will wash it off and you will burn the again now it will be successful. Now you can check logs in firebase database it will feature in yellow colour so that’s it for you learn if you face any issue you can get back to me and have look at the video

for details.

4 comments:

  1. Hi. I get "setting /number failed:" in serial. Can you help me?

    ReplyDelete
    Replies
    1. did you find any solution to it yet ? ITS URGENT ...I HAVE MY SUBMISSION TOMMOROW

      Delete
    2. ⚡️☑️MEET THE REAL HACKERS☑️⚡️

      It Tears me Up Whenever we receive complaints from Clients About Their Experience With the Hackers They Met Before They Heard about us.
      These Days There Are alot of Hackers Online, You Just Have to Be Careful about who you meet for help, because many people now don't know who to ask for help anymore but there's really an actual solution to that which I am giving you for free, Don't go for the incompetent ones which I know you understand what I'm saying like hackers using gmail, yahoomail and other cheaper email accounts that could be easily hacked ⚠️🚷, come to think of it, why the fuck would a REAL HACKER want to use a Mailing Service that brings out his vulnerabilities? ❌❌ ❌ so can you see they are really not who they say they're, they are just here to Rip people Off, You Can Always Identify Them With Their False Write Ups and False Testimonies Trying To Lure you Into their Arms.❌❌❌ and my advice really goes out to you looking for a Real Hacker that's a heads up so that you wouldn’t fall deep into their trap no more.🚷⚠️⚠️⚠️

      ☑️ COMPOSITE CYBER SECURITY SPECIALISTS is here to Provide you with The Best Hackers, So you can get saved from The Arms of the Fake Hackers❌❌

      ☑️We have Legit Hackers and Private investigators at your service. 💻 Every member of our team is well experienced in their various niches with Great Skills, Technical Hacking Strategies And Positive Online Reviews And Recommendations💻🛠

      ☑️We have Digital Forensic Specialists, Certified Ethical Hackers, Computer Engineers, Cyber Security Experts, Private investigators and more on our team. Some Of These Specialist Includes ⭐️ DAWID CZAGAN⭐️ JACK CABLE ⭐️ SEAN MELIA ⭐️ ARNE SWINNEN ⭐️And More.
      Some Of The Services we render includes:
      * Website hacking 💻
      * Facebook and social media hacking 📲
      * Database hacking, & Blog Cleaning🛠
      * Phone and Gadget Hacking 📲
      • CREDIT CARD MISHAPS 💳 💥
      * Clearing Of Criminal Records ❌
      * RECOVERY OF LOST FUNDS ON BINARY OPTIONS & CAPITAL INVESTMENTS💰
      * Location Tracking 📲
      and many More

      ☑️ Our Goal is to make your digital life secure, safe and hassle-free. All you Need To do is To Write us a Mail Then We’ll Assigned any of These Hackers To You Instantly.


      ☑️ CONTACT:
      ••• Email:
      composite.cybersecurity@protonmail.com

      🔘2020 © composite cybersecurity specialists
      🔘Want faster service? Contact us!
      🔘All Rights Reserved ®️

      Delete
  2. You guys have surpassed my expectations! James is seriously amazing and is doing everything to help my Fiancé and me, in1weeks my credit score went up 700 points and I can only imagine what is to come. Thank you for the excellent customer service and doing exactly what you all have set out to do! NO GIMMICKS OR BS with you guys.They carry out any kind of hacks You can reachout to them via Hackintechnology@gmail.com +16692252253

    ReplyDelete

Powered by Blogger.