Fun fact: I’ve been growing chocolate ghost pepper plants in my office for the past year. Although, due to the oversight of growing these in an office building, I’ve produced plenty of flowers but no peppers because there’s nothing flying around to pollinate them. But, that’s a problem for another day.
One problem I don’t have is maintaining adequate soil moisture. That’s because I’ve built a system using a Raspberry Pi Zero W and some capacitive soil moisture sensors to monitor the soil and change the color of an LED accordingly. Now, my coworkers know to water the plants when they notice a red light. And if they notice a red light along with an annoying sound emitted by a piezoelectric buzzer, they know the helpless office foliage needs water NOW!
After a false start with a defective Adafruit STEMMA Soil Sensor, my friend Tim showed me an awesome Analog-to-Digital converter which converts analog signals to I2C for use with the GPIO pins on the Raspberry Pi. This particular chip has four input channels which paired nicely with the 3-pack of analog moisture sensors I found on Amazon.
Once all the hardware was wired up, I wrote a bit of Python that utilized Adafruit’s ADS1x15 library to query the value reported by each sensor, average them together, and update the LED accordingly. The script is automatically executed by a cron job every minute.
Was all of this really necessary? Absolutely not. But it was a fun weekend project, and now I get to irritate my coworkers. 😉
Product | Price | Vendor |
---|---|---|
10mm RGB LED [10x] | $3.99 | Micro Center |
ADS1115 16-bit I2C Analog-to-Digital Converter | $6.99 | Amazon |
Capacitive Soil Moisture Sensor [3x] | $10.99 | Amazon |
Piezoelectric Buzzer [3x] | $4.99 | Amazon |
Raspberry Pi Zero Case – Clear/Black | $4.99 | Micro Center |
Raspberry Pi Zero W | $5.00 | Micro Center |