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.
Building a multisensor is one of the first things you should when starting off with ESPHome. The sensors are cheap, the wiring isn’t complicated, and you get your first taste of creating custom firmware for an ESP8266 or ESP32 using ESPHome. And if you need a little help to get going, there are projects such as the one by WhoTheHeck freely available.
Multisensors built using ESPHome can measure just about anything you want to be measured. Typically, you will only be interested in the temperature, humidity, and maybe the air quality or brightness. Realistically, those are all the metrics you need inside your smart home. But you will find sensors supported by ESPHome which can detect incoming thunderstorms, react to gestures, and measure the field strength of magnets.
The ESPHome multisensor featured in this article measures temperature, humidity, air quality, brightness, and senses movement. It also has an RGB LED which indicates the air quality whenever movement is detected. The project is also built to be expanded with external sensors which can be attached using 3-pin JST connectors.
Required components for this project
This project uses run-of-the-mill sensors which can be found for little money on online marketplaces. It is designed to fit on a standard 70×50 mm prototype PCB, but the creator has also made PCB files available for those that want to order a custom PCB. Going down that route makes the soldering much easier.
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).
The SHT31 is a high-quality temperature and humidity sensor. It has an excellent ±2% relative humidity and ±0.3 °C accuracy for most uses. While I didn’t feature it in my list of recommended temperature and humidity sensors, it is an exquisite choice, though it isn’t used in DIY projects as frequently as the BME280.
With its factory calibration, the SHT31 is an exquisite choice if you would rather not spend time faffing about with getting the correct output. It supports voltages anywhere from 2.4V - 5.5V, and thus is a perfect match for an ESP8266 or ESP32.
CCS811 - Air quality
The CCS811 is a VOC and eCO2 sensor. It monitors air quality using a gas sensor that can detect a wide range of Volatile Organic Compounds (VOCs) and is intended for indoor air quality monitoring. The configuration of this sensor isn’t quite as easy as the others, as you will have to set a baseline to get good measurements.
The BH1750 is a simple ambient light sensor. It will tell you how bright a room currently is. That value can in turn be used to decide whether lights should be turned on when movement is detected or not.
The BH1750 provides 16-bit light measurements in lux, the SI unit for measuring light. The sensor itself is not much larger than a grain of rice, though the breakout board I recommend includes all the necessary components to use it in this ESPHome project. Included on the PCB is a voltage regulator and level shifting circuitry, allowing it to be used with both 3.3V and 5V devices, without modification.
AM312 - Motion sensor
The AM312 is a commonly found and cheap passive infrared motion (PIR) sensor. It is configured as a binary_sensor in ESPHome, and not through a direct integration. This binary sensor will turn to on whenever movement is detected, and off when it detects none.
It is worth mentioning that the AM312 is a cheap and small passive infrared motion sensor. It is known to produce false positives due to power fluctuations and electromagnetic interference. Users have reported that moving the AM312 as far away from the ESP8266 or ESP32 radio module and adding a decent size capacitor as close as possible to the VCC pin have improved its functionality. Others claim that wrapping the board with an isolating material and wrapping that in aluminium tape can improve matters. As always, your mileage may vary.
The WS2812B is a popular, individually addressable RGB LED. For this project, only a single chip is needed and not a full LED-strip. This LED will display the current air quality, which is read from the CCS811 sensor whenever the AM312 sensor senses movement using different colours.
In most cases, and especially for functioning lighting, I wouldn't recommend the WS2812B LED chip, as it only contains three chips for red, green, and blue. Other chips, such as the SK2812, add an extra white LED making it much more useful in functional situations, as the white a WS2812B produces is a combination of all the colours and not true white. In this case, however, the low cost of the WS2812B and the fact that it only serves as an indicator, are arguments for its use.
Building the ESPHome multisensor
As with just about any DIY electronics project, this one uses a 3D-printed enclosure. You will either need a 3D printer of your own or have access to a place which will print the enclosure for you. The designer of this project has made his files for the enclosure available to download on GitHub. There is even a part that will help you in the assembly of the multisensor.
Fresnel lenses, which are usually used to cover motion sensors, are used to cover up the WS2812B LED and BH1750 sensor. These are placed in the openings on the front of the enclosure.
Once you’ve got all the parts ready, it is time to solder. As alluded to earlier, you will have a much easier job soldering a custom-printed PCB than a prototype board. If you’ve never soldered before, you will find many guides on YouTube. Soldering isn’t as complicated as you might think it is. And by using a custom PCB, you will have a hard job making any errors.
The creator of the project has also made their YAML code available for others to use. But I’d suggest you try coding it yourself if this is your first ESPHome project. To accomplish that, all you have to do is visit the ESPHome website and look up the configuration of each sensor.
There are a few nice features to be found in this firmware. For example, the RGB LED is configured fully in the firmware and doesn’t use any Home Assistant automation to change to the appropriate colour. There is also a text sensor which will tell Home Assistant the air quality of the room the multisensor is located in.
Start making now
Projects such as this multisensor are a great way of getting into ESPHome and DIY electronics in general. A multisensor was the first thing I built from scratch, and it was a very enjoyable thing to do. With just a few cheap sensors and an ESP8266, you can make your smart home just a little smarter all on your own.
About Liam Alexander Colman
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.