Skip to content
Maxwell Abrams

Have Your Plant Tweet When It Needs Water!

Tech, Project, iot, rpi1 min read

Recently, there have been many plants surrounding our team area in the office. Not the plants in the spheres, but rather small succulents. Because there are so many of them, it becomes difficult to track which plants need to be watered. This had me think of a solution where a Raspberry Pi can be used to tweet when a plant needs to be watered.

diagram

Components you will need:

  1. Raspberry Pi (low power), PSU, and a way to ssh into it
  2. Analog to digital converter chip
  3. Capacitive moisture sensor
  4. Twitter account (optional, but more fun)
  5. Plants!

The idea is to use a low power Pi (because we don't need all of the fancy things from a full Pi - and minimum power consumption because we obviously care about the environment if we are taking care of plants) to read a moisture sensor and tweet certain levels.

I chose to go with a capacitive moisture sensor approach, because a conductivity sensor would corrode over time (bad design, in my opinion). You can build your own from spare parts, or buy a complete one online. Because the Pi only supports digital inputs, you will need an analog to digital converter chip (commonly called an ADC or AD-Converter). These are also cheap to get online.

I followed Twitter's steps to create a developer account and create an app. The process is a bit tedious, but allows you to generate the keys you need to tweet.

After wiring up the ADC based on the schematics here, I wrote some simple code to loop over the sensor input, map it to some basic strings, and tweet the output. I added some sample code to my GitHub here. Feel free to pull, modify, and try it yourself! To keep the script running even when I terminated my ssh connection, I used the standard nohup. As an example:

nohup python -u plantMoistureTweet.py &

Note: The -u is important otherwise the output may buffer until the program exits.

After a few minutes, the project was live and tweeting! Feel free to follow along with the tweets! This was a PoC project that I can now take to the office! In the future, I may expand this to collect data for how fast the soil dries out, and predict when another watering is needed.

© 2024 by Maxwell Abrams. All rights reserved.
Disclaimer