Introduction: Arduino Controlled Plant Watering System and Custom AC Receptacles Outlets
This is a project to create an automatic plant watering system and an AC receptacles Outlet that you can controlled using any microcontroller. In my example a Ruggeduino is used but this is essentially an Arduino Uno.
The circuit I used is not uncommon, many examples in the internet will show you how to wire a relay circuit.
The basic of the project is use a microcontroller digital output to supply 5V into the coil of an AC relay.
A relay for those who are not familiar is a device that has contact that can close or open based on the current flowing in a coil in the relay.
A picture of a relay is included.
This custom AC Outlet will be used to drive a water pump that will be turn on or off based on the soil moisture level.
Materials you need for the relay shields and moisture sensor:
1. Typical household AC outlet. I use a single outlet, you can use double outlet.
2. A box that this outlet usually go to. I am not sure exactly what they are called but your hardware store electrical section will sell this about 25 cents.
3. The cover for the single/double outlet.
4. A SPDT relay. Mine is a general purpose with p/n Z2560-ND G5LA-14 DC5 Omron. I bought it from Digikey.
Pay attention to make sure your relay contacts are rated for A120VAC operation and can carry high enough current (amps) to operate whatever you will plug into this customized outlet.
5. A diode. Part number 1N4148. Again from Digikey.
6. A used AC power cord cable from old device/equipment that you don't need anymore.
7. A couple small terminal blocks, not required but nice to have it.
8. Some heat shrink tubing.
9. A couple transistors (NPN 2N3904)
10. 2 metallic screw drivers
11. Some wires
12. Old milk or juice plastic container.
13. A water pump. I use an old indoor water pump.
14. Some plastic tubing and converter if the plastic tube does not go into the pump outlet just right.
Total cost ($5.00-$10.00).
Tools you need :
1. Soldering iron
2. Wire snipper
3. Helping hands
Step 1: Cut Your AC Cord
The wiring is fairly simple in the AC outlet side.
Basically you take the the cables from your unused equipment. There will be 2 wires. It does not matter which one you cut but pick one. You will make it so that the path on that one wire is broken and insert the relay normally open contacts in the middle of the path so that no current can open under normal condition.
You will need to verify with your own relay to find out which pin is the normally open contact.
In the picture I am showing you, I have used the normally open contact which means it will close when current is applied to the coil from the Arduino/microcontroller circuitry.
I will show you another schematic in the next step on how to get the microcontroller circuit ready but you may want to wire this first.
You should end up with 2 wires going out from this custom AC outlet to your microcontroller circuit. Wiring it this way will keep the AC custom outlet simple and can be driven by anything according to your circuit design.
Step 2: Wiring Into Your Relay
I used terminal blocks because I want to be able to change the wiring to use the normally close contact in the future. I think it also reduce stress on the pins on the relay itself.
Anyway, you can do this part many ways. You can put the relay on a PCB board and solder or wire them.
You can also just use heat shrink tube to make the connections.
The important rule here is to make sure you remember you provide enough isolation between the relay contacts as you don't want them to touch each other when the box is moved dropped by accident.
That is it, you can put everything back in the blue box now.
This conclude the AC outlet section. Next is the circuitry in the microcontroller side.
Step 3: Wire the Other Components for Relay Shields and Soil Moisture Sensor.
Again I create the schematic using Fritzing so you can ignore the pin number on the components. Use the pin number according to the part number of your equipment that you have.
I also included a simple soil moisture circuit (I think I followed an instruction from MAKE Magazine).
Anyway, the .ino file for the Arduino is also included for you to use. You can change the timing and everything.
I have labeled the variable in the beginning so it is clear what you need to change.
The relay shields essentially use digital pin 11. It turns High when a certain condition is met. In this example it is based on the voltage reading in pin A0.
Pin A0 itself is a reading of voltage based on the soil moisture level.
I put some time delay before the pump starts and and only turn on the pump for a few seconds at a time. I want to make sure the water is absorbed by the soil before watering begin again.
Step 4: Setting Up Water Container and Soil Probes
Cut the old milk container partly open so you can drop the old water fountain pump in there and the tubing.
Fill it with water.
Create the 2 soil moisture probes using old screws-bolts/nails. Some say this will oxidize over time. I just started, I'll find out how long this will last. Screws are cheap and I have tons of them from used equipment anyway.