DIY environmental monitor

n.b. crossposted from FB, so fairly informal.

Got my little air quality sensor running the way I want – no dependency on “the cloud” 😀

my DIY air quality monitor

Time spent

This took me about 12 hours on software and ~6 hours on 3d modeling for the case.

Probably 5 hours of software time was spent in build issues and learning more C. 4 hours of the 3D modeling time was spent getting frustrated at SketchUp. I couldn’t figure out why non-manifold surfaces were creeping in. Learning curve issues, yay.

box part way through print

Design->model->print for the lid took me ~5 minutes, so I learned something 😅

I expect future projects involving the same software stack or 3D modeling to go much faster.

Software

sloccount says I wrote 503 lines of ANSI C, mostly sensor integration and driving the web server.

I’m using the Espressif IoT SDK (standard ESP32 SDK), which is slightly hacked up FreeRTOS. It runs a couple worker tasks at elevated priority to collect sensor data (one per sensor) and a normal priority task for the web server.

I’m pleasantly surprised that there are no deadlocks etc given data flowing from sensor tasks to the web server. Mutex locks, yay.

This is my first time doing something this complex in C, so the fact that it’s actually working brings me some joy. Prometheus collects directly from it (I implemented their /metrics interface).

collection works!

Hardware

I’m using a wESP32 board with a Bosch bme680 gas/environment sensor and a Plantower PMS5003 particulate sensor. Box was designed in SketchUp with guesswork and a micrometer, then printed on an Ender 3 using PETG filament from GreenGate3D.

The wESP32 gets power and connectivity over Ethernet, so there’s only one wire going to the box.

box when operational

Want to keep reading? / go foward / go back