A few years ago, I started dabbling with the ESP chips that have become so popular. For me, the ease of WiFi, and the Arduino compatibility meant that I was able to get up and running much faster. Not having a background in electrical engineering, the simple things like having a good base with the PCB, a couple sensors built-in and easy expansion makes all the difference.

Before the ESP chips, I’d tried several other wireless communication chips that were each challenging in their own way. Since my ultimate goal is to report the sensor data to a monitoring service, getting up the stack so that I could use IP communication was a big win, and the ESP chips are perfect for this.

I had several stops and starts throughout this time. It seemed that there were library issues, or the sensor would be somewhat flaky and stop reporting after some time. This was all using the Dev kits, and fighting pin-out differences, and I2C register differences between libraries. I found myself wanting more.

I recently discovered these Anavi boards that have been quite useful to me. These have an open source approach, with code examples. The benefit here is that much more of the kit has been built onto a specific PCB, with screw terminals and other headers for connecting extra sensors.

Using the example code, I was able to read both of the on-board sensors and to display the values on the OLED display in one afternoon.

I then started pulling in some older code that I’d used to to ship data to MQTT and refactoring some of the Go code that I use to receive that data. This has all been rushed, and so the code is spread over a few repositories and not very reusable or organized, but its all committed at this point. I just need to figure out how to put secrets in Arduino code and I’ll have the last piece on GitHub.

The sensors are read on the device every few seconds, and a JSON payload is built, including the values of all sensors, and sent to an MQTT topic. Listening on the other side of the MQTT topic is a Promtetheus exporter I wrote called thing_exporter. This reads the messages sent to the given topic, unmarshals the JSON into a struct, and export the various sensor values. Then Grafana is reading from Prometheus, where I can make some pretty graphs or alerts if I cared enough.

Considering when I started tinkering, its taken quite some time for this setup to feel stable, but after my recent changes and a new board to use as the foundation, this system has been reporting happily without failure for the last few weeks.

My next steps here are to mount an connector to a case so that I can easily attach more sensors. I plan to drop one sensor into each of my wine fermentations this year to monitor the temperature. This should also be enough for me to be able to trigger a fan, or a pump, or something to act as a thermostat if I need to control the temperature of the wine batches. Grapes should show up here in a few weeks and I’ll be able to test it out. It feels good to finally have some of these loose ends tied up a bit. I now have a simple platform to build on, so I’ll probably be getting a few more of these Anavi boards.