Creating a DIY Multisensor
If you are wondering what this ugly-looking thing is, it’s the multisensor I made using some electronic components I already had from previous DIY projects. As I started getting into the Smart home hobby, I quickly realized how expensive it gets with so many sensors I have to place around the house (e.g. motion, temperature, humidity, door, light, etc.). Each little sensor costs at least $10-$15. So I was looking for ways to save money by making my own sensors from individual components.
A few years ago, I participated in Reddit’s Secret Santa gift exchange and had received an Arduino Development Kit from Amazon. It had among other things –
- DHT11 Temperature and Humidity module
- RGB LED
- Photoresistor module (Used for ambient light level)
- Arduino Uno
- Dupont wires and jumper cables
I also had a couple of PIR motion sensors and NodeMCUs from previous DIY projects. So I decided it was time to put these into good use and maybe save some money.
I wanted a no solder DIY solution that integrates all of these and provides wireless monitoring/control through Home Assistant. I found exactly what I was looking for from this project on Github ESP-MQTT-JSON-Multisensor. I even 3D printed the enclosure from the model created by “Bruh”. Overall, it would have cost me a total of about $15-20 if I had to purchase everything from Amazon.
While the initial prototype worked fine, it was still messy because I had to manage all the data payload in JSON and maintain the code for fetching the sensor values. I also learned the values from some of the sensors were not accurate, so it needed some manipulation. So I was tying a lot of logic for data manipulations to individual sensors, which will require me to back and update the code if I have to replace anything. Over time, this required me to make frequent updates to the code and I wanted to find a simpler solution.
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems. This allows me to simply write code as config files and have ESPHome take care of compiling and working with the sensor and communication with the client aspect of the system.
This is how my YAML file looks like for the multisensor – Gighub Gist
Home Assistant integration with multisensor via ESPHome component gives me real-time access to all the sensors onboard the multisensor and also lets me control the LED light on the multisensor to indicate various states through automation.
Home Assistant Integration
Here is an example of how integration with ESPHome provides me access to the multisensor’s various sensor data and also lets me control the onboard RGB light. I have placed this in the laundry room, so it’s not an eyesore because of its massive size. I have a few automation based on its brightness value and motion state, but it’s for a different future topic. Check out my other posts on Home Assistant if you are interested in learning more about my Home Assistant setup and the automation I have built with it.