wireless sprinker system control

Okay, I've been reading and searching for a while. I finally settled on using an arduino for my project. Sounds like a great microcontroller with wide support. I have some basic electronics experience many, many moons ago with a fair amount of embedded systems coding. Which means I'm basically a software guy jumping into hardware land. So if I make a wrong turn, please whack me on the head as needed.

I currently have an 8-zone system, of which 7 are in use. I thought it would be fun to create a wireless sprinkler controller and maybe control the garage door in the future; especially with wireless being used. But for now, the sprinkler is my focus.

This is what I'm looking at for the base controller: YourDuino328 - http://arduino-direct.com/sunshop/index.php?l=product_detail&p=5 8-Channel Opto-Isolated Relay Board - http://arduino-direct.com/sunshop/index.php?l=product_detail&p=156 DHT11 Humidity and Temperature Sensor - http://arduino-direct.com/sunshop/index.php?l=product_detail&p=162 XBee Shield - http://www.sparkfun.com/products/9976 XBee 2mW Wire Antenna; Series 2 - http://www.sparkfun.com/products/10414 Replaced with an RF24L01+ module for $5.50, including S&H. 2 each - ardurino 6 and 8 pin headers for the xbee shield to allow for stacking

I can drive the relays on the board directly off of the durino's outs. I would also like to measure temp/humidity but am expecting I need some additional components. Please give a nod otherwise point me as needed. With the exception of the xbee shield's 6/8-pin headers and the DHT11, I'm expecting everything to be plug and go. Correct? I'm also thinking an onboard RTC w/alarm would be nice.

If there is a more appropriate *durino board I should be looking at, please make that known. I've not purchased anything at this time.

For the PC side: XBee USB Explorer Dongle - http://www.sparkfun.com/products/9819 XBee 2mW Wire Antenna; Series 2 - http://www.sparkfun.com/products/10414 Replaced with an RF24L01+ module for $5.50, including S&H.

I'm assuming this is enough to allow me to plug the xbee into the usb module and communicate with it as a usb/serial port on the pc side.

I'd really like to run this project on the existing controller's transformer, which would cut down on the number of wall warts. I've already found mention of a couple of options here via search. Which basically means 26vac -> 5v with the 25vac also being used through the relays for the solenoids. I expect to operate no more than two solenoids (I think there might be a master) at one time and one is very likely. Efficiency is somewhat important to me here. I'll continue to read the results I find but feedback is more than welcome. If there is a split pigtail, reasonably priced circuit or product I can buy, please provide a link.

So there it is, please critique, correct, nudge, and whack, as needed.

Also, if you guys can point me at an expensive, appropriately watt'd soldiering iron, that would be great. I have two and can't find either one. You can guess why I bought the second one. ;)

finding a relay that has a 5 volt coil and 24VDC terminals will be an interesting thing, in and of itself.

Remember when switching relays and solenoids, you need a diode across the coils.

All mouser has in the way of 5VDC coils with 5-10A @ 28 or more VDC were PCB mounts. You might have better luck looking for yourself. (I use mouser because they’re 1 mile from my house)

A solenoid will probably pull 2 or 3 continuous amps on start, and 500mA or so continuous holding. So you’ll want a relay with minimum 5A @ 28VDC on the contacts. (This value is important, because not all contacts are created alike)

magnethead794: finding a relay that has a 5 volt coil and 24VDC terminals will be an interesting thing, in and of itself.

Does it need to exactly match? I read the switching rating was just the upper limit. That's one of the reasons why I went with that relay board as I found other accounts of people using them on sprinkler solenoids and wall sockets. If you zoom in on the relays in the various pictures, they provide multiple ratings depending on the voltage. The higher the voltage the lower the amps. Seems to make sense - to me. Seems like those would be easily capable. Are they not?

magnethead794: Remember when switching relays and solenoids, you need a diode across the coils.

Its part of the relay board already. Its also an optically isolated relay, which I thought would be given the nature of the use. All of the relays on the board can be on/off'd directly from the arduino's outs while the isolation protects the ardunio.

Sorry, I totally missed the link to the relay board.

I believe everything would be correct.

The only reason I try to stay within 5% of ratings, is because if you undervolt a coil, it may not have a significant enough magnetic field to close the contacts. Additionally, if you put more current through the contacts than rated for, you have the possibilty of melting/burning out the contacts. I have caught pushbutton switches on fire this was before.

I appreciate your feedback.

Thanks.

All the commercial sprinkler systems I've seen use TRIACs instead of relays. Sorry, don't have a part number for ya.

As for a soldering iron, if you're looking at moderately cheap, get the sparkfun station. It's a chinese knockoff of a Hakko. If you want a good one, look at an actual Hakko; LadyAda carries a basic unit.

-j

kg4wsv: As for a soldering iron, if you're looking at moderately cheap, get the sparkfun station. It's a chinese knockoff of a Hakko. If you want a good one, look at an actual Hakko; LadyAda carries a basic unit.

I assume you mean this unit. Seems to have been well received. Thanks.

That's it. I actually got mine from Circuit Specialists, but I'll bet they all come off the same line and get a different label slapped on.

One of my favorite "brands" for this thing I saw on ebay: Quakko.

-j

XBee Shield - http://www.sparkfun.com/products/9976 XBee 2mW Wire Antenna; Series 2 - http://www.sparkfun.com/products/10414

If you only have 2 XBees, how are you going to form a network?

Series 2 radios are much more difficult to configure and use than series 1 (point to point) models. With just two radios, point to point is all that is required, so the series 1 radios are more appropriate. Which is great because they are a lot easier to configure and use.

PaulS:

XBee Shield - http://www.sparkfun.com/products/9976
XBee 2mW Wire Antenna; Series 2 - http://www.sparkfun.com/products/10414

If you only have 2 XBees, how are you going to form a network?

Series 2 radios are much more difficult to configure and use than series 1 (point to point) models. With just two radios, point to point is all that is required, so the series 1 radios are more appropriate. Which is great because they are a lot easier to configure and use.

Good question. My intention is for the controller to be remotely accessible from a PC which is why I only have two; making it point to point. I didn’t buy the Xbees. I did buy an LCD display with switches as a stop gap. As I continued to read and learn, I’m now looking at nRF24L01P+'s for my radios. Cost is dramatically reduced (two for ~$12 delivered to the door) and I believe simplified all the way around. The xbees seem needlessly complex, tedious, and overkill for my project. Not to mention, the radios I’m looking at have 5v tolerant I/Os. So I think all I need is a crystal. I imagine I’ll be asking some questions when I actually get to that point; especially on the USB <-> nRF24L01P+ interface for the pc.

So scratch the xbees. I still plan on adding an RTC and nRF24L01P+ to the arduino. Once I have that, I plan to create the USB <-> RF modem interface. On the PC side, I expect I’ll be coding in python and use pyserial for the actual interface. I might even make a full blown turbogears web interface to allow for more complex scheduling, which gets pushed to the controller via RF link.

I gatta say, I’m getting pretty excited about my project.

For power: I used a big ol 24V transformer in my AC unit to power my web enabled thermostats for my home. When these are rectified and filtered they put out about 37V DC that has to be regulated to 5V somehow. I used a really cool device http://www.dimensionengineering.com/de-swadj.htm. I have two of these and they have both been working really well for several months. This saved me a lot of money and time searching for a transformer. There are other options on that site as well. You can then use the same AC voltage through the relays to run the solenoids.

Regarding XBees, if you are going to be doing other stuff via wireless control, such as monitoring the soil moisture in various spots, flipping on a light for yard accents, and so forth, the XBee is probably the better choice. Sure, they are more complicated, but are they really more complicated than tuning, writing your own retry code, testing range yourself, addressing and such? PaulS and I disagree on the complexity of Series 2. Once you get two of them working (took me a week the first time and 12 minutes the second) adding another one is about 45 seconds of work. I even built a remote temperature sender in around 45 minutes from the ground up using one of these and a few other parts. Don't bother with a shield for these, contrary to what you hear and read, they can be hooked directly to the darn Arduino if you use the low power models. You can use a cheap adapter board like the https://www.adafruit.com/products/126 if you want to use the high power devices. The low power ones have a surprising range outside using the wire antenna. Inside, not so good, so you might need a third one to relay; that is incredibly easy also. And, you can get three of the low power ones for the price of one high power one (depending of course on where you buy it)

I might suggest that you use an arduino as the controller and web enable it. The reason is that you will not have to have a computer hooked up and working all the time. A little arduino controller is fun to build and can have timers (using timeAlarm library) that do things for you. This way you can put it on the web and watch the sprinklers from Paris while you're on vacation. But this is a decision you can make at any time. You can also put the timers in the sprinkler arduino, but you would have more programming in it then.

Take a look at my blog draythomp.blogspot.com to see how I control my thermostats, measure the power in the house, control the swimming pool and such using XBees, Arduinos and such. The thermostat tab is where I did something similar with 24V control, ethernet boards and relays. My project is ongoing and will be until I get too old to hold the soldering iron.

draythomp:
For power: I used a big ol 24V transformer in my AC unit to power my web enabled thermostats for my home. When these are rectified and filtered they put out about 37V DC that has to be regulated to 5V somehow. I used a really cool device
http://www.dimensionengineering.com/de-swadj.htm. I have two of these and they have both been working really well for several months. This saved me a lot of money and time searching for a transformer. There are other options on that site as well. You can then use the same AC voltage through the relays to run the solenoids.

Regarding XBees, if you are going to be doing other stuff via wireless control, such as monitoring the soil moisture in various spots, flipping on a light for yard accents, and so forth, the XBee is probably the better choice. Sure, they are more complicated, but are they really more complicated than tuning, writing your own retry code, testing range yourself, addressing and such? PaulS and I disagree on the complexity of Series 2. Once you get two of them working (took me a week the first time and 12 minutes the second) adding another one is about 45 seconds of work. I even built a remote temperature sender in around 45 minutes from the ground up using one of these and a few other parts. Don’t bother with a shield for these, contrary to what you hear and read, they can be hooked directly to the darn Arduino if you use the low power models. You can use a cheap adapter board like the https://www.adafruit.com/products/126 if you want to use the high power devices. The low power ones have a surprising range outside using the wire antenna. Inside, not so good, so you might need a third one to relay; that is incredibly easy also. And, you can get three of the low power ones for the price of one high power one (depending of course on where you buy it)

I might suggest that you use an arduino as the controller and web enable it. The reason is that you will not have to have a computer hooked up and working all the time. A little arduino controller is fun to build and can have timers (using timeAlarm library) that do things for you. This way you can put it on the web and watch the sprinklers from Paris while you’re on vacation. But this is a decision you can make at any time. You can also put the timers in the sprinkler arduino, but you would have more programming in it then.

Take a look at my blog draythomp.blogspot.com to see how I control my thermostats, measure the power in the house, control the swimming pool and such using XBees, Arduinos and such. The thermostat tab is where I did something similar with 24V control, ethernet boards and relays. My project is ongoing and will be until I get too old to hold the soldering iron.

The reason I’m leaning toward the nRF24L01+ is because it takes care of retries and confirmed reception, and even supports a transactional mode (request, reply) with automatically reception acknowledgements. I should also mention I have vast experience writing protocols so they don’t especially worry me. Furthermore, its has a nice span of bandwidth, ranging from 250Kbs (and longer range that the other data rates) to 2Mbs. Plus, it automatically handles packetization and has nice hardware FIFOs. Not to mention multiple pipelines for multiple local addresses (which they call multiceiver); which also means its ready for a nice mix of point to point and multi-point (with failover and some coding) operations. Given its meager price, builtin capabilities, 5v I/O tolerance, and two libraries (large and small), the xbee stuff just doesn’t look appealing to me. And if range is an issue, models with external antenna are available. You’re getting most of what attracts people to the xbees for a fraction of the cost. But who knows, I may regret it once I get down the road. We’ll see. Seriously, check out the linked spec sheet; though I expect its not attractive given you’ve already invested in xbee.

The reason I want an RTC on board is so it can reliable operate autonomously. I don’t see a reason to push a web server into the controller. It only needs to know when to wake up, start, and stop, plus a little checking for moisture levels (I plan on making my own sensor hanging off of an analog input for that). The connectivity to the PC means you get enhanced functionality without physical presence. Regardless, even with the PC turned off, since I have an LCD interface on it, it will be fully functional and fully autonomous. In fact, in typing this up, I probably won’t go the web route at all, rather, just write a wxpython application to manage it. And with a working USB interface, I can probably hang the other radio off of my router (plus a proxy RF <-> IP) since its available all the time anyways. But honestly not sure I’ll go that far.

I very much appreciate the links for the regulators. I already have a transformer to run the solenoids and arduino buts its 26v IIRC. So I need something to push it down to 5v. I only need something like 1a total, which again IIRC, is what the transformer provides. I think the solenoids (will confirm) only pull between 300ma - 500ma, leaving 500ma - 700ma for the arduino and my relay board. Which brings me full circle, the trick will be splitting the power and regulating it down to 5v for the arduino.

Aside from that, I’ll definitely check out your blog. You’ve got a lot of information there so I’m be combing through it a couple of times.

Thanks for your information and comments. I’m enjoying the exchange. Very much appreciated. Now if only I had my hardware in hard…

P.S. I’ve bookmarked your blog.

I see what you mean about the Nordic device. Nice little radio, can't see I blame you for wanting to use it. The one from sparkfun that is on a breakout board is 19.95 and I pay 20.21 for an XBee so the price difference is not worth worrying about. Both of them would be fun to play with.

I originally didn't intend to hook up to the internet. My mind was changed one day when I forgot to turn off the pool motor before I left the house. That problem is now solved. Plus it is so cool to pull out the cell phone and show off how I can turn the temperature down or up in the house from a couple of thousand miles away. Doesn't help impress the girls at the bar though; they still want the guy with the Mercedes. The reason for the central arduino that controls everything is that I wanted to play with an Arduino 2560 and have a bunch of blinking LEDs, LCD Display, and such to just set and stare at. (OK, maybe I'm being too honest here).

Each of my thermostats is autonomous as far as setbacks and such, but greater control is more easily accomplished by having something else control them. So the central box does that. I got tired of walking from one to the other programming stuff in for them to do. Plus, I ran out of memory on the darn things a couple of times. The pool controller is a simple translation device from the idiotic pool control protocol to something more reasonable (in my mind). Fine grain control of the pool is part of the central controller. For example I turn the light on at 8PM for an hour to attract bugs that the bats fly around and catch. This makes it fun to set on the patio watching the bats dive, skim across the water and then bank away from the side. Ah, the joys of rural living.

Real Time Clocks are just way cool. I went with a slightly different method simply because I could. It was fun figuring out how to use a GPS module (that had an RTC inside it) to get and broadcast the time. Now I can sample the time anywhere around the house, yard, barn, cactus patch or that pack rat den over there. Silly I know, but it is fun.

As you can tell, my system is a hodgepodge of different technology and techniques. Very little was originally designed to operate together and much of it was invented along the way. Way Cool. In my mind, this is a fun thing to do and experiment with. A smoking voltage divider is a lesson in Ohms law, not a failure.

But, I am soooo going to get one of those relay boards. I could hook an XBee to it and control.......sigh.

draythomp: I see what you mean about the Nordic device. Nice little radio, can't see I blame you for wanting to use it. The one from sparkfun that is on a breakout board is 19.95 and I pay 20.21 for an XBee so the price difference is not worth worrying about. Both of them would be fun to play with.

If you check ebay, you can find them about 1/4 the price, or less, than what you can get at sparkfun. I'm sure I'll be buying some stuff from them very soon, but it won't be their RF modules.

draythomp: But, I am soooo going to get one of those relay boards. I could hook an XBee to it and control.......sigh.

XD

Ya, my eyes lit up when I found those relay boards.

draythomp: For power: I used a big ol 24V transformer in my AC unit to power my web enabled thermostats for my home. When these are rectified and filtered they put out about 37V DC that has to be regulated to 5V somehow. I used a really cool device http://www.dimensionengineering.com/de-swadj.htm. I have two of these and they have both been working really well for several months. This saved me a lot of money and time searching for a transformer. There are other options on that site as well. You can then use the same AC voltage through the relays to run the solenoids.

The more I learn about the doing this part of the project, the more I appreciate a device such as the de-swadj. But as you point out, after rectification, it will be cranking out 36-38VDC. The de-swadj is limited at 30volts. That's a 6-8 volt (20%-27%) overage. Eeeek. I checked all of their spec sheets. The only one I found which can handle more is the SWADJHV. It will allow for up to 60VDC input. The problem is, its $25.00 + S/H, with no data sheet, for a single component, making it one of the most expensive, and undocumented parts, of my build. That doesn't sit well.

Which brings me full circle, what are you using for a pre-regulator to bring your input inline with what the regulator can safely use? Or are you just running with it until it dies a premature death? $15 + shipping seems pretty expensive to just bide time waiting for a component to give up its smoke. Accordingly, I'm really hoping you've got better news for me. And honestly, $15 is the upper threshold of what I'd be well to purchase for a solution. After that, it makes far more sense, for my project goals, to simply go back to step one and craft a more traditional solution.

Lastly, what are you using for your rectifier? You make it with some properly rated diodes or use a rectifier IC?

Thanks for the information.

P.S. My initial order of radios (nRF24L01+), arduino, relay board, etc., has arrived. I'm pretty thrilled. Already created a driver from my temp/humidity sensor (DHT11). I actually modified a driver for the DHT22 and extended its public interface with additional conversions for F, K, and dew point.

I'm sorry, I screwed up. I DID use the SWADJHV (I actually went and checked it just now). I forgot that I switched to that one when I had rectified the voltage and saw how much it was. Yep, it was 25 bucks and I had to get two of the darn things. However, finding power somewhere, and somehow getting it through the wall to the thermostat was a bit daunting when I already had the 24 volt supply for the old thermostat right where I needed it, so the cost was the lesser factor. I actually dropped them a note and asked if the other one would work on rectified 24v and they suspected it would for a few hours and then go up in smoke. They did suggest that I could use a resistor to drop the input down to 27 or so, but I didn't want another heat source inside a thermostat.

I used diodes, they were rated around 600V at an amp, I arranged them in a bridge and used a cap on the output of the regulator just in case. I used the same diodes across the relays to suppress spikes, I got them surplus somewhere in a hundred lot and have been using them for years for various things.

So, another idea for you. There are a ton of little 5V supplies out there for less than 3 bucks designed for powering an iPad. I have a bunch of these around the house doing various things. However, they won't run your sprinkler solenoids so a little relay like the ones you already have is the perfect solution to that problem. I forgot about these devices because I got all caught up in the 24v transformer solution I already did once. The iPad supplies have a two prong plug on one end and USB on the other. They are reasonably easy to open if you want to just solder wires inside and run them out. Or, of course, you can scavenge and USB cable or grab a plug off something that you aren't using anymore. Some of the supplies have removable plugs that you can plug a regular laptop cord into and make it easy to get AC power into it. This is the kind of thing I have used. Notice how the wall plug part comes off? They say they'll supply regulated 5V @ 2A and I know for a fact they will do 1.5 amp reliably. I've seen them for as little as 2 bucks on ebay. That's the price range where I stock up on them.

One thing to watch out for though, some of the USB cables won't handle over 500ma of current. I've fallen into this trap a couple of times using these little supplies, so a couple of wires is not a bad solution.

The wall wart solution is not even close to elegant as the SWADJHV device, but it is cheap and works really well for me.

I'm really sorry I screwed up on the regulator, it sometimes gets confusing when you're working from memory on some of these projects. I'm glad you caught my mistake.

I have some wall warts which will serve the purpose until I can get a more unified solution. I need to power my AVR (5-9VDC) + relays (5VDC) + solenoid (26VAC) and keep them isolated from each other. For now, obviously three wall warts will do that. Ideally, I'd like to have the single wall wart powering everything. I'm planning on placing a fusible link (1A, guessing $0.30 each) on the solenoid side of things given the solenoids are in a wet, hostile yard environment.

The LM2675 switching regulator is what I'm currently looking at. It appears they can be had for $5-$12. I'm still trying to nail down a price and supplier. But that's not an all inclusive solution like the SWADJHV. A small number of extra components are still needed with the LM2675. But it does provide for 90% efficiency for my rectified 37VDC to 5VDC. Since the HV doesn't have a spec sheet, I have no idea how efficient it is. I'd guess it to be 85%-92% efficient, based on what I've seen in its class. But again, wild speculation is just that.

Comments and feedback welcome on the LM2675 as my solution.

I also have a question about load. My current wall wart which powers my solenoids is rated for 1A. If I power something like the LM2675 off of that, and I'm pulling 250mA (not actual numbers) on the AVR+relay board, does that mean I'm roughly loading 275mA at the wall wart after loss through the regulator?

Based on the data sheet, your number of 275ma looks about right. However, the inductor and capacitors to filter the output and the other circuitry involved will put you close to 17 dollars or so. You might drop the swadjhv folks a line to see if they'll send you a data sheet. They were real nice to me and 4 diodes, a regulator and a capacitor is hard to argue with when you can just turn a screw and set the voltage to whatever you want. The relays will probably work off any reasonable Vin you choose. However, this eliminates the fun of developing a power supply of your own. I would probably go for a home grown power supply regardless of the time it took to work out the details simply because it's fun. Heck, I spent a month decoding a silly protocol simply because I thought I could, so I may not be the best person to comment.

draythomp: Based on the data sheet, your number of 275ma looks about right. However, the inductor and capacitors to filter the output and the other circuitry involved will put you close to 17 dollars or so. You might drop the swadjhv folks a line to see if they'll send you a data sheet. They were real nice to me and 4 diodes, a regulator and a capacitor is hard to argue with when you can just turn a screw and set the voltage to whatever you want. The relays will probably work off any reasonable Vin you choose. However, this eliminates the fun of developing a power supply of your own. I would probably go for a home grown power supply regardless of the time it took to work out the details simply because it's fun. Heck, I spent a month decoding a silly protocol simply because I thought I could, so I may not be the best person to comment.

I was afraid of that. I hadn't finished pricing everything.

But, I think I found some serious competition for the SWADJ. While its not adjustable, its 1/3 the price. Once I found the LM2675, I did some more searching and that device turned up. Seems I'm following the same path as those before me. This device accepts up to 40VDC. Which makes it a perfect fit. I even found mention of it on the Arduino forums. So I'd need that plus, maybe, a cap, if that? Delivered to the door, it looks like the total will be roughly $12.00.

Holy carp! That is an absolutely great find!! That device will solve a bunch of problems for people; I hope they notice this thread. I didn't run across it when I was looking for a solution and it would have been perfect in my situation. I may get a couple and replace my other ones so I can use the variable voltage on some other project when the need arises. Now, get a big ol' filter cap for the output and you should be in perfect shape.

I would use a filter cap though, and even a couple would be best. One small value to filter out the switching frequency and one large one for the usual ripple and stuff. Of course, I have those things laying around from over buying on other projects. Over time I may reach the point other people here have reached; being able to build a project from left over stuff. Not there yet though.