Circuit to control sprinkler system with Arduino - Page 1
Forum section: electronics / beginners

author: BuzzB
author_rank: Contributor
timestamp: June 17, 2015, 02:16:15 am
content: I designed this little circuit so I can control my lawn sprinklers with an Arduino YUN.I would love any feedback.I'm using the original 24v AC wall wart from the original brain.I am using a Riorand DC-DC buck converter to get DC voltage to the Arduino and logic circuits.I am using some shift registers to cut down on the Arduino pins I need.I am using Vishay VO2223 opto-coupled triacs to energize the sprinkler valves.I'm using a YUN so I can build a web interface to program and monitor the sprinkler system.Thanks in advance,Buzz

author: uChip
author_rank: Contributor
timestamp: June 17, 2015, 02:59:15 am
content: - Put a 10 to 47uF cap on the output of the Buck converter.- Put 100nF bypass caps on each of the shift registers.- Make sure the voltage drop through the LED and the opto-isolator are sufficiently below 5V so that you get enough current (10mA) through the resistor. Note that at 10mA there will be a 1.5V drop across the resistor. Alternatively, add more resistors and put LED+R and opto+R in parallel.- Make sure that the sum of all LED/opto currents when all valves on does not exceed max output current of the shift register.- Verify that each valve does not need more than 900mA.- Upon assembly if hand wired or layout if PCB make sure that AC_HOT and AC_COMMON will carry the combined current of all the valves.- Are ARD-EXT and SHFT-EXT intended for expansion? Do you need ground references on those connectors? How about AC_HOT or AC_COMMON?Good luck with your project!- Chip

author: flynwill
author_rank: Regular Contributor
timestamp: June 17, 2015, 03:46:59 am
content: There's no real need for optically isolated triacs (and little point since the same 24VAC is running the valves anyway).I would recommend adding a "dead man" circuit attached to the reset line on your shift register so that should the Arduino crash the valves will turn off.

author: BuzzB
author_rank: Contributor
timestamp: June 17, 2015, 04:15:53 am
content: I hadn't thought of that. It is a great idea... It would not be good if a sprinkler got stuck on in the case of an arduino crash.

author: BuzzB
author_rank: Contributor
timestamp: June 17, 2015, 04:25:39 am
content: Quote from: uChip on June 17, 2015, 02:59:15 amI was wondering if I should add more capacitance to the output of the buck converter. How did you arrive at those values? Rule of thumb? Experience?Also on the sift registers... Do logic ICs always need bypass caps?Quote from: uChip on June 17, 2015, 02:59:15 amThe wall wart rating is only high enough to allow for one sprinkler to be on at a time (plus a little left over for my "brain". So I think I am going to have to be careful with my code. I know my commercial sprinkler brain also only allowed one sprinkler head to be on at a time.Quote from: uChip on June 17, 2015, 02:59:15 amAwesome catch. Definitely going to add pins for +5 and gnd on the expansion headers.Quote from: uChip on June 17, 2015, 02:59:15 amThanks for the tips!Buzz

author: BuzzB
author_rank: Contributor
timestamp: June 17, 2015, 04:35:15 am
content: Quote from: flynwill on June 17, 2015, 03:46:59 amNothing obvious came up in a google search. Any chance you know of a link that could get me started on such a circuit?Thanks,Buzz

author: Skimask
author_rank: Super Contributor
timestamp: June 17, 2015, 05:17:34 am
content: Watchdog circuit, maybe something as simple as a 555 timer.Set up a 555 as a one-shot, the output remains high (or low) for a given duration, and keeps the shift register enabled. For grins, say the duration is 10 seconds.The Arduino keeps on pulsing and resetting the 555 so the output remains high (or low) for less than that same given duration, again, for grins, say the duration is 5 seconds.If the Arduino crashes, it won't keep resetting the 555 timer output. 555 timer output goes low (or high) and resets the shift register (within that given duration of 5 or 10 seconds), the valves turn off.

author: Richard Head
author_rank: Frequent Contributor
timestamp: June 17, 2015, 07:03:03 am
content: With some luck Calexanian will comment. From what I remember he designs and manufactures irrigation controllers.

author: jdraughn
author_rank: Regular Contributor
timestamp: June 17, 2015, 07:08:14 am
content: Just thought I would add that when I did a similar circuit, I added this 433MHz remote/receiver.http://www.banggood.com/4-Channel-Wireless-RF-Remote-Control-Transmitter-Receiver-Module-p-912951.htmlThe whole reason I created mine was because I planted grass seed and I needed the sprinklers to come on very often to keep the ground damp. I slowly increased the period as the grass germinated. The remote is nice when your out working in the yard and need to adjust or fix sprinklers.

author: Hideki
author_rank: Frequent Contributor
timestamp: June 17, 2015, 08:19:15 am
content: You have put junctions EVERYWHERE! Please don't do that. The proper way to draw a schematic in Eagle is to draw lines using Net and not using Wire. Provided you start and end at the right place, the Net will connect to the component, and junctions will automatically be placed only where they are needed -- where 3 or 4 lines meet. A single line connecting to a component pin should never have a junction.

author: Kappes Buur
author_rank: Regular Contributor
timestamp: June 17, 2015, 08:27:24 am
content: Even though it is 'only' 24VAC, I still would have placed the fuse into the ACHOT line.

author: flynwill
author_rank: Regular Contributor
timestamp: June 17, 2015, 02:12:54 pm
content: "watchdog timer" is probably the better goggle search. My search came up with this TI part near the top:http://www.ti.com/lit/ds/symlink/ucc2946-q1.pdfwhich also includes powerup/down supervision. There are are also lots of schemes using resettable one-shots (either 555 or other). The best requires that the micro toggle a pin every few milliseconds, which usually means at least two one-shots in the circuit. If the micro pin is an I/O pin add a pullup resistor so that it is guaranteed to go high if the crash leaves the pin in input mode.I'll also second the recommendation for an RF remote. I have that for my own system (which is based on an X-10 controller) and it's a tremendous help when you are out fixing broken nozzles or split drip lines.

author: uChip
author_rank: Contributor
timestamp: June 17, 2015, 03:15:52 pm
content: - Capacitance on the supply is rule of thumb. How much current is being switched between all valves off and one valve actively on? Compare that current requirement to the current capability of the supply. Apply I=C*dV/dt. Then SWAG.- Yes. All digital components need bypass capacitors. Again, rule of thumb, but a good one.- I agree with putting fuse or polyfuse on AC in.- You can go overboard with the watchdog. There's one already in the ATmega so you could potentially use that. The SRs you are using don't have a separate reset input so you might need to change to one that does. Another situation to consider is what happens on power up. What state do the SRs power up in? If they happen to power up with 5 valves on will that be a problem for the time it takes the Yun to get through the bootloader? Does there need to be something that ensures the system powers on with all valves off? (again, a SR with reset?)- Just my opinion, but I think that a Yun is overkill and expensive for this application. There are newer cheaper solutions available now (but maybe you already have the Yun).- A sprinkler controller typically needs a real-time clock. Is there one on the Yun? Are you planning to get time from the network? What happens when the network isn't available? Software RTC? I would add an RTC chip and occasionally sync that to the network.- Chip

author: kingofkya
author_rank: Regular Contributor
timestamp: June 17, 2015, 08:58:15 pm
content: Not to ruin your fun but...http://rayshobby.net/opensprinkler/

author: BuzzB
author_rank: Contributor
timestamp: June 18, 2015, 01:56:28 am
content: Quote from: kingofkya on June 17, 2015, 08:58:15 pmYeah... no where near as much fun.Thanks though. I might check out that schematic.- Buzz

author: BuzzB
author_rank: Contributor
timestamp: June 18, 2015, 02:17:42 am
content: Quote from: uChip on June 17, 2015, 03:15:52 pmNot sure what my I, C, dV and dt are here.The microcontroller is isolated from the sprinkler valves via the opto coupled triac. Now, I can see that at the moment a valve turns on, the AC supply will have the "steady state" demand of the buck converter (which is, in turn, powering the micro and logic) PLUS the new demand of the valve. Presumably the additional capacitance at the output of the buck converter will provide some reserves at at the moment of valve turn on. Is that right?So when a valve turns on it initially draws about 600ma at 24 volts AC,and then settles down to about 300ma. I don't know how long that take, but presumably dt is related to the time it take for the valve to start drawing current.Does this all mean that dV is 24 volts? And I is 600ma? and dt is how long it takes the valve to ramp up to drawing that much current?Sorry for the dumb questions.- Buzz

author: uChip
author_rank: Contributor
timestamp: June 18, 2015, 03:24:14 am
content: The cap should be on the output of the DC-DC converter so you don't have to worry about the current on the AC side of the triac. On the DC side, when you go from all off to one valve on, there is current flow through the LED(s) that wasn't there before. It's not much in this case (about 10mA). There will also be some additional current flow when you clock the SR as it draws more current when switching states. Again, it won't be much. This increase in current flow (I) causes a drop in voltage (dV) for a period of time (dt) before the power supply can catch up. So to buffer these instantaneous current demands (to minimize the voltage drop) you put a small cap at the chip and a larger cap for the overall circuit. The bigger the cap (C) the less the voltage will drop (dv) (within limits: for very large C other parasitic factors will overwhelm the beneficial effect).Originally I was thinking that multiple valves (LEDs) could be on at the same time so the switching currents could be greater. Still a cap of 10 uF wouldn't hurt. Also, the switching supply will generate noise (ripple) on the DC line. The caps will help ensure that the ripple does not feed into the SRs. You might be able to get away without either caps in this instance because currents are small and there might be (should be) a cap in the DC-DC converter, but why take the chance? You want to build a robust system. The caps will help it be more so.- Chip