Directly, Puck.js might be able to power a very small relay (it'll provide 10mA per pin), but it's not such a good idea to drive anything inductive from it. You can get relay modules really cheap though: http://www.espruino.com/Relays
These have 1 or 2 relays, plus optical isolation - and look like they'd be perfect for what you want, and easy to wire up. You'd still need a biggish battery to power the solenoid, and you could just plug the relay into that as well.
There are other options too - for instance you could use a motor driver. They tend to be totally solid state, and you can get those on little modules with screw terminals for a few dollars too.
... but yes, it should be a pretty easy build. For the solenoid I guess you need to turn it on one way and off the other which means one more wire, but it's only 3 or 4 wires needed to the Puck (depending on the relay module), GND, power, and 2 signals.
It depends how long you have your sprinkler on for... I water the plants here with an Espruino and use a non-latching solenoid. With it on 4 times a day for 60 seconds, a smallish lead acid battery lasts for ages.
© Espruino, powered by microcosm.
Report a problem