USING FIREBASE WITH ESP32

PROJECT DETAIL

 

Hello, in this project, we will communicate with esp32 and firebase and check the data from android-windows-ios devices. In our project, we will read 4 Digital Outputs, 4 Digital Inputs, 3 ADCs, and 1 dht22.

Requirements

 

  • Firebase account
  • Esp32
  • Dht22 or Dht11
  • 4 Buttons
  • 4 Led or relay
  • 3 potentiometers

 

Let's start with the Firebase account.

 

let's go to the link Here

 

Let's say add project.

 

 

Let's give a name to our project on the page that opens.

 

 

Let's continue.

 

 

Let's choose the account you want to connect your project to, let's say create project and wait for our project to be created.

 

 

Our project is ready to be used, after we say Continue, our project will appear before us.

 

 

Select Realtime Database from the left menu.

 

 

Let's create a new database by saying create database.

 

 

let's say next.

 

 

Select Start in test mode and click the enable button. Our data is ready.

 

 

Let's click on the settings icon from the top left menu and enter the users and permission section from the window that opens.

 

 

 

Let's select Service accounts from the top menu and open the database secrets section from the window that opens. In the window that opens, we have a secret key, let's copy it and save it, we will need it in the future.

 

We need some more information to use our project. Let's follow the necessary steps.

Let's go to the main page by clicking on the firebase logo from the top left. Let's choose our project that will appear in front of me.

 

 

I click on the web icon. Let's give it a name, it doesn't matter what name we give it. Let's say Register app.

 

Let's save the information on the screen in the notepad, we will use it. (Very important).

Let's confirm the other steps and say Contiune to console.

Now Finally we will do a boot to send data to esp32 from our application. Firebase/home/realtime database/Data-add(+) Name Data and write the following value ; 

"!=0,0,0,0=?"

If you can't, you can watch it as a gif.

 

 

That's all for our firebase operations. Now let's come to the arduino part.

In the Arduino part, you need to change some things according to you.

 

#define ssid  "WIFI_SSID" 
#define password  "WIFI_PASS"

You need to enter your wifi name and password here.

 

String senddatabaseURL = "https://FIREBASE-URL//Data/DIAI.json";  /*example: https://:esp32-8a904-default-rtdb.firebaseio.com//Data/DIAI.json*/
String readdatabaseURL = "https://FIREBASE-URL.firebaseio.com//Data/Esp32Send.json"; /*example https://:esp32-8a904-default-rtdb.firebaseio.com/Data/Esp32Send.json*/

 

We will write the following url instead of FIREBASSE-URL. We have received and saved this text before.

 

 

String apiKey = "API-KEY"; /*Secret key example: String apiKey = "Sq953K333GNy8Asqz5555mja6GM666Wm0i4ei1P";*/

 

We will write the key that we call the secret key here as the api key.

 

We have come to the end of the project, you can contact me if you have any questions.

Project files are HERE

 

 

WhatsApp