TUTORIALS ESP32IoT

Step-by-step Tutorial: Connecting FireBeetle 2 ESP32-C5 Development Board to Home Assistant Using MQTT

DFRobot Aug 18 2025 933

The FireBeetle 2 ESP32-C5 is a compact and powerful development board powered by the ESP32-C5 chip, designed specifically for IoT applications requiring efficient and reliable wireless connectivity. Featuring a RISC-V 32-bit single-core processor running at up to 240 MHz, the ESP32-C5 integrates advanced connectivity options, including dual-band Wi-Fi 6 (2.4 GHz and 5 GHz), Bluetooth 5 (LE), and IEEE 802.15.4 (Zigbee 3.0, Thread 1.3). With 384 KB SRAM, 320 KB ROM, and 29 programmable GPIOs, it offers robust performance and flexibility, making it an excellent choice for smart home and industrial IoT projects.

Step-by-step Tutorial: Connecting FireBeetle 2 ESP32-C5 Development Board to Home Assistant Using MQTT

Here, we will guide you through the essential steps required to set up MQTT (Message Queuing Telemetry Transport) within your Home Assistant environment. MQTT is a crucial protocol often used for IoT devices and home automation. By following these steps, you’ll learn the essential steps for configuring MQTT in Home Assistant, enabling efficient communication between your ESP32-C5 and the system for seamless device control and automation.

 

What is Home Assistant?

Home Assistant is a free, open-source platform that acts as a centralized hub for home automation. It enables seamless control and automation of smart home devices from various brands, offering a unified interface without relying on cloud services or an internet connection. This focus on local control ensures enhanced privacy and reliability. With Home Assistant Cloud, users can securely access their system remotely, integrate voice assistants, and maintain full encryption. Designed for interoperability, Home Assistant serves as both a smart home hub and an integration platform, making it a versatile solution for managing diverse IoT devices from a single point.

 

Getting Started

Prerequisites

Hardware

To follow along with this guide, you’ll need the following:

Home Assistant Green: A dedicated Home Assistant hardware device for managing your smart home.

FireBeetle 2 ESP32-C5: It is a low-power IoT development board featuring high performance, multi-protocol wireless connectivity, and smart power management — making it ideal for reliable, flexible, and long-lasting smart home and IoT applications.

DHT11: Accurate temperature & humidity sensor with plug-and-play interface.

Hardware List of Connecting ESP32-C5 to Home Assistant Using MQTT Guide

 

The FireBeetle 2 ESP32-C5 is a compact and powerful development board powered by the ESP32-C5 chip, designed specifically for IoT applications requiring efficient and reliable wireless connectivity. Featuring a RISC-V 32-bit single-core processor running at up to 240 MHz, the ESP32-C5 integrates advanced connectivity options, including dual-band Wi-Fi 6 (2.4 GHz and 5 GHz), Bluetooth 5 (LE), and IEEE 802.15.4 (Zigbee 3.0, Thread 1.3). With 384 KB SRAM, 320 KB ROM, and 29 programmable GPIOs, it offers robust performance and flexibility, making it an excellent choice for smart home and industrial IoT projects.

If you want to use a Raspberry Pi to DIY your Home Assistant, you will need the following:

  • Raspberry Pi 5 or Raspberry Pi 4 with power supply (please make sure to choose a model with at least 2 GB of RAM).
  • MicroSD SD Card with Card Reader: Ensure you use a card that provides at least 32 GB of storage.
  • Ethernet cable: Required for installation. After installation, Home Assistant can work with Wi-Fi, but an Ethernet connection is more reliable and highly recommended.

 

Software

Raspberry Pi Imager: A quick and easy way to install Raspberry Pi OS and other operating systems to a microSD card, ready to use with your Raspberry Pi.

Arduino IDE: It is a versatile, beginner-friendly, open-source electronics prototyping platform. With just a bit of learning, you can quickly start developing your own projects.

 

Step 1. Install Home Assistant

Before connecting your ESP32-C5 to Home Assistant via MQTT, you'll need a running instance of Home Assistant. Here, we'll cover two popular methods to get started: a DIY approach using a Raspberry Pi for hands-on experience, and a plug-and-play option with Home Assistant Green for simplicity. For additional installation methods, such as using a virtual machine or other hardware, refer to the official guide: https://www.home-assistant.io/installation/.

 

DIY with Raspberry Pi

The Raspberry Pi is a compact, affordable single-board computer and one of the most popular choices for hosting Home Assistant. This method is ideal if you're interested in a hands-on DIY project to build skills and customize your setup.

Follow these steps to install Home Assistant Operating System (HAOS) on your Raspberry Pi using the Raspberry Pi Imager tool:

1. Download and install Raspberry Pi Imager from the official Raspberry Pi website.

2. Insert a microSD card into your computer.

3. In the Imager, select "Home Assistant" as the OS, choose your Raspberry Pi model, and write the image to the SD card.

4. Insert the SD card into your Raspberry Pi, power it on, and follow the on-screen setup.

For a detailed walkthrough, including hardware requirements and troubleshooting, check the official tutorial: https://www.home-assistant.io/installation/raspberrypi.

 

Plug-and-Play with Home Assistant Green

If you prefer a hassle-free start, the Home Assistant Green is an affordable, ready-to-use device designed specifically for Home Assistant. It comes pre-installed with the software, so you can plug it in and get running in minutes—no assembly or OS installation required.

To set it up:

1. Unbox the Home Assistant Green and connect it to power and your network (via Ethernet cable).

2. Access the web interface at homeassistant.local:8123 from a browser on the same network.

3. Complete the initial configuration wizard to create your account and set up your smart home.

For step-by-step instructions, including unboxing and network tips, see the support article: https://support.nabucasa.com/hc/en-us/articles/24737667232413-Getting-started-with-Home-Assistant-Green.

Once Home Assistant is up and running via either method, you can proceed to configure MQTT for your ESP32-C5 integration.

 

Step 2. Home Assistant MQTT Integration

Step 1. Navigate to your Home Assistant web interface.

Tip: To access advanced features, such as MQTT configuration, enable Advanced Mode:

Click on your profile and enable Advanced Mode.

Home Assistant MQTT Integration STEP 1

 

Step 2. In the sidebar, click Settings to open the settings menu, then select Add-ons to access the add-on store.

Home Assistant MQTT Integration STEP 2

 

Step 3. Use the search bar or browse through the available add-ons to find the Mosquitto broker.

Home Assistant MQTT Integration STEP 3

 

Step 4. Click the button to open Mosquitto broker homepage, then click INSTALL to add it.

Home Assistant MQTT Integration STEP 4

 

Step 5. Once installed, click START to launch it.

Home Assistant MQTT Integration STEP 5

 

Step 6. Wait for the service to start, then check the Log tab for any errors. Note that logs don’t refresh automatically—you’ll need to refresh them manually. A successful startup log should look like this:

Home Assistant MQTT Integration STEP 6


Adding a Dedicated User for MQTT

Step 1. Create a separate account specifically for MQTT access.

Step 2. Click the Settings button, then select People.

Adding a Dedicated User for MQTT step2

 

Step 3. Click ADD PERSON.

Adding a Dedicated User for MQTT step3

 

Step 4. Enter a Name, and make sure to check Allow person to login.

Note

  • The name cannot be homeassistant or add-ons, as these are reserved usernames.
  • If you can’t see the option to create a new user, ensure that Advanced Mode is enabled in your Home Assistant profile.

Adding a Dedicated User for MQTT step4

 

Step 5. In the Add User pop-up, type a password, confirm it, and click CREATE.

Adding a Dedicated User for MQTT step5

 

Adding MQTT Integration

Step 1. Navigate to Settings -> Devices & Services.

Adding MQTT Integration STEP1

 

Step 2. On the Integrations page, you should see the MQTT integration.

Adding MQTT Integration STEP2

 

Step 3. Click CONFIGURE -> SUBMIT -> FINISH. Afterward, you will see MQTT under Configured.

Note:

Please keep the ESP32C5 and Home Assistant on the same LAN

 

Step 3. Flashing the MQTT Example to ESP32-C5

Arduino Preparation

Step 1. Download and install the latest version of Arduino IDE according to your operating system

Flashing the MQTT Example to ESP32-C5 STEP1

 

Step 2. Launch the Arduino application

Step 3. Add the ESP32 board package to your Arduino IDE

Navigate to File > Preferences, and fill "Additional Boards Manager URLs" with the URL below: https://espressif.github.io/arduino-esp32/package_esp32_dev_index.json

Flashing the MQTT Example to ESP32-C5 STEP3

Flashing the MQTT Example to ESP32-C5 STEP3

 

Navigate to Tools > Board > Boards Manager..., type the keyword "esp32" in the search box, select the latest v3.3.0-alpha1 branch version of esp32, and install it.

Flashing the MQTT Example to ESP32-C5 STEP3

Step 4. Select your board and port

Board:

Navigate to Tools > Board > esp32 and select "ESP32-C5 Dev Module".

Flashing the MQTT Example to ESP32-C5 STEP4

 

Before uploading code, configure your board settings:

  • USB CDC On Boot:
  • Enabled: Print serial data via the USB interface
  • Disabled: Print serial data via TX/RX pins
  • Partition Scheme: Select a storage partition suitable for your board’s flash size
  • Port:

Navigate to Tools > Port and select the correct serial port for your board. Make sure the COM number is correct; it does not need to match the chip model.

Flashing the MQTT Example to ESP32-C5 STEP4

Flashing the MQTT Example to ESP32-C5 STEP4

 

Step 5. Navigate to Sketch > Include Library > Manage Libraries..., type the keyword "PubSubClient" in the search box, select the latest version of the PubSubClient, and install it.

Flashing the MQTT Example to ESP32-C5 STEP5

Flashing the MQTT Example to ESP32-C5 STEP5

 

Step 6. Connect the ESP32-C5 according to the diagram: connect the DHT11 to the expansion board, and connect the ESP32-C5 to your computer via a USB cable.

Flashing the MQTT Example to ESP32-C5 STEP6

 

Step 7. Upload the Esp32C5_to_WiFi_and_MQTT code to your ESP32-C5.

You can find the code here: https://github.com/Skicheng/ESP32/tree/master/esp32/ESP32-C5-Home%20assistant-MQTT

Here, you can see it connecting to Wi-Fi and then to the MQTT broker. Once it shows MQTT connected, it starts sending data.

Flashing the MQTT Example to ESP32-C5 STEP7

 

Now, let’s go back to Home Assistant. In Settings > Add-ons, open the broker and check the logs. You can see the client connecting and attempting to send data to MQTT.

Flashing the MQTT Example to ESP32-C5 STEP7

 

Setting Up Your Home Assistant Dashboard

Now we can display the sensor data on the Home Assistant dashboard.

Adding File editor

Step 1. Go to the Add-on Store and locate File editor.

Setting Up Your Home Assistant Dashboard step1

 

Step 2. Click the button to open the File editor homepage, then click INSTALL to add it.

Setting Up Your Home Assistant Dashboard step2

 

Step 3. Once installed, click START to launch it.

Setting Up Your Home Assistant Dashboard step3

 

Step 4. Click New File and name itmqtt.yaml

Setting Up Your Home Assistant Dashboard step4

Setting Up Your Home Assistant Dashboard step4

 

Step 5. In themqtt.yamlfile, add the following line:

Plain Text

yaml

sensor:

name: MQTT Demo

unique_id: "MQTT_Demo"

state_topic: esp32c5/data

Setting Up Your Home Assistant Dashboard step5

 

Step 6. Click the red icon in the top right corner to save it.

Setting Up Your Home Assistant Dashboard step6

 

Step 7. Then clickconfiguration.yaml

Setting Up Your Home Assistant Dashboard step7

 

Step 8. In theconfiguration.yamlfile, add the following line, then click the red icon in the top right corner to save it:

Plain Text

yaml

mqtt: !include mqtt.yaml

Setting Up Your Home Assistant Dashboard step8

 

Step 9. Go to Developer Tools and click CHECK CONFIGURATION.

Setting Up Your Home Assistant Dashboard step9

 

Step 10. Then click ALL YAML CONFIGURATION, and you should see a green check mark icon.

Setting Up Your Home Assistant Dashboard step10

Setting Up Your Home Assistant Dashboard step11

 

The sensor data is now successfully showing on the Home Assistant dashboard.

Setting Up Your Home Assistant Dashboard step12

 

Installation HACS

HACS (Home Assistant Community Store) is a community-driven add-on store that offers a wide range of third-party integrations and custom components for Home Assistant. In this guide, we’ll show you how to integrate HACS into Home Assistant and how to install and use the various components it provides to make your smart home system more complete and personalized.

Step 1. Navigate to Settings > Add-ons> Add-on store to find the Terminal & SSH and install it.

Installation HACS step1 Installation HACS step1

Installation HACS step1

 

If you see the screen below, it means the installation was successful.

Installation HACS step1

 

Step 2. Enter the following commands in the terminal to download the HACS installation package:

Installation HACS step2

 

Run the HACS download script.

Plain Text

Code

wget -O - https://get.hacs.xyz | bash -

 

Step 3. Restart Home Assistant

Installation HACS step3

Installation HACS step3

 

To set up the HACS integration

Step 1. In Home Assistant, go to Settings > Devices & Services.

In the bottom right corner, click + Add Integration.

Search for HACS and select it.

To set up the HACS integration step1

 

Step 2. Acknowledge the statements and select Submit.

To set up the HACS integration step2

Authenticate the integration:

  • HACS uses a device OAuth flow for authentication with GitHub.
  • Copy the device code and select the link https://github.com/login/device.
  • Sign in to GitHub.
  • If you are not signed in to GitHub in your browser, you need to sign up or sign in now to continue the setup.
  • If you are already signed in, you can skip this part.
  • Enter the device code you copied in the previous step and select Continue.

To set up the HACS integration step2

 

Step 3. Select Authorize HACS. Once you see the confirmation screen, you can close the tab and go back to Home Assistant.

To set up the HACS integration step3 

 

Congrats! You have installed the HACS integration in Home Assistant.

To set up the HACS integration step3

 

Go back to My Home, and you can easily use HACS to discover, install, and update third-party integrations and custom components, making your Home Assistant dashboard more visually appealing.

To set up the HACS integration step3