Over the last few months, I have multiple projects going on in parallel. I finally managed to finish one of them.
As part of the larger Home Assistant project, there is a subproject called ESPHome. ESPHome is a framework and toolchain for working with microcontrollers and the various things you can attach to them. The most common microcontrollers to use are from the ESP32 series. These microprocessors come in a variety of sizes and configurations. The one in this project is one of the weaker ones and runs at $5 or less. I attached two sensors and a display to it. One sensor provides temperature, humidity, pressure and gas resistance (used to determined air quality) and the other provides CO2 and temperature.
The board is initially programmed by attaching it to a computer, going to a web page and installing the firmware right from the browser. Afterwards, you create a text YAML file with wifi configuration and the settings for any devices you’ve added and you can then update it. Once it is on your wifi, you can do future updates over wifi.
The display is handled with logic written into the configuration file in some simplified C code. The entire config code with the display logic and some sensor logic (label assignment via if/then ladder) is under 200 lines. The display, in the end, is mostly sprintf/printf functions.
The goal of this project was to build out my first ESPHome proof of concept project. From here, I think I would be fairly comfortable putting together any basic display/sensor combination device. The next implementation, however, is going to use the I2S capability of the ESP32 and some additional electronics to drive audio. I would like to be able to have audio speakers around the patio that can be controlled with different audio for ambiance or specific animatronics/scenes.
Some other notable things for those that might want to follow:
- The case is designed with YAPP, an OpenSCAD library. I’ve used this before to make project boxes. It takes a bit of time, but in the end much easier and more tunable than trying to use a CAD package.
- Sensors used: BME680 and MHZ19
- For the BME680, there are two drivers. One with the embedded library for converting the gas resistance value to an air quality indicator and one without. The one with the library only runs on higher end ESP devices. However, somebody else has written their own conversion logic that can be found here.
- Neither sensor is that impressive. The temperature accuracy is supposed to be 1C, but seems to run even warmer than that. I don’t necessarily trust any of the values, but the point of this wasn’t to build a great sensor, just build an ESPHome project.
- I am concerned that the case significantly reduces airflow around the sensor. The case has a holes designed in it, but I might cut them open a bit bigger.