BushcraftOz | The Australian Bushcraft Forum

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Garden Monitoring and Automation System

Lifecraft

John McDouall Stuart
Joined
Feb 8, 2014
Messages
526
Reaction score
18
Location
Illawarra, New South Wales, Australia
A few months ago I prototyped a system to monitor the garden, and the environment, and to automate things such as irrigation.
I didn't post it on these forums because it's not really bushcraft related, however it is homesteading related. That's why I figure it's worth posting in this section.

It monitors soil moisture levels, light levels, temperature and humidity levels, as well as water flow rate.
That data can then be viewed online via the web (if it's plugged into the internet), or via WiFi if you're nearby (such as a phone, tablet or PC).

Here's a photo of the working prototype, running from a battery:
DSC04172.jpg

The circuit/bread board has an arduino and a bunch of environmental sensors connected to it.
The blue box (on the right) is a Raspberry Pi (a mini computer which costs around $50) which collects the data, hosts the web site displaying the data in graphs, and acts as a WiFi hot spot so you can connect wirelessly to view the web application.
The whole system is (in the photo) hooked up to a pitcher plant and monitoring soil moisture levels and other environmental data.
The 12v SLA battery (bottom left) seems to keep this system running for days without needing to recharge. I plan to add a solar panel to recharge it.
The little screen there currently only shows me the output of the web server (eg. errors, etc.) but I can make it display the data graphs.

The above photo doesn't have the automatic irrigation system connected because I didn't have the space inside to connect it all up for the photo. (I don't want to leave it set up outside yet because I haven't figured out how to waterproof it all.)
The irrigation system (which I've tested and seems to work) includes a simple circuit which controls a gravity fed solenoid water valve (based on a signal from the controller circuit in the above photo), and a bucket (or any drum) which provides the water.
When the irrigation system is connected it opens the valve whenever the soil moisture sensor detects the soil is getting dry.

Here's a screenshot of the web application and the data collected by the system:
gm screenshot.jpg

It's only a very crude, early prototype web application so there's a lot of room for improvement. But it does seem to work fairly well.

You'll notice the water flow graph has no data, because the irrigation system wasn't connected when I took the screenshot.


If you want to see this system running live from the other side of the world go here:
http://www.sensorica.co/home/what-we-do/projects/microgarden-control-systems/garden-manager-live
... and scroll down a bit.
(The dates are outta whack because they haven't yet added a real time clock module to the circuit.)

It's become an open source software/hardware project and I've been working with a group in Canada (www.sensorica.co) to turn this prototype into a system that can be sold fairly cheaply so anyone can use it in their garden or farm.
The graphs on that page are coming from a server in Montreal (Canada), connected to a replica of this prototype that they put together. I remotely installed the software I prototyped, so it's pretty much identical.

That just demonstrates that the information can be accessed remotely, from anywhere. Even the other side of the globe.
There is a glitch in the software which causes a delay when there's a huge amount of data. But once that's resolved there should be less than a minute delay between sensors picking up information and the web application display it.
Once the glitch is fixed that delay can potentially drop to about 10-20 seconds, depending on a few factors.


The whole prototype I'm fairly sure would have cost me around $100 in parts to build (mostly cheap ebay parts), plus the time I spent writing the software (which anyone can use now if they want to, it's open source).
Many parts are optional (eg. the Raspberry Pi) so the cost could be brought down, if you don't need certain functionality.

If anyone has any interest in building something like this I can give you access to the source code, links to the cheap ebay parts, close up photos of the circuitry, as well as diagrams (which I'm slowly working on), and even try to help explain how to put it together.
You don't need to be an electrical or software expert (I'm a relative electronics noob, I just followed online wiring diagrams, etc. I do have a background in software, but you don't need that if you simply install the open source software instead of building your own).
So long as you have the DIY mentality and are keen to learn, as well as the determination to work through possible hurdles and hiccups, it shouldn't be all that difficult to assemble.

Cheers



Edit:

Here's a photo of the close up main controller circuit for anyone who is curious about it:

View attachment 19178

In the middle is an arduino nano clone.

Down the left are all the sensors (top to bottom):
- temperature/humidity sensor (the blue thing)
- flow meter (goes out of the shot but you can see the wires)
- light sensor
- soil moisture sensor (goes out of the shot but you can see the wires, and the base of the probes coming back into the shot)

Slightly left of the arduino are 3 LEDs:
- Green means the system is running
- Blue means the soil moisture level is low
- Red means there's an error in the system

On the right are:
- top: a micro SD module (and card) - this records all data (so the system can be run offline and the data viewed later)
- bottom: a real time clock module (keeps track of the time even when the system is turned off, so the charts show the date/time)
 
Last edited:

Lifecraft

John McDouall Stuart
Joined
Feb 8, 2014
Messages
526
Reaction score
18
Location
Illawarra, New South Wales, Australia
This is the latest version in action:
https://drive.google.com/file/d/0B_8QvsLqRy5qTGI2NXFteVhZY2c/view?usp=sharing

The interface is designed to be used on touch screen devices like phones and tablets, but it can still be used from a standard PC, etc.

Each device (aka sensor node) is now wirelessly connected to the central hub/interface, making them much easier to deploy in pots or throughout the garden.
You can see 2 devices listed in that video but the moment another device is switched on within range it'll show up in the list. (I'm waiting for more of the wireless modules to arrive so I can create more devices.)
Each device can be given a friendly name/label so they're easily recognized.
The IDs are 3 numbers, so they can be configured as x,y,z spacial coordinates making them suitable for large farms, hot houses, etc. with lots of nodes.

The plan is to stick the sensor nodes in waterproof cases so they can go outside, and have them transmit data through the window to the central hub inside. If it'll fit, I'll add a small solar panel to each device so it can keep itself charged.

Each sensor node can have multiple sensors on it (as you can see in the video) and can be customized to have different combinations of sensors, and not just stuck with the same 3 you see there.
I'm hoping I can make each sensor node for around $10-$15, which is quite affordable. (Fairly certain it'll come in under $20 each.)

The central hub without the touch screen shown there (just using an existing phone, tablet, or PC for the interface) should come in well below $100 and should theoretically be able to support up to a few hundred sensor nodes (although in practice there may be a limit somewhere to the number it can actually support).

I can still make the central hub accessible to the web so I can access it remotely from my phone, anywhere in the world, like the previous version.

This is a basic sensor node dev board without any sensors attached:
https://drive.google.com/file/d/0B_8QvsLqRy5qTTQ3NWVITXhnLVk/view?usp=sharing

This is a sensor node with a light sensor and temperature sensor attached:
https://drive.google.com/file/d/0B_8QvsLqRy5qMmpFQWlVOFE4ckU/view?usp=sharing
It's set up to have a soil moisture sensor attached as well but it's not plugged in in the photo (I moved the setup and forgot to plug it back in).

I can actually make those sensor nodes smaller by soldering them to a circuit board with a compatible microchip instead of the blue arduino nano clone board. But the arduino is easier to reprogram during prototyping so for now I'll keep using them.

This is the central hub connected to a Raspberry Pi board which hosts the web application showed in the video:
https://drive.google.com/file/d/0B_8QvsLqRy5qR1ZVb0w1VDUwekE/view?usp=sharing

All the electronics need to by tidied up and ideally soldered to completed circuit boards, but for now it's working as an early prototype.

I still need to implement irrigation control and make it possible to use the interface to customize when the irrigation is turned on (based on soil moisture readings), and allow for manual control of irrigation if I want to override the automatic settings.
I've prototyped the electronics, etc. for irrigation but it's not implemented into this latest system yet.

It's all open source so if anyone wants to set up a system like this at home to take care of the garden I teach you how to build it.
 
Last edited:

Blake

Nest In the Hills
Staff member
Administrator
Joined
May 2, 2011
Messages
3,695
Reaction score
302
Location
Central West, NSW
Wow! Amazing work LC. I will admit that I'm totally at awe and baffled at this. I would consider myself moderatley technical but this is a new level. Thinking of this from my perspective and I think that of many permaculture gardeners I am very conscious of water use. I try to manage our rainwater levels and monitor upcoming rain so that we keep the water up to our vegetable garden without using to much mains water.

How do you think this system would scale to something bigger? Im imagining a drip system which monitors the moisture levels of many beds and supplies water based on the moisture levels. I know this probably sounds a bit over the top but the water savings of a mulched and drip fed system controlled by this VS hand watering would be massive. When we first moved in last summer our grass needed watering every day as it was new. Our new rainwater tanks were empty and It was all from mains. Our water bill for the quarter was over $400. This summer I replaced about 40% of the lawn with raised vegie beds, citrus, shade plants near the house, natives in the sunny patches and mulched heavily. I kept the grass long, watered heavily but only every 2 weeks and after 6:00pm. I redirected the overflow onto the thirstiest beds. All using tank water.

Our water bill was $46! I couldn't believe it. Our neighbours was over $350 and all they have is lawn. To be fair they have 4 people not two but just lawn front and back. We have herbs, lawn, citrus, stone fruit, 14 vegetable beds, hedges, shade pants, 6 trees, palms, camelias, tiger grass, lilies a native garden and 3 compost beds etc. Im planning on putting in another 10,000L of water tanks and I think that would bring our water bill to $0 (aside from the service fee I guess) even with dry periods.
 
Last edited:

Lifecraft

John McDouall Stuart
Joined
Feb 8, 2014
Messages
526
Reaction score
18
Location
Illawarra, New South Wales, Australia
How do you think this system would scale to something bigger? Im imagining a drip system which monitors the moisture levels of many beds and supplies water based on the moisture levels. I know this probably sounds a bit over the top but the water savings of a mulched and drip fed system controlled by this VS hand watering would be massive.

It's very doable. I don't think it's over the top.
With less and less water available to waste these days it's going to become essential to have intelligent watering systems.
Setting up a system like that throughout my gardens here is one of the goals.

The technical aspects (electronics, sensors, pumps, water valves, etc.) is easier than I would have thought a year or two ago (before I started getting into electronics).
I've already prototyped pretty much all the necessary aspects of that such as having pumps/water valves activate when soil moisture readings are low.

The biggest hurdle that remains is how do I waterproof the electronics so it can operate outside.
That's not really a huge problem it's just a matter of finding or building waterproof enclosures. I have been considering trying airtight tupperware containers among other things.

The water savings would likely pay for the system in a year or two (depending on lots of factors).



To have automated drippers you can put in an electronic solenoid valve (basically an electronic tap), which can be opened or closed based on soil moisture readings.
These are on ebay for less than $10 each.

For a soil moisture sensor you can just use 2 nails with wires soldered to them, and a single resistor. Or you can buy them on ebay for a couple of dollars each.

You connect the soil moisture sensor to an arduino.
An arduino is a microcontoller; basically just a tiny little computer which can receive electrical signals from sensors and other devices, as well as send electrical signals to electrical devices.
You can get arduino clones on ebay for about $3-4 which is extraordinary considering what you can do with them. They do the same job as the genuine ones.

You put some really simple code onto the arduino which basically says:
"If soil moisture level is less than the minimum specified level then send an electrical signal to open the valve."

On the output side of the arduino you have a very simple and cheap circuit (basically just 1 component and a few wires) which takes the signal from the arduino (5v) and converts that into the voltage for the solenoid valve (12v). This probably costs $1-$2.

Connect the arduino, via the output circuit, to the valve then when the soil moisture sensor reading drops below a certain level the arduino tells the valve to open, and the water flows through to the drippers.
Put it in a box, add a battery (and optional solar panel), and stick it in the garden. Connect the water valve to the tap or a water container, and to the dripper, and you're good to go.

You can easily swap the valve for a pump, etc. if that better suits the situation.


Make multiple of these setups and put them in different places and they can all independently water different sections of the garden, based on the soil moisture sensor in that particular section.
That way the areas which get the most sun can be watered more often, and the areas in shade get watered less often. Much better than blindly watering the whole garden.

That entire system could be built for well under $100. Possibly even under $50 (if you don't include the dripper hose, water tank, etc. that you likely already have)
The most expensive part of the whole thing is likely to be the battery. A 12v SLA battery that I have was about $20.


One of the really cool things about the arduino is that they're so popular these days you can find examples for almost anything you want to do with it.
So when I want to do something I just go to google, do some searching and reading, and copy stuff other people have already done. Then I go ahead and customize it, and build custom software for interfaces, etc.


If you or anyone else wants to learn how to build a system like that I'm happy to help.
I can explain what components to buy off ebay, how to wire everything up, give you all the code you need, walk you through putting that code onto the arduino.
You don't need to have any electrical or software experience. You just need to have an interest and be able to follow other peoples' examples.

I'm lucky that I have a software background so it helps me to write code. But I had virtually zero electrical experience a year or two ago. I just started copying other peoples examples and then realized it's actually easier than I thought it would be.
Most of the code you need you can usually find online alongside the examples for the electrical wiring, so you don't need to know how to write code either.

Developing something completely new without examples to follow can be tricky sometimes, but replicating something someone else has built isn't very difficult at all.


The hope is to eventually package up systems like this as a kit people can buy. Because not everyone wants to deal with the technical side of things.
While I've been collaborating with people in Canada to try make it happen we're not quite at the point where you can buy a kit ready to install.


Let me know if you're interested in learning some of this stuff. It's really fun to do and I'll bet that most of it isn't as difficult as you would expect.
 
Last edited:

biggles1024

Rüdiger Nehberg
Joined
May 9, 2012
Messages
973
Reaction score
13
I'm very interested in a setup like the one you've described and will take you up on your kind offer, but I have to get back to work first. No spare money for anything at present but I will make it happen soonish.. ;)

Cheers,

b.
 

Lifecraft

John McDouall Stuart
Joined
Feb 8, 2014
Messages
526
Reaction score
18
Location
Illawarra, New South Wales, Australia
I'm very interested in a setup like the one you've described and will take you up on your kind offer, but I have to get back to work first. No spare money for anything at present but I will make it happen soonish..

No problem. Let me know when.

I would recommend starting small, getting a few of the cheapest components to play with and get the hang of setting up really simple arduino circuits.
You could get started with that for less than $10.

The best starting point is the arduino blink example. Just having the arduino turn an LED on and off at 1 second intervals (or whatever interval you specify).
All it takes is an arduino, a resistor, an LED, and a breadboard to plug it all into.
Then load up the example blink "sketch" (the term given to arduino code/programs) and watch the LED flash on and off.
It's really basic but it's best to start with the simplest possible project, then go from there.

The code is provided in the arduino IDE (the program used to edit and upload arduino code) so it's great for arduino beginners. There's a big collection of other examples included too such as reading sensor inputs, etc.

Then you can tweak the interval to watch it flash faster or slower.
You can even tweak that code so it flashes the SOS signal, which is kinda cool as a beginner project.

The process of turning on/off an LED with the arduino is pretty much the same as turning on/off a water valve, etc. The only difference is with the latter you need that tiny extra bit of circuitry to convert 5v to 12v.
It's the same code though.

I can give you links to all the required bits on ebay when you're ready, and help you get set up.
Sounds like it's going to be complicated, but it's surprisingly easy.

Then the next step might be to buy a soil moisture sensor for a couple of dollars, and have the LED turn on/off based on the soil moisture sensor reading.
I can give you the code for that.

This alone could be a useful little indicator telling you when to water, even without it actually triggering the water.

Then move on to the next step of swapping the LED for a pump or valve. Just need the extra little bit of circuitry to convert the voltage.
I can explain how to do that and what parts to get for it.

Before you know it you'll be able to automate your watering system.
 
Last edited:

Blake

Nest In the Hills
Staff member
Administrator
Joined
May 2, 2011
Messages
3,695
Reaction score
302
Location
Central West, NSW
Amazing info thanks so much lifecraft.

I also to believe that water will continue to become much more precious than it already is. I honestly believe that this kind of technology is the future of agriculture. Technology gets a bad rap on occasion but it can also do some amazing things to improve the world.

I suppose the key to any emerging technology like this is:

1. People understanding what it can do for then or why they need it
2. Making it approachable and affordable to the average person

You see it all the time with technology where it plods along for decades not really picking up traction until one day someone cracks the consumer recipe. 10 Years ago no one wanted a mobile touch device but now they are standard. 3D printers have been around for decades as well but the progress in the last few years making 3D printers available to the average person has been incredible.
 

Lifecraft

John McDouall Stuart
Joined
Feb 8, 2014
Messages
526
Reaction score
18
Location
Illawarra, New South Wales, Australia
In case anyone wants to get started with what I mentioned above.... or even just to see what kind of cost will be involved to get started...

Here's the <$4 arduino nano clone:
http://www.ebay.com.au/itm/1PCS-Nan...ontroller-Board-For-Arduino-New-/261666964691
I've bought about 12 of those and they work great. They're the same ones I used for all of the prototypes I discussed in previous posts here.

USB cable for connecting the arduino to the PC - $1:
http://www.ebay.com.au/itm/Brand-Ne...-Charge-Cable-For-MP3-Cellphone-/121226507718

Assorted LEDs - $1.48:
http://www.ebay.com.au/itm/100PCS-3...Emitting-LED-Diode-Assorted-Set-/281582102703

For the LED resistors it's probably best to choose the 330ohm value - $1:
http://www.ebay.com.au/itm/50-pcs-1...esistor-Range-of-330ohm-3-9Kohm-/251659635987
330ohm is a good general value LED resistor.
Different LEDs and different voltages can be calculated to a specific resistor value but 330ohm is safe for any LED at 5v and good for beginners, until you want to start calculating the exact values.
The exact values will likely range from about 40ohm up to about 220ohm. 330ohm will make the LED slightly less bright but it'll still be bright enough to play around with, and gives you a good margin of error.

Breadboard - $1.55:
http://www.ebay.com.au/itm/DIY-23x1...Solderless-PCB-Bread-Board-Test-/141621463872

Breadboard with slightly better layout (I prefer this type) - $2.14:
http://www.ebay.com.au/itm/New-BB-8...ronic-Test-Prototype-Breadboard-/321691921793

Breadboard wires - $1.84:
http://www.ebay.com.au/itm/40Pcs-10...-Cable-for-Arduino-2-54mm-1P-1P-/131002784053

Soil moisture sensor - $1.42:
http://www.ebay.com.au/itm/Soil-Hum...or-Module-For-Arduino-WHOLESALE-/121592886296
These sensors do corrode so I wouldn't use it when deploying a system for long periods of time. However they're really simple to get started with so good for learning.


So as you can see it's pretty cheap to get started.

Both breadboards I posted are fairly cheap in quality too, but the only problem with them is that it can sometimes be more difficult to push pins and wires in and to take them out than expensive ones. They still work perfectly fine.
If you have plenty of funds and want to make things a bit easier then it might be worth upgrading to a better quality breadboard, but I use the cheap ones and it generally isn't a problem.
 
Last edited:

Walker

John McDouall Stuart
Joined
Jun 13, 2011
Messages
578
Reaction score
6
Location
NSW
Administrator/Moderators: I vote that this email thread goes into the Resources & Learning area, or, other such library area so people can easily find it. Very insightful and full of instructions.
 
Top