The idea came from two solid facts:
The logical solution was a plant that could tweet at me.
When the moisture in the soil gets too low, the Photon fires a tweet and blinks its LED (D7).
It might take me a while to react and water the plant. As a result:
I decided to store the act of tweeting in a variable to check against before tweeting again.
The system would then have three possible states:
So it looked like an if, else if, and else kind of thing.
I loved integrating the hardware, software, and webhook dimensions of this small project. Here are a few details.
Fairly simple. I rely on plus addressing in Gmail to create new Twitter accounts, though. This way all my notifications get in my Gmail inbox.
I also created a new Google account to get a Google Voice phone number to tie to my new Twitter account (the number redirect calls to my personal phone and I can receive verification calls).
I had to understand the range of values the sensor was returning. I started with testing it submerged in water, which should return the highest conductivity.
I then used the Arduino’s serial to read values at different levels of soil moisture. This was necessary to set a threshold to fire up a tweet.
I started building in Arduino before transferring and finalizing my code in the Particle desktop IDE (Atom-based).
I was able to use the LowPower.h library for Arduino but couldn’t find an equivalent for the Photon. That led to an issue that I’ve discussed further below.
The IoT plant worked great but I ran into a couple of issues.
The product specs state that the moisture sensor “uses Immersion Gold which protects the nickel from oxidation.”
Well, there’s not a lot of it, then! I quickly noticed a drop in performance (I wasn’t getting any tweets when the plant obviously needed water).
This is an issue I read about and I was able to implement a low power library when I was starting on an Arduino Uno: I only ran some current through the sensor a couple of times a day.
I wasn’t able to find a similar library for the Photon and it led to the sensor’s erosion.
I’m not really sure how location—or height—of the sensor impacts the moisture reading.
I was anxious to set up my Photon but looking back, I should’ve spent more time getting serial readings from different positions.
If I were to spend more time on this project, I would: