The ESPHome powered multisensor

Disclosure: This post contains affiliate links. If you click through and make a purchase, I will earn a commission, at no additional cost to you. Read my full disclosure here.

Diving into the world of ESPHome? One of your first missions should be to construct your very own multisensor. It's not as daunting as it sounds, trust me. The sensors are as cheap as chips, the wiring is far from brain surgery, and it's a perfect opportunity to dip your toes into the world of custom firmware creation for an ESP8266 or ESP32. And if it all feels a bit like learning to speak Martian, don't worry—there are plenty of projects out there, like the one by WhoTheHeck, ready to give you a hand.

The ESPHome multisensor that measures temperature, detects movement, and knows how bright it is in a room.
A multisensor built with ESPHome and featuring an LED, ambient light sensor, and passive infrared motion sensor.

The nifty abilities of the ESPHome multisensor

Multisensors whipped up with ESPHome are an impressive bunch. They can measure just about anything you fancy. Generally, you'll be keen to keep tabs on temperature, humidity, and possibly air quality or brightness. Realistically, those are the main stars of the smart home show. But there's a whole host of ESPHome-supported sensors out there that can do some pretty cool stuff, like detecting incoming thunderstorms, responding to gestures, or even measuring the field strength of magnets.

The ESPHome multisensor we're focusing on here is a bit of a Jack of all trades. It measures temperature, humidity, air quality, brightness, and even has a sixth sense for movement. Plus, it comes with an RGB LED that lights up to indicate air quality whenever it spots movement. If you want to get a bit more adventurous, this project is designed to be expanded with external sensors that can be attached using 3-pin JST connectors.

Required components for this project

This project leverages a handful of sensors that are as common as muck—you can easily find them on a shoestring budget on any online marketplace. It's been crafted to snugly fit a standard 70×50 mm prototype PCB, but for those who fancy the idea of a custom PCB, the creator has been kind enough to provide the PCB files. Trust me, this route is a doddle when it comes to soldering.

At the heart of this project is an ESP8266. You could, of course, swap the ESP8266 for an ESP32 if you wanted features such as Bluetooth tracking. But if the ESP8266 has everything you need, there is no reason to go with the more expensive option. If you do choose to go with an ESP8266 and want to use the PCB files provided by the creator, make sure you don’t purchase a mini-board. The PCB is designed to be used with a full-length ESP8266 (such as the one linked below).

SHT31: Measuring temperature and humidity

The SHT31 is a top-notch temperature and humidity sensor, boasting an impressive ±2% relative humidity and ±0.3 °C accuracy for most purposes. While it didn't make my list of suggested temperature and humidity sensors, it's a cracking choice, albeit not as widely used in DIY projects as the BME280.

Thanks to its factory calibration, the SHT31 is a fine choice if you'd rather not faff around trying to get the correct output. It's happy with voltages anywhere from 2.4V-5.5V, making it a perfect fit for an ESP8266 or ESP32.

CCS811: Monitoring air quality

The CCS811 is a VOC and eCO2 sensor, designed to keep an eye on air quality. It uses a gas sensor capable of detecting a wide range of Volatile Organic Compounds (VOCs), making it ideal for indoor air quality monitoring. Setting up this sensor is a bit more of a palaver compared to the others, as you'll need to establish a baseline to get accurate readings.

BH1750: Detecting ambient light

The BH1750 is a simple ambient light sensor that lets you know how bright a room currently is. This data can then be used to decide whether lights should be turned on when movement is detected.

The BH1750 offers 16-bit light measurements in lux, the standard unit for measuring light. The sensor itself is hardly bigger than a grain of rice, though the breakout board I suggest comes with all the necessary components for this ESPHome project. It has a voltage regulator and level shifting circuitry onboard, making it compatible with both 3.3V and 5V devices, sans modification.

AM312: Sensing Motion

The AM312 is a bargain-basement passive infrared motion (PIR) sensor commonly found on the market. It's configured as a binary_sensor in ESPHome, not through a direct integration. This binary sensor flips to on when it detects movement and flips back to off when it detects none.

It's worth noting that the AM312, while cheap and small, is known to churn out false positives due to power fluctuations and electromagnetic interference. Some users report that distancing the AM312 from the ESP8266 or ESP32 radio module and adding a sizable capacitor as close as possible to the VCC pin improves its functionality. Others swear by wrapping the board with an insulating material and then covering that with aluminium tape. But as they say, your mileage may vary.

WS2812B: Notifying with an RGB LED

The WS2812B is a well-liked, individually addressable RGB LED. For this project, you'll only need a single chip—not an entire LED strip. This LED displays the current air quality—read from the CCS811 sensor—when the AM312 sensor detects movement, using different colours.

Normally, and especially for functional lighting, I wouldn't put a good word in for the WS2812B LED chip, as it only contains three chips for red, green, and blue. Other chips, like the SK2812, add an extra white LED, making it much more useful in functional scenarios, as the white produced by the WS2812B is a mix of all colours—not pure white. However, in this case, the low cost of the WS2812B and its sole purpose as an indicator, tip the scales in its favour.

Piecing together the ESPHome multisensor

As with just about any DIY electronics project, this one uses a 3D-printed enclosure. You'd either need your own 3D printer, or you can scout for a local outlet that can print the casing for you. The genius behind this project has generously made the blueprint for the enclosure available for download on GitHub. He's even thrown in a part to guide you through the assembly of the multisensor.

Fresnel lenses, often seen gracing motion sensors, are used to shield the WS2812B LED and BH1750 sensor. They're snugly fitted into openings on the face of the enclosure.

Once your components are lined up and ready to go, it's time to wield the soldering iron. As hinted at earlier, you'll find soldering a custom-printed PCB a smoother sail than a prototype board. If you're a soldering newbie, fear not. There's a treasure trove of how-to guides on YouTube. Soldering isn't rocket science, and with a custom PCB, it'd be a tough job to mess it up.

The complete multisensor board using ESPHome. It includes the ESP8266 board, motion sensor, air quality sensor, passive infrared motion sensor, and ambient light sensor.

Tailoring the firmware using ESPHome

The mastermind behind the project has also made their YAML code accessible for enthusiasts to use. But if you're dipping your toes into the ESPHome waters for the first time, I'd recommend trying your hand at coding it yourself. To achieve this, simply pop over to the ESPHome website and look up the configuration of each sensor.

The firmware boasts a few neat features. For instance, the RGB LED is fully configured in the firmware, with no need for Home Assistant automation to switch to the appropriate colour. There's also a text sensor that'll report the air quality of the room where the multisensor is stationed to your Home Assistant.

Get your hands dirty

Projects like this multisensor are a splendid gateway into the world of ESPHome and DIY tech as a whole. The first thing I built from scratch was a multisensor, and it was a cracking experience. With a handful of inexpensive sensors and an ESP8266, you can give your smart home a brain boost, all by yourself.

A portrait photo oif Liam Alexander Colman, the author, creator, and owner of Home Assistant Guide wearing a suit.

About Liam Alexander Colman

is an experienced Home Assistant user who has been utilizing the platform for a variety of projects over an extended period. His journey began with a Raspberry Pi, which quickly grew to three Raspberry Pis and eventually a full-fledged server. Liam's current operating system of choice is Unraid, with Home Assistant comfortably running in a Docker container.
With a deep understanding of the intricacies of Home Assistant, Liam has an impressive setup, consisting of various Zigbee devices, and seamless integrations with existing products such as his Android TV box. For those interested in learning more about Liam's experience with Home Assistant, he shares his insights on how he first started using the platform and his subsequent journey.

Leave a comment

Share to...