transcript

Practical Engineering - Arduino Garden Controller - Automatic Watering and Data Logging

Thumbnail of the video “Practical Engineering - Arduino Garden Controller - Automatic Watering and Data Logging”
Download Markdown
Community upload. AI output has not been independently verified.

I like fresh herbs. I'm not a picky eater otherwise, but add in some fresh basil, cilantro, rosemary, or thyme to a meal and it makes a huge improvement to any recipe. So I pay for this stuff at the grocery store, and some of it is expensive, like two to four bucks for a few stems. So I got to thinking this spring: hey, I've got a backyard on the south side of my house, I've got the internet to read up on how to grow things, I can do this myself and save some money. Then the engineer in me realized that if you made the garden automatically water itself, that could save some work, and if you collected all sorts of different data, you could analyze that and get a sense of the health of the garden without any guesswork.

Well, here's a tip: if you spend a lot of time and money complicating your garden with a bunch of sensors and electronics, it ends up being more worth it just to buy fresh herbs from the grocery store. My brother bought me an Arduino for Christmas last year, saying it was right up my alley. I guess he thought I could do with a few more ones and zeros in my life. And being a cat owner myself, I have to admit that it might be nice to have something that does what I tell it to.

Well, I went through the tutorials and I honestly had a lot of fun with this thing. The gratification that comes from combining a working circuit and a working program is a little bit addicting, very much like golf. These moments of Eureka occur in between long bouts of failure, disappointment, and constant hazards, but you get something right just frequently enough to keep you from giving up on it altogether. I'm almost as novice as a con electrical hobbyist, not to mention as a gardener, so if you're treating this as a how-to guide, don't sign up for a booth at the farmers market just yet. In the interest of keeping this video interesting, I'm going to try and keep most of the technical jargon and minutiae of the project out of the narration and in the description below. If you have specific questions that don't get addressed, I'd love to answer them in the comments.

Let's jump right into this build, and I'll go through all the individual parts. As if an Arduino isn't complicated enough, there are a whole host of shields, which are just boards you can put on top of an Arduino that add additional functionality, like Mario power-ups. I'm using this data logging shield, which allows you to save to an SD card. Now, it is completely possible to automatically water a garden without any data logging whatsoever, but then again, none of this is really necessary. I'm starting to realize already that the plants themselves are becoming secondary to the garden data in my mind, because if I don't have a heavily instrumented garden, I might not be able to see how sunlight illuminance correlates with soil temperature, or how soil moisture changes with relative humidity and air temperature, or how far out of phase soil temperature and air temperature are from one another. I certainly wouldn't be able to take all that data and make cool graphs. And if I'm being honest, I'm realizing this is truly what's important to me: I want to make cool graphs.

This shield comes 95% assembled, but the headers are left off, and this is allegedly so you can choose which headers you want. But I have an inkling that this is kind of like a mini gauntlet for an electrical hobbyist, like a rite of passage: only after you can solder on these headers will you be ready for whatever it is you're planning to do with this board. As someone who uses their $10 soldering iron primarily for burning their initials into the bottom of wooden bowls, this was a disaster of a soldering job. I won't show any close-ups of it because I'm embarrassed, but I somehow finished it without ruining the board.

Let's talk about sensors. I wanted a good mix of data, so I chose a suite of several different kinds of sensors. First and foremost, I wanted a soil moisture sensor, because I needed to know when to water the garden. Now, I did a lot of research on soil moisture sensors, and I won't bore you with the details because there's a lot of discussion out there, so let me save you some trouble in the simplest way I can think of: you get what you pay for. There's more on this in the description below if you're interested. I bought a capacitive soil moisture sensor from Vetronics, and I couldn't resist getting their soil temperature sensor while I was at it. These sensors are quite a bit more expensive than the typical stuff you can find on SparkFun or Adafruit, but again, you really get what you pay for. These are well built, well calibrated, and very simple to use. Here I'm testing the soil temperature sensor. I also tested the soil moisture sensor in lots of different conditions, including dry air, potting soil, and this cup of water. Apparently, what's in this cup is 98% water by volume, which is pretty good, honestly. As a civil engineer, I would have been happy with anywhere between 80 and 120.

My sunlight sensor is a cheap and simple photoresistor. Its resistance changes based on the intensity of light, and you can put together a simple circuit which allows the Arduino to read this as an input. I actually made an attempt to calibrate the sensor based on the known brightness of this flashlight. I have no idea if it's even close to correct, but I have the code reporting this data in lux, which is the SI unit for illuminance. Finally, I got the sensor which measures both air temperature and relative humidity. This is the only digital sensor I'm using. It's really easy to use, since all the electronics are on board and the code is already written, so I just end up with nicely scaled readings. The problem with the digital sensor is that my multimeter can't talk to it, so if there's any need for troubleshooting, I don't really have a lot of options. Luckily, this one worked just fine.

For the actual watering of the garden, I've got a cheapo solenoid valve from Adafruit. I built a little circuit with a transistor which allows the Arduino to switch the valve on. Right now, I have the code check the water level once a day in the evening and switch on a soaker hose for a set amount of time if it's below a certain threshold. From what I've read, it's actually better for the plants and herbs, especially, to have some cyclical nature to the wetness and dryness of the soil, rather than just being constantly well watered. This scheme also reduces the duty cycle on the valve, and if a sensor goes bad, there's no chance of flooding the yard.

Since all these electronics are going to be sitting out in the sun, I'm building a crude version of a Stevenson screen, which is really just a louvered box that lets weather instruments be out in the open without exposure to direct sunlight or rain. I'm using plywood scraps from my scrap bin. The enclosure goes together with tin snips, vent glue, and finish nails. A nice coat of white latex paint will hopefully help reflect the sun.

Well, it wouldn't be a hobbyist project without at least one big gob of electrical tape and some questionable troubleshooting, but I finally got this thing working. I've had it running for just a few days now, and it's actually working really well. The garden is happily watered with no intervention from me, even though I check on it now more often than before. I've got the Arduino here. Here's a quick look at some of the data I'm collecting.

Combining microcontrollers and gardening is a really popular idea. I think that's because gardens have very simple inputs and outputs that are easy to wrap your head around: soil plus water plus light equals delicious herbs and vegetables. I guess people, myself included, see a notoriously simple and relaxed hobby and can't help but feel compelled to overcomplicate it. There's a growing market of products out there geared toward so-called makers, which are really solutions looking for problems, or at the very least things we like to try and use just for the sake of using them. For me, at least, the Arduino probably falls into that category. But just about anyone can connect the dots between gardens, water, and an admission that I am not a responsible human being who is capable of remembering to water a garden every day, and realize: hey, I can use technology to overcome my personal shortcomings. More than that, I can bend technology to my will, and that will feel good to my ego and my sense of self-worth. After all, no one's hobby is to buy an irrigation controller off the shelf of a hardware store.

Thanks for watching, and let me know what you think.