How To - Cheap, DIY Arduino Irrigation Controller with MySensors

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
every one today I'm going to show you how to build a cheap that's probably around $15 arduino irrigation controller using light sensors hi this connected to my barrel home automation controller but it could easily be used with any other controller compatible with my sensors check out the video description for a link to get more info on which controllers are compatible anyway before I won't show the actual controller I want to do a quick demo of the irrigation controller working so here it is I'm just going to turn on a single zone here and there is a delay to allow the valves to hydraulically reset so once the delays satisfied you can see my irrigation controller my irrigation pops up here and then I can just turn it off again and immediately turn it off alright so enough of the demo let's go inside and take a look at the actual control okay so this is my irrigation controller here before I get started I just wanted to give a huge shout out and thank you to Jim or Bulldog Lowell as he's known on the my sensors for him without him this would not have been possible this is his project his idea basically I'm just making an instructional video how to do it Jim I really thank you for doing this for pioneering it ok so just a quick demo of how this works so you can see up here we have a status LCD screen so right now it's just system ready so it's showing me the date and time that synced over from my home automation controller and then it's saying when it last watered so I do have some options here obviously all this can be controlled by my home automation controller I can start my my irrigation with automation or I can start it manually as you saw either via app or the web interface or however else your controller can be controlled but I do have some I guess onboard functionality here as well with this button so when I press this button it's giving me the option to water individual zones and I can cycle through each of my zones here notice that these zones have names I can either name them in my Arduino code or they sink down from my home automation controller when I've settled on a zone that I want to water I just let it go or stop pressing the button and then it will start watering that zone so notice as soon as it started we have this LED here this is status LED so it's a slow pulsing flash when it's in a standby mode or a ready mode and then you'll see it you know this fast fast flash here when it's actually watering my it's kind of hard to tell right now I guess because my we're out in my yard but this is my third zone here and you can see the status LED on my relay is lit so I can control individual zones or all zones right from my controller here or using this button and I can also stop them so I just press this button once notice the irrigation is halted and then it says when it was last watered so that's just a quick demo let's go ahead and start building this so you can have one of your own okay so this step isn't necessary but I like to consider all my components to a PCB prototyping board here and some of these components like my pro meeting my radio I connect into this female breadboard canet header connector strip here so I just cut this down to size so then after I solder it in I could remove my radio if necessary place it with another if it goes bad or even a long-range radio same for my pro mini that way it just makes it a little bit more changeable if if I need to so I've just kind of prototyped out how I want this to look they're not soldered in yet but I've just kind of scoped it out on my board and then now I'm going to solder them in so it's not necessary you could just connect in the wires your DuPont cables to your radio and your Arduino and so on but I've done it this way to make everything a little bit more reliable and easier for me so now I'm just going to solder on my breadboard connector strips I like to put a little bit more so around here so I can solder my wires on a little bit easier so what I'm doing is just pressing down on the PCB here prototyping board as I'm soldering it so those pins from the connector strip stick through and are flush to the PCB board okay now what I'm going to do is I'm going to take some stripped out copper wire this is just from cat5 why that I had leftover and I'm going to solder it to my terminal mounts my PCB terminal mount here so that'll be from my ground my PCB to remote here that'll be from my ground in my five volt power now that I have my power and ground rails connected into my PCB board I'm going to solder in my 3.3 volt power so my radio requires 3.3 volt power and the rest of the circuit is going to use a 5 volt power so this is my 3.3 volt regulator here this tiny little thing they come in different models and sizes I just chose this one because most of my projects use these prototype PCB boards so I can solder directly to them and it makes it a little bit smaller and cheaper but if you have the bigger ones those will work as well then I'm going to need two capacitors so this guy up here is a 10uf capacitor and the polarity is important so this white strip that you see here is going to be your ground side and then the other will be your power side and then this guy over here is the point one uf capacitor and the polarity doesn't matter so I'm going to go ahead and connect those in to my PCB board now so here's a wiring diagram of how this is going to be hooked up so you see I have the 3.3 volt regulator here with the end the ground and the out and then I the capacitors that will be connected into that as well - that'll just help filter out the power so the top pin on this little board or this little regulator here is the V in now I need to connect the 1uf capacitor to the V in on the voltage regulator and ground so this is what it looks like here and I'll just solder it in next I'm going to take my 10uf capacitor and connect it to ground making sure I check the white stripe for the the ground side and then the V out of the 3.3 voltage regulator then finally I'm going to take a piece of cap v wire with the shielding still on and I'm going to solder it to the ground on the regulator and the ground on my PCB so what I always like to do at this stage is test to make sure everything's working correctly I found that this small voltage regulator I've often missed soldered something or missed a joint so I always test at this stage just to make sure it's correct so I don't have to debug further down the road so first I'm just going to test my five volt power which looks good and then next I will test my three point three regulator output here which also looks good so we're ready to move ahead okay so next I'm just going to trim down the legs of my capacitors here and on the output of my 3.3 regulator I just bent the leg down so I can use that to connect in my three point three power general I don't like to do this just because if I ever need to remove that capacitor for any reason gets a little bit more difficult but if I do use the leg what I'll make sure I do is just leave a space so I can always clip it to remove the capacitor later on so that's just me personally and how I do it so now I'm just going to clip off the wires okay am I ready to start wiring up a radio so I'm not going to go over the specifics of wiring up the radio I've already done that in my my sensors gateway video that I made but I will just point out that this white square here is pin number one and that's going to be your ground pin then it counts up to three four five six seven eight so you can reference my video and also the my sensor site for where those wires need to go and I'm just gonna quickly wire those up now okay so I'm finished wiring up the radio into the pro mini here so next I just need to wire up power so I'm going to go to my raw pin with my five volt and then my ground pin so I'm just going to a directly off of the five volt here and then the ground here okay so next we're going to connect a button that will be used to manually run all zones so I'm going to use this button here any push button will work though and I can never remember which way the button works with these pins so I'm just going to connect it to my multimeter here and then test it so what I want to see is just zero not four zero so right now these two sides are connected permanently here so then how I'm going to wire these is across like this and then when I push it should see four zeros just like that okay so these are the two sides that I need to connect in so this is where I'm going to place my button on my PCB board here and one side is going to get connected to ground which it just so happens that my ground wire extends out to that pin there and then the other side is going to get connected into pin 3/4 and interrupt so pin 3 on the pro mini so here's a little trick that I do when I'm wiring into the PCB board on the other side sometimes I can switch up the pins and make mistake on which one I'm connecting into on my pro mini so what I'll do often times is just put a piece of wire or some sort of marker on the pin that I want to connect to so next to it then I'll flip it over and then I'll be able to tell exactly which pin I need to solder into so that's just a little trick of how I do that because I've often made mistakes and soldering to the wrong pins okay so now that my button is wired up to ground and to my pin 3 on my Arduino I'm going to put in a status LED so I'm just going to use a green LED and a 270 ohm resistor so the polarity of the resistor doesn't matter but the LED does so the short leg is going to connect into your ground and the longer leg is going to connect into your power which will come from pin 5 so I'm going to connect the short leg directly into my ground wire here and then I'm going to connect the resistor to my power leg of my Arduino or the positive of the sorry of the LED and then I'm going to take that to pin 5 on my Arduino so the next thing I'm going to do is I'm going to wire in my shift register so I'm using the SN 74 HC 5 9 5 n shift register from Texas Instruments so if you get the same one you can follow along with my pin outs here but if you're going to get a different shift register just make sure you check the datasheet for what you need to connect to where so how these shift registers work is it starts at pin 1 2 3 4 5 6 7 8 9 10 11 all the way up to 16 so that's the pin order and then what we're going to do with this particular shift register is we're going to connect pin 8 to ground as well as pin 13 we're going to connect pin 10 and 16 to 5 volt power our latch pin is going to be pin 12 on the shift register that's going to connect into pin 8 on the Arduino and then our clock pin is pin 11 on the shift register and pin 4 on the Arduino and our data pin is pin 14 on a shift register and pin 7 on the Arduino so if you're following along with me we'll connect all the wires up ok so first I'm just going to wire in my shift register to my prototyping board here I just had to use my wire strippers to hold this shift register in place well I get the first pin soldered in now that I have the first one soldered in I can set it by holding it with my fingers here and then just pushing it all the way through so now that it's all the way through I can go ahead and solder the remaining 15 pins so I want to make sure I have enough solder on there so I can connect in my network wires or my cat5 wires so if I have any of them too don't have enough I can just go back and do that again okay so this is my first ground connection here I highly recommend you use some markers on this I've already thoroughly confused myself with this wiring and I'm only just beginning so make sure you count out the pins double-check yourself so you don't miss wire right here so what I'm first doing is connecting pin 8 and 13 or ground and then I'll connect into my ground on my PCB so now I'm going to do pin 16 and 10 for my 5 volt power ok now we're going to connect pin 11 on the shift register to pin 4 on the Arduino ok so now I'm going to put the data pin which is pin 14 on the shift register into pin 7 on the Arduino then I'm going to put the latch pin which is pin 12 on the shift register in the pin 8 on the pro mini ok so I have everything wired up except for the DuPont cables that are going to plug into my relay so I'm going to connect I only have 5 relays so I'm going to connect my first DuPont cable into pin 15 and then second third fourth fifth so my relays are going to be pretty close to this PCB here so I just cut some 20 centimeter DuPont cables in half and then I'm just going to slide them through the hole with the corresponding shift register location and then I will just solder it right into the shift register pin there okay so I've wired in my DuPont cables for my 5 zones and as you can see it'd be very easy to add zone just wire in another DuPont cable and then you just add another zone in the Arduino code which I'll show you how to do later okay so I just need to get some power to my relay so I'm going to pull power from the board here my raw which is my 5 volts coming from over here and then ground so I'll just wire in two more DuPont cables here it will supply my relay with power so now I need a place to connect in my 24 volt power for my irrigation valves and then that will go through my relays so I'm going to use this three piece terminal block here I'm just going to put two grounds so one is going to be a ground input from my transformer and then a ground output and then the other is going to be the input the 24 volt input to my relays so I'm just going to connect it into this PCB board here I'm just going to cut it off so that I can mount it to a board or something like that so I've found its easiest to drill out these holes a little bit sometimes that the terminal block posts don't fit through so I just drill them out a little bit and then it will slide through fairly easily so I'm going to go cut this and drill them out so here it is just drill the holes through so I could fit the posts and then cut it and drilled some additional so I can mount it to my board or whatever I end up using so I'm just going to solder my grounds together here with some 18 gauge copper wire because this is an irrigation controller all these relays we use the same power source so I pre bent a wire here that I'm going to solder to the backside of these relays so if I wanted to like a daisy chain all these together just by wiring in and screwing down a wire to each of these relays here but I think it's going to little look a little bit cleaner to solder this wire on the bottom and then all have to do is screw it in my valve wires to each of these separate relays so what I'm going to do is solder it to this pin over here so it'll be normally open what that means is when this relay is off there will be no power going to the valve in my case so I'm going to connect it to these two or to this far one here and then we'll wire in our valve wire to this one so I'm going to go ahead and solder it now so here it is all soldered up just one wire this is where the source wire will connect into and that is connected to each of the relays here okay now I'm ready to solder in my 24 volt lining in my relay from my PCB board here so I just got some hot glue to temporarily hold this together while I saw these two parts two wires together so I like to test as often as I can while I'm building so I can make sure that everything is running correctly how it should and if there are any errors I can resolve them sooner rather than later so what I'm going to do now is upload the code even though we're not fully ready I'm just going to be able to test my relays with what I've built so far so to do this we need the FTDI USB to serial adapter so this is the model I have here I'm not exactly sure what the number is but basically what you'll do is plug in your USB cord here and then your DuPont cables on the other side and then you just want to have these pins corresponding with the pro mini pins here so basically I have the how I know the ones that I need to connect is the TX and rx so it's just a straight shot for me into the connections here and then I'll just plug it into the TX and rx side of the pro mini it's hard to see the direct here so yours may be slightly different definitely definitely consult your data sheet because you want to make sure that these are correct and then you can plug it into your computer and upload the code which I will show you now alright before we upload the code I want to show you a couple things that you may want to change but first what you'll need to do is download the new liquid-crystal library from this bitbucket link here in the code so just click on that download it and then drag the folder into your libraries folder or your Arduino install alright so next let's talk about some changes that you may want to make so first there is the number of valves so obviously just type in the number of valves that you have here valve reads that time if you want to adjust that I just left it at 7.5 seconds or 7,500 milliseconds here but if you want to adjust that at all you can basically this is just the time delay between each valve activating so when one turns off it will delay 7.5 seconds and the next will turn on next we have radio ID so if you want to change your ID you can assign a manual one year or just set it to all caps auto and then that will assign one for you next we have debug so if you're not going to use debugging just comment this out and then it won't put out any comments to your serial monitor and it also won't take up as much memory on your Arduino so basically when you're all finished testing you're going to want to comment that out and we upload your code next we have the pin mode here so if you're going to use the internal pull-up resistor and not put it on an external one you're going to want to use this line of code if you're going to use an external one you can use this one here below that we have the interrupt so if you're not using a pro mini like I am you may need to change your interrupt here so the pro mini we're using one interrupt one and that's pin three so if you changed your pin at all you're going to need to change your interrupt here okay and lastly one thing that I forgot to mention up here is you may need to change this line here so if your relays use active high you'll just want to comment out this line and then it will use active high for your release okay so that's it now we can upload our code so what you want to do is go to tools choose your board so in my case it's going to be the pro mini I'm going to choose my processor I'm using the 5 volt 16 megahertz and then my port so I don't have it plugged into my computer right now for this this code demonstration but you just want to choose the appropriate port that pops up when you plug it in your computer once you have the those options selected you just like the upload button here is arrow and uploads the code to your Arduino okay so now that we've uploaded our code we're ready to add it to our controller in my case I'm using a Vera I'll show you how to do that in just a second but first I just wanted to show you how I wired it up with power so I'm just using an old USB cable that I cut up and then put on some DuPont connectors too and then some cat5 to our connector here so make sure that your polarity is correct you know your positive and negative goes in the right way and then all you'll need to do is plug in that USB cord to a cell phone charger or computer whatever supplies you know the USB power five volts okay so let's move on to adding it to our Vera okay so here's the plug-in in my Vera so what I'll do is I'll click start and then now it's looking for devices and then I just plug in my USB cable to five volt power and then it will go through and find the devices so in my case here I should see seven devices so I'm going to see my my node and then the six devices one will be the run all and then the five individual zones so now it's done so I can play press stop and then if I scroll up you'll see that my Vera is reloading here okay so now when we go to the devices tab we'll see these are our seven devices that were created so now I'm just going to unplug my device one more time and then I'll plug it back in and that'll sink itself back into Vera and we'll start populating these notes notice that the information here is populated okay if you don't see it you can always reload your Vera and also do a control f5 on your browser and if things aren't looking correct those are the things that I do and I usually resolves it you can also just unplug your node or your device one more time plug it back in so I can refresh everything but it looks like mine came up correctly here the next thing we're going to want to do is set up our variables so to set our variables we'll click on the wrench here we'll go to the Advanced tab scroll down and then we should see three variables so I've already set mine up here but I'll show you what they mean here so a variable one is the time this zone will run if I use the all zones button so there's this device the all zones so if I turn that on it's going to step through each of my zones and it's going to use the time from variable one okay variable two is if I run this zone individually so if I were to run this back garden zone individually it run for 18 minutes now I have these set both the same for now but eventually I'm going to set up some automation with play to update these based on weather conditions lastly we have variable three this variable is what will display on your LCD well its watering and also while you're selecting an individual zone to run the menu button if you want you can put a name for your zone in here just keep in mind you're limited by 16 characters because that's all the LCD can display so that's it don't forget to save and then we're ready to start testing okay so we are finally ready to test so I've just wired up some LEDs here to simulate my irrigation valves and then I've wired in power so this is the USB power that I was talking about earlier that's powering my Arduino and radio and other parts here so I just pulled five volts off of that and wired it into my relays here so remember this was going to be my ground over here and then this is my will be 24 volt power but now it's just 5 volt power and then I have wires coming out from each of these this is where my valves will connect into and it's just connecting in my breadboard which will then power the LEDs in between these LEDs I have a resistor here so I don't overload them and then this just goes back to my ground here ok so this is just going to simulate my valves being pressed now this like I just said this isn't the final product we're going to put an LED in here our starting LCD so we can actually see status on a screen but I just want to test this first to make sure all this is working correctly before I throw another part in there ok so I'm going to do is I'm going to plug this into my computer USB so notice my Arduino is powering up here and what it's doing now is it's syncing the data from my Vera now you can also connect in your USB to serial adapter here and you can use this serial monitor to see updates from the my sensors plug in to your node here so it'll show you what's going on ok so now I cheat a little bit I've already plugged this in and tested it because I hate doing things live I guess but anyway what just happened is my light just started flashing and you'll notice one of my my first zone turned on so I've already done a little bit of debugging here but I wanted you to show you this basically what's happening is my button here this button will water all zones it's it's thinking it's being pressed so i've debugged and i figured out with the help of Jim Bulldog Lowell from the forum that I need an actual 10k resistor wired in to my Arduino so I need to put in a 10k resistor here instead of using the onboard Arduino internal pull-up resistor to stop that switch from looking like it's been turned on okay so I know that I need to fix that which I'll do in a minute here but I'm just going to turn off all of my zones by pressing that button so it's in turn on or turn off and then I can still go through and I can test my wiring so I can go into my vera and I can turn on each individual zone if I want to now notice that started flashing so we have a seven second delay which is configurable in the code basically that allows your valves time to reset themselves so you'll notice that started flashing in seven seconds later my LED turned on if I turn it off or turn another one on it will turn off my first valve and then pause for seven seconds before it turns on my other one so now I'm just going to turn on valve three here notice it immediately turned off valve two this is still flashing and then in seven seconds valve three should turn on which it did so I've gone through I've tested all mine all my connections look good with the exception of that I need add that external pull up but go ahead and test yours if you want otherwise you can just keep proceeding on a test wall at the end but I highly recommend testing at each stage whenever you can which I've done here okay so this is where I'm going to put my resistor here it's a 10k resistor and what it needs to be wired to is the five volt power so I'm just going to use the VCC of my Arduino which is happens this is a 5 volt Arduino so it's going to connect into the VCC and then into the button pin right over here so you remember that this is our ground both of these are ground on our button and then over here we have a spare pin which is where I'm going to wire this resistor and then this other side over here goes to pin 3 on our Arduino ok so basically we're going to wire resistor between 5 volts and pin 3 on our Arduino and then the button when you press that it's going to ground it out which it will read as a button press so that's how the pull-up resistor works so hopefully that makes sense if not just do a quick search online for pulp resistors and they have wiring diagrams how to connect them all but basically I usually use the internal pull-up resistor on the Arduino but this one isn't powerful enough so that's why we're using the external resistor here so I'm going to go ahead and wire that up now ok so I wired in my pull-up resistor here so now I'm going to connect it into my 5 volt power again so notice my Arduino is lit up here and then if you can see it just barely flash and down here is the onboard led so that's downloading the data from vero right now when it's finished this LED will start slow flashing there okay so it's finished downloading all the data notice my zones didn't start up so that resistor has helped with my button and the button will still work here when I press it notice we've got the fast flashing indicating that it's starting a cycle and then after the seven seconds my first zone will light up ok so next we're going to start wiring up our LCD so the LCD we're using is the 1602 a basically that means there's 16 characters and 2 rows and we're going to be using the i2c protocol so I hope that you don't make this same mistake as me this is my first LCD that I've worked with on a project and I read the description on eBay and they said this LCD came with the I key I to see protocol but in fact it didn't it was missing this adapter here so they must have copied and pasted a description from some other store but make sure you check to make sure you're getting this adapter here because this will enable you to use the i2c protocol so I'm going to go ahead and solder this in now okay so I've got my i2c adapter soldered in here next I need to connect it to my Arduino so my ground and VCC are obviously going to go to ground and 5 volt power and then the SDA connection and the SCL connection are going to go into analog pin 4 & 5 so SDA is going to go to analog pin 4 and SC l is going to go to analog pin 5 so my lcd is going to be connected right in here so I'm just going to wire the power in underneath my PCB board here and then these will just solder directly to my large we know now that my lcd connections are all wired up I'm going to power up my Arduino ok so the first thing it's going to do is sync the time from Vera and it's going to update all the valve times here you can see the status is flashing ok so now it is powered up and ready to go notice our light is pulsing here just like it was before and now our status LCD saying the system is ready the date and time and when we last watered so that's it our LCD is fully functioning and are ready to go on to the next step alright so here's my finished product here at least for now I just screwed it into a board here temporarily because I need to get my irrigation up and running so I just added some labels and obviously screwed it to the board here and then I will attach my 24 volt power near and ground and then obviously all my valves will go in here so now I can just mount it up to my wall attach my cables and then my irrigation is ready to go ok so here is my irrigation controller mounted to my wall just want to show you what the finished product look like here's the the wiring going over to my valves and then I have a it's not currently plugged in but my transformer here that will supply power that's plugged in right here and that will supply power to my valves so that's it congratulations on your build hope you enjoyed it once again thank you so much Jim for making this possible if you have any questions or comments feel free to post them in the the YouTube comments here but if you need faster response probably best to go to the my sensor site there's a lot of very knowledgeable and helpful people over there who can definitely give you a hand if you run into any issues thanks everyone
Info
Channel: Pete B
Views: 943,875
Rating: 4.9110074 out of 5
Keywords: Irrigation (Industry), Do It Yourself (Hobby), How-to (Website Category), Controller, Arduino (Brand), wireless, water, Home Automation, smart home, home, automation, Vera, MySensors, Irrigation controller
Id: l4GPRTsuHkI
Channel Id: undefined
Length: 35min 33sec (2133 seconds)
Published: Sun Jun 07 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.