When this need arose, I was playing around with the new SAMD21 boards. The Trinket M0 was one such board. Tiny yet capable enough to do plenty of useful things. It exposes an I2C interface so connecting sensors is easy. And I just needed one: a relative humidity sensor and I knew just the sensor for the job.
For my smart home sensor nodes, I am using the Si7021 temperature and relative humidity sensor. Adafruit has this on a breakout board which makes it easy to use. The breakout also has the benefit of being breadboardable while you are prototyping. My need was for a relative humidity sensor, but having a temperature sensor bundled in could be useful for some applications.
Additionally I needed some way of alerting when humidity is out of range. For this I used a plain piezo buzzer that my code can control the pitch of.
Humidity change in a closed environment should be slow, and those humidity control packs last quite a while, so I felt no need to have it checked frequently. Taking a humidity reading every couple hours is plenty. This also means less power being used over a period of time, so battery power is easier to deal with. I decided to use a 500 mAh lipo battery as it was about the same size as the space I was building for and would tuck under the circuit board. My deployed units have been working for 6 months on the initial charge.
To make this work I used the TPL5110 breakout that will power up the Trinket every so often (up to about every 2 hours). When the job is done a single output tells the TPL5110 to power down the Trinket and start the timer again. This makes the code much simpler: no loop, no sleeping, just check the humidity and shut down if it’s good. If not, alert until it is, then shut down.
Page last edited March 08, 2024
Text editor powered by tinymce.