I’ve been building out various sensor arrays for use with Home Assistant in my home using ESP32 modules and ESPHome and it has been working really well. One challenge though is that you have a limited number of connections (even when using expansion boards). This can be dealt with a few different ways but buying a whole bunch of individual sensor boards one at a time and connecting them can get messy to say the least.
Fortunately Seeed Studios has a unit powered by Sensirion that has 7 environmental sensors all in one: the SEN54! This includes measurements for particles of PM1.0/2.5/4/10, temperature and humidity and VOC (volatile organic compounds). All in one unit with a single connection.
In this guide I’ll show what adding a sensor like this to Home Assistant looks like using ESPHome and a ESP32-C3 module. Let’s get started!
The Seeed Studios XAIO-ESP32-C3 is a microcontroller board that uses the RISC-V architecture. It has Bluetooth and WiFi capabilities and includes an external antenna.
This solution has a few different components to them. Let’s go over them now briefly. First we have the SEN54 unit itself:
I included the micro SD card to give a better sense of scale. All of the sensors are housed inside this unit. You can see a inlet and outlet for airflow as there is an active fan in the unit to help circulate the air for the most accurate readings.
Next I’m using the XAIO ESP32-C3 module. This is a tiny module that has built in WiFi/Bluetooth and will communicate the sensor data to our home assistant instance. That looks like this:
The XAIO module can be purchased pre-soldered but it’s pretty easy to solder to the pins. It’s the board on the far right of the above picture.
The two boards on the left hand side are two different expansion board options. Both of them will work perfectly for a project like this. It’s particularly easy to attach a battery to the lower expansion board
My complete hardware setup for this guide looks like this:
Here you can see my backup battery attached. My WiFi and most of my network continues to function for a few hours during a power outage due to having battery backups (and using PoE for the access points). The sensor unit will continue to function during a power outage with this battery attached.
The XAIO expansion board has the battery charging circuit that handles this all for us. All we have to do is connected it all together and it’s good to go!
The unit is actually portable with the battery as well. If you wanted to take measurements in a specific area that would absolutely work. It would wirelessly transmit the measurements to Home Assistant and display them as you move around with the device.
Adding ESPHome to Home Assistant
We are going to assume you have Home Assistant installed as installing Home Assistant is outside the scope of this guide. You can absolutely follow along though and see if it looks like something you’d like to explore. I have it installed as a supervised installation on an Orange Pi 5.
Sign into your Home Assistant instance and go to “Settings” and then “Add-ons”. Next click the “Add-on Store”.
ESPHome has it’s own section like this:
Select ESPHome and then click “Install”. Once the installation is finished you can click “Start” to start the service.
To make things easier choose to add the ESPHome option to your sidebar. That way you’ll see a menu choice specifically for ESPHome going forward.
First head to the ESPHome menu option:
If you don’t see the ESPHome menu option then go back to the “Add-on Store” from the previous step. Select ESPHome and enable “Show in sidebar”.
For setup we need to connect your XAIO-ESP32-C3 to your device running Home Assistant with USB. This is only required for setup. It will communicate wirelessly after you’ve completed setup (if you configure it that way).
You also have the option of connecting it to a different computer but *only* if your Home Assistant instance is configured to run in HTTPS. For this guide I didn’t have HTTPS enabled and chose to connect it directly to the Tinker Board running Home Assistant for this step.
Click to add a new device. The first step will ask you for a configuration name and your wireless network SSID and password. Enter that and it will take you to the step to select your device type:
Select ESP32-C3 if you are using the same device as me. It’s fine if you are using another type and are using this guide to follow along.
It will ask you how you want to connect the device to the computer for the first time and give you an encryption key. I recommend using the “Connect to the server running Home Assistant with USB” option. It will then have you select your device. Mine showed up as a USB serial debug device on /dev/ttyACM0.
Once you select next it will give you the option to start the configuration or to skip. Choose skip. We are going to edit the configuration manually first.
Editing YAML Configuration
Click “Edit” on the new sensor/device you created. We are going to change the esphome and esp32 sections to this:
esphome: name: sensors-office platformio_options: board_build.flash_mode: dio esp32: board: seeed_xiao_esp32c3 variant: esp32c3 framework: type: arduino version: 2.0.5 platform_version: 5.3.0 logger: baud_rate: 0
Note that YAML is very sensitive to spacing. The editor will underline errors in red for you which definitely helps to spot them as long as you’re watching for them.
While we are in here you should save your encryption key to your clipboard or keep it handy for reference. We are going to need it in the step to add the device to Home Assistant later.
Install Configuration to Device
Finally you can begin programming the device. Click to “Install”. Select the device type and your USB device again and with any luck:
Above you can see it connected to my WiFi point and that everything ran successfully. That is without ever programming the ESP32. ESPHome did all of the programming for us!
Adding Device to Home Assistant
Now head back to your “Settings” menu for Home Assistant and click “Devices”. You should see your new sensor with the name you specified in the configuration.
Check to see if the sensor is online. With any luck it is like my example above. Now click “Configure”:
It should ask you if you want to add the node to Home Assistant. Select “Submit” and then it will ask you for your encryption key it gave us earlier. If you don’t have this just go back to the ESPHome menu and select “Edit”. You will see the key in plain text under “encryption” and then “key”.
If everything goes well the device should come online and be successfully paired with Home Assistant. From this point forward we will be able to update and push the configuration wirelessly to the device.
You won’t be able to see any sensors yet though. We are going to add those next.
Adding Sensors to YAML Configuration
To my surprise when I googled what the YAML configuration for this device would be I found an official Home Assistant resource here that has all of the YAML for us.
If we integrate that into the changes we made earlier the final configuration looks like this:
esphome: name: sensors-office platformio_options: board_build.flash_mode: dio friendly_name: sensors-office esp32: board: seeed_xiao_esp32c3 variant: esp32c3 framework: type: arduino version: 2.0.5 platform_version: 5.3.0 # Enable logging logger: baud_rate: 0 # Enable Home Assistant API api: encryption: key: "XXX" ota: password: "XXX" wifi: ssid: !secret wifi_ssid password: !secret wifi_password power_save_mode: none i2c: sda: 6 scl: 7 sensor: - platform: sen5x id: sen54 pm_1_0: name: " PM <1µm Weight concentration" id: pm_1_0 accuracy_decimals: 1 pm_2_5: name: " PM <2.5µm Weight concentration" id: pm_2_5 accuracy_decimals: 1 pm_4_0: name: " PM <4µm Weight concentration" id: pm_4_0 accuracy_decimals: 1 pm_10_0: name: " PM <10µm Weight concentration" id: pm_10_0 accuracy_decimals: 1 temperature: name: "Temperature" accuracy_decimals: 1 humidity: name: "Humidity" accuracy_decimals: 0 voc: name: "VOC" algorithm_tuning: index_offset: 100 learning_time_offset_hours: 12 learning_time_gain_hours: 12 gating_max_duration_minutes: 180 std_initial: 50 gain_factor: 230 temperature_compensation: offset: 0 normalized_offset_slope: 0 time_constant: 0 acceleration_mode: low store_baseline: true address: 0x69 update_interval: 10s
You can see we actually have some configurable options here such as the update_interval. You can configure these if you wish but these are the suggested defaults from Home Assistant.
You can see it really starting to come together here. On the right hand side we have the new SEN54 sensors! On the left hand side you can see my basement sensors I installed in this guide here.
You can also see the lights starting to populate for my rooms as I get them installed and configured. Those are the Kauf smart lights I’ve covered here.
I’m really happy with the SEN54 unit and I ordered a couple more to use throughout the house. They just make things a lot easier. A single connection got all of that data in one self-contained unit. The cost is $49 so it’s pretty inexpensive relatively speaking vs. buying all of those sensors yourself. Just the dust sensor is pretty expensive alone.
I should also mention there is a SEN55 unit that also measures NOx (nitrous oxide). I have not seen this version in stock for the past month or so I’ve been investigating these. I just wanted to mention it’s out there. I’d like to get one for the garage eventually that has that extra sensor when it’s in stock.
I’m definitely not finished with my build and will be adding more sensors and writing more guides as that happens! I still have door and window sensors to do as well as remotely controlling opening/closing the garage door. I’ll also cover some of my other integrations I haven’t talked about such as my solar panels (Enphase) and Sense energy monitoring systems. Stay tuned!