Wednesday 8 July 2020

Arduino Garden Controller - Automatic Watering and Data Logging

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 just 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 that 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 and then the engineer and me realized hey have 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 and I'm almost as nervous as they come for an 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 interests of keeping this video interesting I'm gonna 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 building 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 login whatsoever but then again none of this is really necessary and 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 and soil temperature in air temperature are from one another and I certainly wouldn't be able to take all that data and make cool graphs and if I'm being honest now 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 Adafruit saying only after you can solder on these headers will you be ready for whatever it is you're planning to do with this board and 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 and 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 capacity of soil moisture since from veget Ronix 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 sparklin 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 that would have been happy with anywhere between 80 and 120 my sunlight sensor is a cheap and simple photoresistor it's resistance changes based on intensity of light and you can put together a simple circuit which allows the arduino to read this as an input 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 button 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 problem with a 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 a 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 the plywood dregs of my scrap bin so this is LEED Silver accredited to get the gold I think you have to use pallet wood and have a Pinterest account the enclosure goes together with a tin soffit vent glue and finished 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 it had the Gard Ueno 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 over complicate it and there's a growing market of products out there geared towards quote unquote makers which are really solutions looking for problems or at the very least things which we'd like to try and use but just for the sake of using them and for me at least the Arduino probably falls into that category but just about anyone can connect the dots between garden needs water and I am NOT a responsible humanbeing who is capable of remembering to water a garden every day and realize hey I can use technology to overcome my personal shortcomings and 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


No comments:

Post a Comment