From little things, big things grow

December 2022

A quick engineering lightning talk I gave at Ferocia explaining how my home-made garden watering system works.

Automated transcript

Hi there. I'm Paul, and this is my first lightning talk at Ferocia Neil has been pestering me to do one of these for ages, but I felt a little bit like an imposter in an engineering talk. And that was until I just decided to find my own definition of engineering that suited. And so here's here's what I found on Wikipedia.

Engineers as practitioners of engineering are professionals who invent, design, analyze, build and test machines, complex systems, structures, gadgets and materials to fulfill functional objectives and requirements while considering the limitations imposed by practicality, regulation, safety and cost. So I'll use that. And I thought, Well, I've got a project that fits that bill, so let's have a chat about that physics where my limitation laziness is my requirement and optimal watering is my objective.

So let's start with physics and this problem is essentially about how I would go about watering my garden once I first had one. So about eight years ago, nine years ago, maybe, I had a garden for the first time and needed to look after it. And here is, you know, everyone would have bought one of these these shitty little solenoid things that work for a few weeks and then get full of water, die in the sun and stop working.

And so I kind of got sick of that. And the first iteration of this problem was something like this. And this is a what's called a manifold. And then there's a few little solenoids and solenoids turn on and off to let water go. And I still remember showing Andy Carson this the first time. Once I've built this, I was so proud of it.

It was full of water when I opened the shed. And electricity and water don't mix too well. So yeah, take of that what you will say, do or any of this at your own risk. And now the problem, I suppose to zoom out of it, literally, this is the block that I live on and you can see we've got a front garden in the house and the back garden and the water to our property comes in from the front and now we have a back garden.

We really need to get water back and that's where obviously most of our garden will be so pretty important that we get that water back there. So my plan was to essentially add some sort of brain in the corner well away from the house because as I said, safety, water, electricity, water, electricity, sparks, fire. I would rather not burn down the house.

So I'll stop that round the back and then as I go, once I've got this brain, this will branch out into all of the different spots that I need some water. So and this looks like a lot of pipes, but I think this is actually an under estimation of what's currently in my garden. But one of the problems that I then realized I'd have to solve as well is that I have a brain working there.

You will see electricity. So as well as the blue water lines, I'd also need a red line for power and an orange line for data to be able to control it without having to worry about Wi-Fi. Also have a little wireless network going over to a friend's house down the street. So yeah, needed to get power to that back corner for whatever reason.

And this is a drone shot of the house now with is that affected in we'll go through this but the first step was to get that water back to the far right corner. And this is kind of the trench I dug to do that We had, you know, obviously with you put your pad in firstly cover it with concrete rocks and then you put your water down.

And that's what the blue pipe is, the water pipe going duck in the orange one is the power and the white one is just the waste water going back to the street. Then first COVID lockdown happened and that was a great chance to dig some trenches. Obviously, one of the problems that I had to solve was how do I get across the yard?

So this path gave me a great spot that would be protected to put some water pipes underneath and also some data and not data removal. My signal wire and also power for things like lights and also power solenoids filled that up. And then I realized I needed somewhere to put the brain. So I built a shed that I needed something to water.

So I built some gardens. They got really overgrown because we were covered, couldn't get to the property very often. And then why do they even need a water system as being super wet? So this kind of show is like the pipes that are going under the ground and a little like that. I kind of created a moats around these little garden beds.

This is another drone shot. So you can see from above the little pot sign to snake out into the garden. Bonus child on trampoline filled a lot and all that and paved up the path. And then I got to the problem, which is laziness. How do I make this system work without actually being there myself or having to, you know, turned on and off manually?

And that's where engineering efforts, the software engineering part comes in. And to do this things, they have a Raspberry Pi and I have several dum dum brains or satellites. I suppose I've changed words with that. In this talk they talk to relays using the sort of voltage that a microelectronic circuit can handle, which is about five volts. And then those relays kick it up a gear into 24 volts that can then be used to trigger a solenoid which then turns on the water.

And that's all part of the brain. This is what that looks like in a little box that has little Iraqis written on the front when it's closed and all that nice and sealed up and waterproof. But the port on the left is a relay board with these eight circuits. The one on the bottom is another relay board like that with another eight circuits, and then the Raspberry Pi basically runs rails and it also runs Sinatra and Rails is just because that's what I know how to use.

And Sinatra is also because it's Ruby. So I also know how to use that pretty well and out of the bottom of this box goes to those purple cables, which are just some Cat six that I had lying around after the extension, and they connect into little. I also made it really easy to connect up the the network cable I use to trigger solenoids because you could just use little wall plates and that makes it nice and modular and all of that goes out to the solenoids and essentially the wires allocated.

It's not a bomb, it's all fine. And yeah, that's, that's the, I suppose the laziness part of it taking care of which then leads me on to off to a watering and how do I go about making it so that all of this watering happens at just the right amount so I can now automatically trigger things through a Raspberry Pi, But I don't want to water certain zones.

More than that should be watered. You know, I just watched this movie June before I was told while I was watching this building, this system. So it's called Ruckus. And here you can see there's a series of zones. Each zone has these like manual watering buttons that you can see that just for a certain amount of time. But in the bottom right, you can see that each zone has an optimal duration.

So this is my guess at how long it should be on for. And then there's a watering frequency, which is how often should it be water? It should be water morning and day one and night, once a day, every second day every five days. And where that's parent zone. And what's the GPI report on the Raspberry Pi and the reason for that last section around parent zones is because at the moment I have them all combined together.

So the dumb server, the dumb brain and the Raspberry Pi are on the same physical. So the real set from the same physical Raspberry Pi, but in the future I'd love to make it so that I might have one in the front left corner of the house that was powered by a battery or a solar panel. And that means that I kind of want that to be as dumb as possible, use as little power as possible, because it has to work off the battery.

And yeah, I don't want that person to separate the concerns so that I can just change one spot to all of the logic And then the other one, it's just like, okay, I'll water. Sure. So on the raspberry Pi, I've got four different scripts that run to trigger these zones, and the first is basically to update first levels twice a day.

And that looks at the the frequency that I've set and essentially adds a first amount onto the zone. And it kind of remembers how thirsty it is. And when that first gets to one, that's when it kind of starts watering. And the reason for this is that I also want to eventually be able to and I have done this before with the previous iteration, but with the new iteration, one of the able to make it so that if it rains too much, it doesn't water.

If it's too hot, it will does more and basically be able to bury things based off, you know, external conditions. And there's a really great Web API called really weather that will let me do that. I just have to integrate it into this particular system. And then essentially the watering script basically goes through iterates through the zones when it gets to one and what is it for the duration that's been specified and sends that request?

Officer Sinatra And that triggers the solenoids. And you can see these are the little cron jobs that I have running on that Raspberry Pi to do those updates morning and night. There's also a special update one, and that's kind of cool a few weeks ago because this picture about the lawn that I've got in my place and I just had to level that and try and get this looking decent.

So I got a special job for this one, which essentially runs every few hours, every yeah, every 3 hours. And it just waters is for a short amount of time to keep that moist so that it will grow quickly. And this is that same one a couple of weeks later. So it's going really well, putting it all together.

This is what it looks like. But also this step is entirely unnecessary. This all happens automatically in the morning and evening. It just basically goes through and iterates through the zones. And it's got the benefit of that is that it doesn't run out of pressure, which is one of the problems with a deer that garden, you can't water the whole thing at once because of the physics.

You just can't get enough pressure through the pipes that you have. The other really good benefit of having this system set up is that I've got a few spare zones and over the weekend it was super hot. So I spoke to my youngest daughter and said, Why don't we use one of them and put some sprinklers over the trampoline?

So now we have a trampoline zone with some leftover sort of garden sprinklers being used and away it goes. And that's been a great thing. They spent like the whole day on that on the weekend. Oh, cool. Thank you for listening to my talk.