Step 4: Watering System
Background: The Relay box is integral to the automated watering system and is one of the more difficult parts of the project. The relay box consists of an outlet, two relays, and two diodes. We used two relays, one for each outlet, so that the outlets can be powered independently. In this way, one outlet can control the watering and the other could potentially control the heater or fan.
The 12 volt wall wart that will power the solenoid valve is connected to one of these outlets. Each outlet has corresponding relay wires that connect to the arduino.
Making the Relay Box:
120v wall plug (can be hacked from pretty much anything. This one was taken from some computer speakers.)
14 gauge wire
2 5 volt relays
4 small wires
Wire cutters/ Strippers
(optional) small LED light
1. First the relays had to be tested to see which pins went to what. Luckily the coil pins were marked so we only needed to test three pins. When the coil pins receive current from the arduino, the relay makes a clicky noise and allows power to flow through the other relay pins. We tested the power flow pins by linking each pin to the breadboard with a small LED light. The breadboard was linked to the Arduino to receive 5 volts power. You will need to solder small wires to the relay pins for use with a breadboard. Pin 3 on the relay is normally on when there is no power going to the relay coil. Pin 4 is only turned on when the relay coil is activated. Pin 1 is the power input that goes through the relay to pin 4 or pin 3.
2.Once we figured out which pin was what, we soldered wire connections to them. Pin 2 had a red wire soldered to it and Pin 5 had a black wire soldered to it. These are the wires that reach out of the box and are connected to the arduino. You could solder your diode right to the relay in this step, but we will be including the diode on the arduino board itself in the final project.
3.We soldered 14 gauge wire to pin 4 and pin 1 as these will be handling the 120 volts from the wall.
4. We stripped the wire from the 120v wall plug and isolated the return and power wires. The power wire from the plug (seen in white) was soldered to pin 1 of both relays.
5. The next thing to do is connect all of these wires to the outlets. Normally, these outlets come connected by a little piece of metal. All you have to do is take some pliers and rip off that small piece of metal to have them disconnected. You only need to do this on the side of the outlet connected to the relay power pins. The return connections do not need to be separated.
6. To connect the wires from the relays to the outlet all you have to do is put the wire underneath the screw terminal and screw downward. On one side you screw down the 14 gauge wires from pin 4 on each relay. On the other side you screw in the black 120v return wire from the wall plug chord.
7. Then we hot glued all of the solder joints (the screws and the relays) so that they would not electrify things they shouldn’t.
8. Then we set everything in the box so that it would fit. This involved using a hammer to bang out one of the perforated circles in the back of the box, snapping off the 4 side metal plates on the top and bottom of the outlet so it would fit, and hot gluing all the pieces into the box.
9. All that’s left is to screw the cover on and bam you are done!
Finishing touches/ things to consider:
- Its always a good idea to trouble shoot each step of the way. We stopped to check each of our solder connections so that we knew which one was acting up if something wasn’t working.
- Try to condense wires as much as possible.
- We are using an arduino clone to run the watering system. You could think ahead and put the clone inside the relay box to limit the outside connections.
- A switch on the outside of the box that powers on/off the entire system might be useful
- Garden update: The peas have flowered and produced little green beans!
You need to connect the valve to the relay box so that the valve will receive power and control the flow of the water. To do this you connect the valve to a 12 volt wall wart. The wall Wart can then be directly plugged in to the relay box.
1) cut the jack of the wall wart off with wire cutters
2) strip back the plastic to expose the red and black power and ground wires
3) Strip the black and red wire so that they can wrap through the holes in the valve solder terminals.
4) Solder the red wire to one of the terminals and the black wire to the other terminal.
5)Test to make sure it works
6) Hot glue the solder joints so that the electricity won’t electrify things it’s not supposed to.
7)Plug the wall wart into the relay box!