Peppers ❤ Python

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 which reminded me that my Computer Engineering degree might have been worth it after all.

ProductPriceVendor
10mm RGB LED [10x]$3.99Micro Center
ADS1115 16-bit I2C Analog-to-Digital Converter$6.99Amazon
Capacitive Soil Moisture Sensor [3x]$10.99Amazon
Piezoelectric Buzzer [3x]$4.99Amazon
Raspberry Pi Zero Case – Clear/Black$4.99Micro Center
Raspberry Pi Zero W$5.00Micro Center

Circuit Wiring Schematic


pepperbot2.py source code