Recently I received a request to customize OpenSprinkler for a 12V DC external relay board. It turns out to be relatively easy to do. Since it may be useful for other folks, I am writing a post here to briefly describe the modifications. First of all, the relay board has built-in opto-couplers and flyback diodes. It is designed to work directly with microcontroller pins. This particular relay board I received is an active low type. This means normally the relay control pin is pulled high; when the control pin is set low by the microcontroller, the relay will be activated. So before you go ahead and make changes, make sure to find out the type of your relay board.
OpenSprinkler can run on 12V DC power supply without any modification. As long as you keep in mind the polarity, it should work right away. Even if you connect the power supply in the wrong direction, it shouldn’t cause any damage because there is a protecting diode D1 that prevents reverse polarity. The only modification I needed to do is to replace the triacs (used to drive AC solenoids) by NPN transistors. Any common NPN transistor is fine. For example, 2N3904. The remaining step is to connect the station wires to the corresponding relay control pins.
The way it works is that normally the shift register outputs low. So all NPN transistors are turned off, and the collectors are pulled high by the relay board. When a station is open, the shift register pin outputs high, turning on the corresponding NPN transistor, and driving its collector low (to ground). This in turn activates the relay. That’s it.
Here is a video showing the relay board in action. The OpenSprinkler running a self test that turns on each station for 3 seconds.
It is also possible to use the NPN transistors to directly drive the relays. However, in this case, you need to add an additional flyback diode (between the collector of the transistor and the +12V line). The flyback diode is important to protect the transistor under inductive load. To accommodate this, I am planning to add PCB holes for these diodes in the future, which will make it easy to solder these extra components.
Who made the 12V DC external relay board ?
You can get it on Amazon or eBay. Just search for ‘relay board’.
HI everybody,
i’m thinking to pursue the NPN + diode approach.
I bought a 2N3904 transistor but now I’d like to setup the right flyback circuit to protect it.
SHould I use diode+zener in parallel or only diode? Can you please tell me which exact diode use ?
thank you .
What in case the DC valve is one with latching type?