IoT/ESP32 B.Tech/Diploma Intermediate

ESP32/ESP8266 Firebase: Send BME280 Sensor Readings to the Realtime Database

Send BME280 sensor readings to the Firebase Realtime Database using the ESP32 or ESP8266 NodeMCU boards. The ESP board will authenticate as a user with email and password.

  • Suitable forB.Tech/Diploma IoT/ESP32 students
  • Build time1-2 weeks
  • LevelIntermediate
  • Available atAjvika Labs, Kakinada

About this project

In this guide, you’ll learn how to send BME280 sensor readings to the Firebase Realtime Database using the ESP32 or ESP8266 NodeMCU boards. The ESP board will authenticate as a user with email and password, and you’ll add database security rules to secure your data. The boards will be programmed using the Arduino core.
Updated May 8, 2026
Here’s Part 2 of this project:
ESP32/ESP8266: Firebase Web App to Display Sensor Readings (with Authentication)
Other Firebase Tutorials with the ESP32/ESP8266 that you might be interested in:
ESP32: Getting Started with Firebase (Realtime Database)
ESP8266 NodeMCU: Getting Started with Firebase (Realtime Database)
ESP32 with Firebase – Creating a Web App
ESP8266 NodeMCU with Firebase – Creating a Web App
ESP32/ESP8266 Firebase Authentication (Email and Password)
What is Firebase?
Firebase is Google’s mobile application development platform that helps you build, improve, and grow your app. It has many services used to manage data from any android, IOS, or web application like
authentication
realtime database
hosting
, etc.
Project Overview
The following diagram shows a high-level overview of the project we’ll build.
The ESP32/ESP8266 authenticates as a user with email and password (that user must be set on the Firebase authentication methods);
After authentication, the ESP gets the user UID;
The database is protected with security rules. The user can only access the database nodes under the node with its user UID. After getting the user UID, the ESP can publish data to the database;
The ESP sends temperature, humidity and pressure to the database.
These are the main steps to complete this project:
Create Firebase Project
Set Authentication Methods
Get Project API Key
Set up Realtime Database
Set up Database Security Rules
ESP32/ESP8266 Send Sensor Readings to the Realtime Database
You can continue with the Firebase project
from this previous
tutorial
or create a new project. If you use the Firebase project of that previous tutorial, you can skip to section
4) Set up Realtime Database
because the authentication methods are already set up.
Preparing Arduino IDE
For this tutorial, we’ll program the ESP32 and ESP8266 boards using the Arduino core. So, make sure you have the ESP32 or ESP8266 add-on installed in your Arduino IDE:
Installing ESP32 Board in Arduino IDE 2 (Windows, Mac OS X, Linux)
Installing ESP8266 NodeMCU Board in Arduino IDE 2 (Windows, Mac OS X, Linux)
If you want to program the ESP boards using VS Code with the PlatformIO extension, follow the following tutorial instead:
Getting Started with VS Code and PlatformIO IDE for ESP32 and ESP8266

Create Firebase Project
Follow the next instructions to create a new project on Firebase.
Go to
Firebase
and sign in using a Google Account.
Go to the
Firebase Console
and create a new project.
Give a name to your project, for example:
ESP-Project,
and click
Continue
Next, enable or disable AI assistance for your project. This is optional.
Disable the option
Enable Google Analytics
for this project, as it is not needed. Then, click
Create project
It will take a few seconds to set up your project. Click
Continue
when it’s ready.
You’ll be redirected to your Project console page.
2) Set Authentication Methods
To allow authentication with email and password, first, you need to set authentication methods for your app.
“Most apps need to know the identity of a user. In other words, it takes care of logging in and identifying the users (in this case, the ESP32 or ESP8266). Knowing a user’s identity allows an app to securely save user data in the cloud and provide the same personalized experience across all of the user’s devices.” To learn more about the authentication methods, you can
read the documentation
You need to set authentication methods for your app.
“Most apps need to know the identity of a user. In other words, it takes care of logging in and identifying the users (in this case, the ESP32). Knowing a user’s identity allows an app to securely save user data in the cloud …” To learn more about the authentication methods, you can
read the documentation
On the left sidebar, click on
Build
>
Authentication
and then on
Get started
There are several authentication methods like email and password, Google Account, Facebook account, and others.
Select
Email/Password
and
enable
that authentication method. Then, click
Save
Then, at the top, click on the
Users
tab. Then, click on
Add user
Create a new user with an email and password. The email can be your personal email. Create a password for that user (you need to remember the password later). Finally, click on
Add user
The User will show up on the list of users. You can see information about the user, like when it was created, the last time it signed in, and its user UID.
3) Creating a Web App for Your Project (and API key)
To interface with your Firebase project using the ESP8266 and ESP32, you need to get your project API key. To get an API key for your project, you need to create a web app first. Follow the next steps.
On the left sidebar, click on
Settings
Scroll down on that page to the
Your apps
section. Then, click on the web icon
</>
to create and add a web app to your Firebase project.
Give your app a name. Then, check the box next to
√ Also set up Firebase Hosting for this App
. Click
Register app
Then, in the
firebaseConfig
object, you can find your API key. Save it because you’ll need it later.
After this, you can also access the
firebaseConfig
object if you go to your Project settings in your Firebase console and scroll down to the
Your apps
section.
Click Next on the preceding steps, and finally on
Continue to console
4) Set up Realtime Database
Now, let’s create a realtime database and set up database rules for our project.

On the left sidebar, click on
Realtime Database
and then click on
Create Database

Select your database location. It should be the closest to your location.

Set up security rules for your database. You can select
Start in test mode
. We’ll change the database rules in just a moment.

Your database is now created. You need to copy and save the database URL—highlighted in the following image—because you’ll need it later in your ESP32/ESP8266 code.
5) Set up Database Security Rules
Now, let’s set up the database rules. On the
Realtime Database
tab, select the
Rules
tab at the top. Then, click on
Edit rules
, copy the following rules and then click
Publish
// These rules grant access to a node matching the authenticated
// user's ID from the Firebase auth token
{
"rules": {
"UsersData": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
}
}
}
These rules allow access only to the node that matches the authenticated user’s UID. This ensures that each user can access only their own data. In other words, a user can only read or write to the parts of the database located under their specific UID. Any data stored outside of their UID node will not be accessible to them.
For example, imagine our user UID is
RjO3taAzMMXBB2Xmir2LQ
. With our security rules, it can read and write data to the database under the node
UsersData/RjO3taAzMMXBB2Xmir2LQ
You’ll better understand how this works when you start working with the ESP32/ESP8266.

ESP32/ESP8266 Send Sensor Readings to the Realtime Database
In this section, we’ll program the ESP32 or ESP8266 boards to do the following tasks:
Authenticate as a user with email and password (
the user you set up in this section
);
Send sensor readings to the Firebase Realtime Database as an authorized user to the node corresponding to its user UID.
Parts Required
For this project, you need the following parts*:
ESP32
or
ESP8266
board (read
ESP32 vs ESP8266
);
BME280
or any other sensor you’re familiar with;
Breadboard
;
Jumper wires
* you can also test the project with random values

Technologies used

ESP32ESP8266ArduinoFirebaseBLEBME280AndroidArduino IDE

Hardware components

  • ESP32
  • ESP8266
  • Arduino
  • BME280

Software & tools

  • Arduino IDE
  • VS Code
  • PlatformIO
  • Firebase
  • PlatformIO

What you get

  • Working project / hardware kit, tested before delivery
  • Complete source code with explanation
  • Project demo and guidance for your viva
  • Project report, PPT and IEEE paper support (on request)
Delivery & Payment
Delivery takes a minimum of two weeks from the date your inquiry is confirmed. Payment is in two parts: • 50% advance to start the project • Remaining 50% before delivery Note: • Documentation and PPT are not included by default • If you need documentation/PPT, it can be arranged for extra time and cost We'll confirm the exact timeline and cost with you after reviewing your requirements.