Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteAn ESP32 can connect a smart-home device to Firebase Realtime Database, where the device and other clients exchange JSON data. A straightforward integration is to send HTTPS requests to Firebase’s REST API: read a value with GET, write or update it with the appropriate method, and use server-enforced Security Rules to control who can access each path. The database connection is only one part of a working system; the board, firmware framework, peripherals, authentication, and electrical design must all be chosen for the actual project.
How the ESP32 and Firebase fit together
The ESP32 runs firmware that connects to a network and exchanges data with Firebase Realtime Database. Firebase stores data as a JSON tree and synchronizes changes to connected clients. A phone or web app could write a desired command, while the ESP32 reads it and reports what it actually did.
As an Amazon Associate I earn from qualifying purchases.
For a REST connection, a Realtime Database endpoint uses HTTPS and the database URL shown for the Firebase project, with .json appended to the target path. The URL format depends on the database location: Firebase documents a DATABASE_NAME.firebaseio.com form for us-central1 and a regional firebasedatabase.app form for other locations. Use the project’s own URL rather than copying a sample endpoint.
Free tools Windows power users keep installed
One-click scans. No signup required.
This is a project architecture, not a complete circuit design. The exact board, framework, sensors, output hardware, and authentication method depend on what the smart-home device is meant to do.
#1 Best Overall
- 2.4GHz Dual Mode WiFi + Bluetooth Development Board
- Support LWIP protocol, Freertos
- SupportThree Modes: AP, STA, and AP+STA
- Ultra-Low power consumption, Compatible with Arduino IDE
- ESP32 is a safe, reliable, and scalable to a variety of applications
Choose the board and firmware framework
Start by identifying the exact ESP32 development board and the framework used to program it. Espressif’s ESP-IDF User Guide is the official starting documentation for ESP32 development and lists development-board options. ESP-IDF is Espressif’s framework for ESP32-series systems-on-chip; that does not mean it is automatically the best fit for every project.
If using Arduino tooling instead, make sure the selected board, libraries, pin mapping, and Firebase connection approach match that environment. Do not mix instructions or code for different frameworks or board variants. The project’s peripherals determine which pins and interfaces are needed, so a generic tutorial cannot establish a correct pin assignment.
Rank #2
- Dual-Core Performance Up to 240 MHz: Run sensor processing, wireless communication, automation logic and connected-device tasks on a 32-bit dual-core ESP32 platform designed for responsive embedded and IoT projects
- Built-in Wi-Fi and Bluetooth 4.2: Connect to 2.4 GHz Wi-Fi networks or use Bluetooth Classic and BLE for wireless sensors, smart devices, remote controls, home automation and other connected projects
- Flexible Power-Saving Modes: ESP32 power-management features support dynamic clock scaling and low-power operating modes, helping developers reduce energy use in compatible sensing, monitoring and connected-device applications, suitable for battery-powered Internet of Things (IoT) devices.
- USB-C Programming with CP2102: Connect through USB-C for power, sketch uploads and serial monitoring, while GPIO, UART, SPI and I2C interfaces support sensors, displays, motor drivers and other modules (USB-C cable not included)
- Over-the-Air Update Support: Configure OTA functionality through a compatible ESP-32 software framework to update deployed firmware over Wi-Fi without reconnecting the board by USB for every revision
Plan the database paths before writing firmware
Separate the command a client wants the device to perform from the state the device reports and the sensor readings it measures. One possible JSON layout is:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
{
"homes": {
"HOME_ID": {
"devices": {
"DEVICE_ID": {
"command": {
"desired": "on"
},
"reported": {
"state": "off"
},
"sensors": {
"SENSOR_ID": {
"value": 0
}
}
}
}
}
}
}
This is an illustrative schema, not a required Firebase format. Replace the example identifiers and values with ones appropriate to the application, and define which authenticated users or devices can read and write each branch. For example, a user interface might write the desired command, while the ESP32 reads that command and writes the reported state and sensor values.
Rank #3
- Powerful ESP-32 Board: Unlock the world of Internet of Things (IoT) and advanced electronics with the heart of this kit: the ESP-32 board. It features a powerful dual-core processor, integrated Wi-Fi and Bluetooth 4.2, making it perfect for building connected, smart devices that communicate with your phone or the cloud. It's fully compatible with the Arduino IDE for easy programming.
- Super Starter Kit: This kit contains over 35 different modules and electronic components, including sensors, displays, motors, and input devices. From LEDs and buttons to an OLED screen, servo motor, and keypad, you have everything needed to explore a vast range of projects in one box.
- Step by Step Online Tutorial: Jump right in with our detailed, beginner-friendly tutorial. Access 30+ projects with complete code, clear circuit diagrams, and step-by-step instructions. Learn the fundamentals of electronics, coding, and how to utilize the ESP-32's unique capabilities without any prior experience.
- Hands-on Learning for All Skill Levels: Perfect for students, makers, engineers, and hobbyists. Start with basic circuits and coding, then progress to intermediate and advanced IoT applications. Build practical projects like weather stations, smart home controllers, remote-controlled devices, and interactive gadgets. The skills you learn are the foundation for real-world innovation.
- Quality & Great Support: Elegoo is committed to quality. We provide a clear, detailed tutorial guide, refined code, and a well-organized component kit. All modules are carefully selected for reliability and ease of use. Our dedicated technical support team and active online community are ready to help you succeed in your learning journey.
Do not treat a command in the database as proof that a device applied it. The command expresses intent; the ESP32 should report its state after it has processed the command. That distinction lets a client display the difference between a requested state and the state the device has reported.
Choose the right Firebase REST operation
REST requests use an HTTP method to express the intended change at a database path. These methods are not interchangeable:
Rank #4
- 2.4GHz Dual Mode WiFi + Bluetooth Development Board
- Support LWIP protocol, Freertos;ESP32 is a safe, reliable, and scalable to a variety of applications
- SupportThree Modes: AP, STA, and AP+STA
- Ultra-Low power consumption, Compatible with Arduino IDE
- 1PCS 30Pin ESP32 Development Board 2.4GHz WiFi Dual Cores Microcontroller Integrated with Antenna RF Low Noise Amplifiers Filters
| Method | What it does | Use it when |
|---|---|---|
GET |
Reads data at a path. | The ESP32 needs to retrieve a command or another stored value. |
PUT |
Replaces data at the target path. | You intend to replace the value or object at that path. |
PATCH |
Updates the specified children without deleting omitted children. | You need to change selected fields in an existing object. |
POST |
Adds an item under a generated key. | You want Firebase to generate a key for a new child, such as an appended record. |
DELETE |
Removes data at the target path. | You intend to remove that value or branch. |
For instance, replacing a whole device object with PUT is different from changing only its reported state with PATCH: the former replaces the data at that target path, while the latter leaves unspecified sibling children intact. Choose the target path and method deliberately to avoid overwriting data you meant to keep.
Connect over HTTPS and handle the response
- Get the project’s database URL. Use the exact URL displayed for the Realtime Database instance and account for its region-specific format.
- Choose the database path. Identify whether the firmware is reading a command, updating reported state, or writing a sensor value.
- Append
.jsonto the path and send an HTTPS request. SelectGET,PUT,PATCH,POST, orDELETEaccording to the change required. - Check the response. Firmware should handle HTTP status and errors rather than assuming a request succeeded because it was sent.
- Recover from network or authentication failures. Define a retry policy and, when using authentication tokens, handle their renewal. Avoid treating stale or unconfirmed data as the device’s current state.
REST is one way to integrate a constrained microcontroller with Firebase when an SDK is unavailable or not wanted. Firebase SDKs handle authentication and database communication automatically in supported client environments; a REST implementation must handle its own request, authentication, JSON, error, and retry behavior. Firebase REST also supports Server-Sent Events for streaming changes, but a client must implement the stream’s event handling and redirects. A simple request-and-response implementation and a persistent stream have different connection and maintenance requirements.
Best Value
- 2.4GHz Dual Mode WiFi + Bluetooth Development Board
- Ultra-Low power consumption, works perfectly with the Arduino IDE
- Support LWIP protocol, Freertos
- SupportThree Modes: AP, STA, and AP+STA
- ESP32 is a safe, reliable, and scalable to a variety of applications
Secure access with Firebase Security Rules
Firebase Realtime Database Security Rules are enforced on the server. Firebase says, “By default, they do not allow anyone access to your database.” The rules use .read and .write to grant access, and .validate can constrain incoming data, including its shape or type. A REST request without authentication succeeds only if the rules allow that access.
Scope access to the paths and identities that need it. A rule can compare an authenticated user’s UID with a user identifier in the path. Keep in mind that .read and .write grants cascade to descendants, while validation rules do not cascade in the same way. Review the resulting access at every relevant branch rather than assuming a rule on one path affects all others identically.
- Do not deploy broad root-level read or write permissions for a real project.
- Do not leave a project in test mode: Firebase’s setup guide warns that test-mode rules can let anyone read and overwrite data.
- Use an appropriate Firebase Authentication identity and ID token when a user or device should act under the project’s rules.
- Never put service-account keys or other privileged server credentials in ESP32 firmware, a mobile or web client, or a public repository. Firebase warns that exposing such credentials can compromise project security. OAuth service-account access is privileged and belongs in a protected server environment.
Choose between an SDK and direct REST
The right database client depends on framework support and what the device needs to do. Firebase’s SDKs handle authentication and database communication for supported environments. Direct REST works through HTTPS, but moves more of that responsibility into the firmware.
Recommended Free Tools
| Consideration | Firebase SDK | Direct REST |
|---|---|---|
| Environment support | Use when a suitable SDK supports the chosen client environment. | Usable from an HTTPS-capable environment; verify compatibility with the selected firmware framework. |
| Authentication and communication | The SDK handles these for supported environments. | The firmware must implement request and authentication handling, including token renewal where applicable. |
| Streaming | Check the chosen SDK’s supported behavior and requirements. | Server-Sent Events are available, but the client must handle events and redirects. |
| Maintenance | Depends on SDK availability and compatibility with the project’s framework. | Requires firmware logic for HTTP status, JSON, authentication, network failures, retries, and any streaming behavior used. |
Keep appliance control within a safe electrical design
A database tutorial does not establish that a particular ESP32 board, relay, power supply, or circuit is appropriate for an appliance. The exact sensor, relay, wiring, and load for this project are not specified here. Keep example circuits within the documented low-voltage design, or use an appropriately certified, enclosed switching device and qualified electrical guidance for mains applications. A generic relay module does not, by itself, make mains wiring safe.
ESP-IDF documents security features for the ESP32 platform, but platform capabilities are not proof that a specific firmware build, circuit, or deployment is secure, reliable, or safe. Evaluate the actual device and installation rather than inferring those properties from the microcontroller or framework alone.
Quick Recap
Troubleshoot common integration problems
- The request does not reach the intended database path: Check the project’s exact regional database URL, the path, and whether
.jsonis appended. - A read or write is denied: Inspect the applicable Security Rules and the request’s authentication. Unauthenticated access works only when the rules permit it.
- A write removes data unexpectedly: Check whether the firmware used
PUTwhere a partial update withPATCHwas intended. - The app shows a command as completed too soon: Distinguish the desired command from the state reported by the ESP32 after processing it.
- A request works once but later fails: Check network recovery, response handling, retry behavior, and token renewal where authentication requires it.
- A data stream stops or behaves unexpectedly: If using Server-Sent Events, account for event handling and redirects; a basic request-response client does not implement streaming automatically.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




