Wow, cool stuff! The power requirements for you “kit” is:
Solenoid = 24VAC @ 350MA max
Water flow sensor = 5V @ 15ma
Opto-coupled relay to control solenoid = 3.3V/5V
Spark Core, 5V (USB) at 350ma max
You could use a 120VAC to 24VAC step-down transformer to power the solenoid and use a 24VAC to 5VDC or 120VAC to 5VDC converter for the rest of the hardware.
The solenoid would controlled through a opto-isolated relay. There are breakout that will work at 3.3V (on/off voltage) while the relay itself is powered by 5V. That means you can drive the relay from a pin on the Spark. The water flow sensor only works at 5V but the digital inputs on the Spark are 5V tolerant so you could connect it directly without level shifting.
You can power the 5V stuff with a simple 120VAC USB charger cube and the 24VAC transformer for the solenoid.
I’m planning a very similar thing, a cloud-connected garden controller. The cloud part would give me charts of the soil moisture and let me set thresholds and timings for the irrigation system. If it comes out good, I plan on putting it on GitHub.
I’m also a software guy, who’s venturing into hardware thanks to the Arduino first and now the Core.
I already have a 230VAC to 24VAC 750mA transformer for the solenoid valves. I could use yet another power rail, adding a 5V cell phone switching PSU to power the Core, but I was wondering if it wouldn’t be nicer to power it from the 24VAC.
Do you have any links for that?
At first I was thinking of using a 3:1, 24V~ to 8V~ transformer (rated for the Spark’s 300mA peak consumption), then a rectifier bridge, a large capacitor to smooth the wave, and then a LM7805 with its two smaller capacitors.
But I’m having trouble finding the transformer and I’m not too confident about winding it myself, without blowing up stuff.
Assuming that the GND coming out from that converter is actually the AC wave zero-point (I’m not sure how to ascertain it, but it should be so) then I should be able to use a TRIAC to switch the same 24VAC to the solenoid valves, right? Possibly with a transistor before the triac gate, in case it needs more current than an output pin can supply.
Is that right? If I can do that, it would spare me a few relays.
@tobia, using a triac to control your AC (inductive) relay will mean that you will have to use a snubber circuit to protect from inductive kickback. You may want to consider an opto-isolated relay module. That way you don’t have to worry about isolation or kickback.
I operate a small farm where we have 7 valves with the furthest valve being around 2000 feet away from the central controller–all of the valve solenoids are 24VAC. I’d love to experiment with a system just like this. Is there any way to communicate with the Spark Core over the same 2 wires that supply the 24VAC to the solenoids (kind of like powerline ethernet)? I’ve thought about using hardware from someone like Ubiquity Networks to supply wireless to each valve station but not sure that is practical as long as I have to physically trench the 24VAC lines anyway (I do not want to use DC solenoids). My flow meter is the following and has a reed switch register which I think the Spark can read?
We currently use a Weathermatic Smartline controller with 8 zones total. There is an independent set of wires going to each valve from the central controller ( old standard) but they are becoming faulty due to age. Our controller can be upgraded to a 2 wire system where each valve is connected to the same pair of wires and you can add 99 valves but each valve station requires an expensive decoder at each valve box. Spark Core would be a cooler solution. We have Wifi at the central controller and there is pretty good line of site from the central controller to each valve. I still have to physically run 24VAC to each valve so being able to hard wire the Spark Core would be awesome.