So, I have some plants outside that I take care of – tomatoes, peppers, etc. One day, I thought it would be nice if they took care of themselves more often. Besides being interesting simply because it’s cool, this project is also very useful in a practical way.
What did I name it? AutoGarden. Note: as far as I’m aware, not related to any transforming cars.
I’m using an Adafruit ESP8266 HUZZAH board with a soil moisture sensor and an Adafruit plastic solenoid water valve. The ESP8266 logs moisture data online; when I press a button on the same online dashboard, the ESP8266 should open the valve and water the plants. The dashboard I used at first was Thingspeak, but I’m going to switch to Cayenne because I like their system better.
I’ll make a circuit diagram soon, but it’s a fairly simple configuration. The white wire is connecting pin 16 to the reset pin, which allows the ESP8266 to wake up from deep sleep. One orange wire is the ground wire that goes to the source of the MOSFET; the drain is connected to the solenoid negative, and the gate is the green wire, connected to pin 5. Lastly, other than the 220 ohm resistor (which is for the gate pin), all of the resistors on the red breadboard are part of a big voltage divider that scales the 0-3.3V analog signal from the moisture sensor down to a 0-1V signal, which is what this ESP8266 breakout can handle. The other orange wire connects the output of the divider to the analog pin (A).
Now, the most important part: the power. I’m making this project be something that I can “forget” about – not that I ever would forget about a MCU running in my backyard and posting data online. However, if I did forget about it, I want it to be able to keep running forever (a very long time) on its own. So, I’m using a lot of deep sleep; the MCU wakes up, logs its data, checks for commands (i.e., water the soil), and then goes to sleep for hours on end. This should conserve a lot of energy.
So, I set all of this up for a nice test. How did I power it? A couple of 9V batteries, one for the MCU and one for the valve. *scoff* Like that was going to work.
As you can probably tell, the 9V battery route isn’t the best strategy if I’m looking for longevity and forgettability1. It ran for around 31 hours.
So, this is great data to have, and I’m glad I did the trial run. Needless to say, I need more power.
I’m not inclined to use AC power because (a) that feels like cheating2 and (b) this project is designed to be in the elements, and I don’t want to have to waterproof 120 volts. So, I’m going to the next best thing – solar power!
Another interesting issue was water – specifically, water going where it’s not supposed to be. I’m using a waterproof case with a cable gland, so the one thing there should not be inside the case is liquid water. But, behold, there was water.
I’m not certain, but I think at least some of this had to do with the fact that the case has a clear top. The inside of the case can heat up a lot and so normal condensation and evaporation of water that happens outside could have been occurring. This is supported by the fact that the droplets were on the top of the case and the bottom only, indicating that the droplets probably formed, as opposed to leaked. The possibility of leakage through the cable gland is still there, though. The case certainly is not a problem – it was so tightly sealed that I had to pry it open. The new case doesn’t have a clear top, so hopefully that helps the problem.
So, I have to wait for my parts to arrive (should be soon). Until then, I can work on transferring my electronic parts from breadboard to stripboard, which should help clean things up and save space.
One last thing: I found out that Sparkfun is hosting a contest for ESP8266-based projects that use Cayenne, so I think I’ll be entering in that!