Computer-controlled sprinkler system

Thread Starter

EliRibble

Joined Jun 11, 2012
6
I bought a new house. The house had a nice sprinkler system but someone had cut out the sprinkler controller. I thought this would be a great chance for me to move from my mostly software-based experience into the electronics world. I think I've made some bad decisions and I could use some help getting this all glued together.

The sprinkler valves are Rainbirds and take 24VAC. I got a transformer from Amazon that is actually a Rainbird replacement, works great.

I ordered this relay board. Basically it's 16 Songle SRD-24VDC-SL-C relays with some LEDs, diodes and nice connectors.

That was my first bad mistake - I didn't realize I was buying relays that are powered by 24VDC rather than capable of switching 24VAC. Turns out most relays will easily handle 120VAC (wall power, duh) and so 24VAC is no problem. If I had it to do over again I'd get relays powered by 5VDC.

Next I ordered a board for connecting to my computer over USB. I went with Phidgets 0/16/16 board because, while expensive, they have really good software support and I figured I'd trade a little money for time after hearing horror stories from coworkers trying to get software working for this sort of thing.

The Phidgets board is ridiculously easy to program, especially in Python on Ubuntu. Sadly, the board is a low-end switch, which I'd never even heard of until I plugged it in and started poking the pins with my voltmeter. For those who were uninitiates, like me, it means that I can set the output pin to one of two states: open or ground. Not ground or 5V like I thought.

My original idea was to just straight wire my output pins from the Phidgets board to the relay board control lines. This doesn't work - the relays expect a high voltage control signal, not to be pulled to ground.

So my question now is what is the best thing to do to translate from ground to a 5V signal? I've been toying with the idea of using a simple 74HC14, a Hex Inverter IC, so that I feed the IC my ground and it gives me 5V. This means I am supplying 5V to the IC and a separate 24V power line to the relay board. But, it's too easy. I'm worried about the IC melting since I'm not sure how much current the relay needs on the control pin.

I've been trying to sort out if there's a simple way to turn a NPN or PNP transistor into what I need. Also, I may try soldering in a similar Songle relay that uses 5V as the power so that a single power supply can power the inverter IC (if I use it) and the relay board.

So, to summarize:

1 - What's the best way to convert 16 output pins that do ground/high impedence (low-side switching) into 5V/ground or 5V/high impdence switches (high-side switching)?
1b - Would a hex inverter IC work? If so, which is the best one to use?
2 - Should I be able to swap out the Songle SRD-24VDC-SL-C for a SRD-5VDC-SL-C on the relay board I've bought?
3 - What would you have done for this project to avoid all the pain and expense?
 

mcasale

Joined Jul 18, 2011
210
1 - What's the best way to convert 16 output pins that do ground/high impedance (low-side switching) into 5V/ground or 5V/high impedance switches (high-side switching)?
*** You imply here that the line from your control board is open-collector. True?
*** If not, just reverse the sense of the logic from the MPU.
*** If so, you can use an inverter like the 7414 family,
*** but you need to put a pull-up resistor (10K) on each input.
***
1b - Would a hex inverter IC work? If so, which is the best one to use?
*** See above. There are also octal inverters.
***
2 - Should I be able to swap out the Songle SRD-24VDC-SL-C for a SRD-5VDC-SL-C on the relay board I've bought?
*** I suppose, but it might be easier to
*** rectify your 24VAC to make a 24VDC supply.
*** It depends on the total AC load on the transformer.
*** Or you can get a wall-wart for 24VDC.
***
3 - What would you have done for this project to avoid all the pain and expense?
*** Water my lawn by hand,
*** or not at all. Good luck
***
 

Thread Starter

EliRibble

Joined Jun 11, 2012
6
You imply here that the line from your control board is open-collector. True?
I've just google open-collector, having not heard the term before. I believe that, yes, it IS open collector. When you say that I should use a pull-up resistor are you referring to something like the attached?

Should I be able to swap out the Songle SRD-24VDC-SL-C for a SRD-5VDC-SL-C on the relay board I've bought?
I suppose, but it might be easier to rectify your 24VAC to make a 24VDC supply.
I've been googling some for rectifiers, and it seems like it's a pretty large field (ie, anything from automotive, to hydroelectric plants to zener diodes). Where would you recommend I look for a rectifier I could add to to my circuit? Perhaps some search terms that would narrow the field? I've found a bit about bridge rectifiers, but I'm starting to think it'd be easier for me to build my own using some diodes I have and a capacitor.
 

Attachments

mcasale

Joined Jul 18, 2011
210
Your schematic is correct. It is not good to let inputs float.

Depending on your transformer, the attached circuit may help. It is a half-wave rectifier. It only passes current to the capacitor and load during half of the AC cycle.

This also gives you more than 24VDC. Can the relay coils withstand 34V? The voltage will depend on how many relays are actuated at the same time. 34V will be the maximum no-load voltage.

If this doesn't work, you may need full-wave rectification, and maybe even some voltage regulation. You should be able to find a lot about this online.

The other option is the wall-wart (much easier).
 

Attachments

mcgyvr

Joined Oct 15, 2009
5,394
It is far easier to just buy a 24VDC power supply.
That relay has a maximum voltage 28.8VDC (120% max)
rectifying the AC is not sufficient.
 

crutschow

Joined Mar 14, 2008
34,280
The Phidgets board output will handle 2A @ 30VDC so it has more than enough capability to drive your relays directly. Just connect one side of the relay coil to the Phidgets output and the other side of the coil to +24VDC.
 

Thread Starter

EliRibble

Joined Jun 11, 2012
6
Thanks everyone. I was trying to avoid another wall wart because I currently have one 24VAC wall wart that I'm switching for the sprinkler valves, one 5V wall wart I was contemplating to power the hex inverters (maybe I should just use the USB's 5V line) and was hoping I could rectify the 24VAC so that this project was just down to the one wall wart.

It looks like doing a second wall-wart for the 24VDC would be the easiest and safest method. I'll order one and post updates as I get things built.

@mcasale Thanks for the schematic review
 

crutschow

Joined Mar 14, 2008
34,280
Thanks everyone. I was trying to avoid another wall wart because I currently have one 24VAC wall wart that I'm switching for the sprinkler valves, one 5V wall wart I was contemplating to power the hex inverters (maybe I should just use the USB's 5V line) and was hoping I could rectify the 24VAC so that this project was just down to the one wall wart.

It looks like doing a second wall-wart for the 24VDC would be the easiest and safest method. I'll order one and post updates as I get things built.

@mcasale Thanks for the schematic review
As per my previous post, you don't need the hex inverters. Just control the relays directly from the Phidgets board.
 

Thread Starter

EliRibble

Joined Jun 11, 2012
6
As per my previous post, you don't need the hex inverters. Just control the relays directly from the Phidgets board.
I'm not sure how you mean. If the relays were not already fixed in a board I would understand how to do this, but I think there are diodes on the board that would prevent this from working in a straightforward fashion. Are you thinking of connecting the Phidgets output pins to each of the control pins on the relay board and the +24VDC to the ground pin that the relays share in common? Or are you talking about me soldering wires on to intermediate points on the board?
 

crutschow

Joined Mar 14, 2008
34,280
I'm not sure how you mean. If the relays were not already fixed in a board I would understand how to do this, but I think there are diodes on the board that would prevent this from working in a straightforward fashion. Are you thinking of connecting the Phidgets output pins to each of the control pins on the relay board and the +24VDC to the ground pin that the relays share in common? Or are you talking about me soldering wires on to intermediate points on the board?
My mistake.:p I didn't look closely at the relay board circuit to realize the relay coils already had transistor drivers.

But you can still use the Phidgets output to control the relay. Just add a 38kΩ resistor from each Phidgets output to the +24V supply. That will give an output high signal of 5V to turn on the relay when the Phidgets output transistor is OFF, and ≈0V for a logic low when the Phidgets output transistor is ON. No extra logic circuits or 5V supply needed.

But note that, depending upon how the Phidgets logic is defined, you need to put the output in a OFF (output transistor off) state to turn the relays ON. But that should just be a matter of inverting the control program software logic.

It's probably easier just to buy another wallwart for the 24VDC then to try to rectify the 24VAC and regulate it (since rectifying 24VAC gives about 33VDC). Just make sure the wallwart is the type with a built in regulator.
 

wayneh

Joined Sep 9, 2010
17,496
A laptop power supply brick is about 20V and provides a lot of efficient, regulated current in a cheap package. Better than a wall wart, IMHO.
 

Thread Starter

EliRibble

Joined Jun 11, 2012
6
I wonder if a $25 USB Bit Whacker board may have been a better choice for the controller for this system?
Holy. Crapola. That would have been way better. Couple that with a 5V relay board I found on amazon

http://www.amazon.com/gp/product/B0057OC5WK/ref=oh_details_o00_s00_i01

and this whole project would have been less than half what I paid for it.


But you can still use the Phidgets output to control the relay. Just add a 38kΩ resistor from each Phidgets output to the +24V supply. That will give an output high signal of 5V to turn on the relay when the Phidgets output transistor is OFF, and ≈0V for a logic low when the Phidgets output transistor is ON. No extra logic circuits or 5V supply needed.
This is a pretty neat idea - I'm glad you posted this one. The only problem I see with it right now is that if I understand how this works correctly, when the I/O pin is low the relay will be engaged. I want the sprinklers to be off in the case of a power outtage, which means that I want them on the normally-open connection of the relay. I'm not sure if the computer controlling the I/O pins goes off if that would mean that the relays would engage or not. I think I'd have to do some testing, but my guess would be that yes, with the computer off but the 24V wall-wart on I'd have the relays engaged.
 

crutschow

Joined Mar 14, 2008
34,280
........................
This is a pretty neat idea - I'm glad you posted this one. The only problem I see with it right now is that if I understand how this works correctly, when the I/O pin is low the relay will be engaged. I want the sprinklers to be off in the case of a power outtage, which means that I want them on the normally-open connection of the relay. I'm not sure if the computer controlling the I/O pins goes off if that would mean that the relays would engage or not. I think I'd have to do some testing, but my guess would be that yes, with the computer off but the 24V wall-wart on I'd have the relays engaged.
Good point about power outage. If the relays energize when the computer is off but power on (which they likely will do), then just use the NC relay contacts to control the sprinkler valve. That means you de-energize the relay (Phidgets output ON) to turn on the sprinkler.

When the power is off, of course, it doesn't matter what position the relay contacts are. ;)
 

Thread Starter

EliRibble

Joined Jun 11, 2012
6
When the power is off, of course, it doesn't matter what position the relay contacts are.
Lol. Excellent point. Thanks.

I may integrate a switch in the whole thing just so that I can be a little more comfortable when plugging it all in together.
 
Top