In this instructable we are building a home irrigation system based on an arduino uno. I know there are tons of similiar projects / tutorials already floating the web, but maybe I did something different and you can pick up an idea or two.
Step 1: Gathering the Tools
You will need:
1 x Arduino Uno (or an atmega328 chip and a programmer)
1 x 10kOhm resistor
1 x 20kOhm resistor (or any other number resistor that you can put in series)
1 x ULN2803a (or MOSFETS + diodes)
1 x TM1637 Display
2 x Hygrometer sensors
2 x pumps (something like these)
1 x momentary push button
1 x relay board
1 x 2 pole terminal
sockets (optional, but highly recommended to be able to easily reprogram the atmega chip if needed)
depending whether you use an arduino or an atmega:
1 x 16 Mhz crystal
2 x 22pF capacitors
1 x 10 µF capacitor
1 x 1N4001 diode
hook up wire
breadboard or perfboard
power supplies (5V or more, and one power supply for your pumps)
You will need basic equipment like:
Step 2: The Schematics
You can see the wiring and schematics both for the atmega328 standalone version and the wiring for using an arduino uno. Since the project is supposed to run on its own after it’s finished I don’t need any of the arduino functionalities and just use the bare chip. You can either use the chip from the arduino or refer to this video to see how you can use your arduino as programmer for another chip.
As you can see I have a GND and 5V rail on either site of my perfboard, all the GND and 5V connections in the schematic refer to these, therefore the filter cap is only drawn once.
Have a look here to see the pin mapping of the atmega chip compared to the arduino.
If you are going to solder everything on a PCB, make sure to use your digital multimeter to check all connections and to make sure all power rails are powered with 5V. If you are going to use a power supply with more than 5V, add appropriate voltage regulators (7805 e.g.). I again would recommend soldering a socket to the board instead of the chip directly, so you can easily take it out again for reprogramming as you are doing the fine tuning for your setup.
Other than that, you should be able to recreate the wiring from the schematics.
I used a ULN2803A module because the output pins of the atmega (and therefore probably from the arduino, too) do not supply enough current to switch the relay. My relay requires around 60mA, but the pins of the atmega are not to exceed around 40mA. Also I read that you shouldn’t switch inductive loads like relays directly anyway. The module protects the chip from any damage. I was advised that this module creates a voltage drop, so if your relay can’t be powered with less than 5V, use MOSFETs and flyback diodes accordingly.
Step 3: Wiring the Relay and Pumps
WARNING: I do not know which pumps or power supplies you are using. When wiring up the relay, make sure to disconnect everything from power before you start cutting / connecting any cables. You may be working with mains voltage. Mistakes can lead to serious injury or death. If not done correctly, you may also start a fire. I do not take responsibility for any damages done to you, others or your property. I’m not an electrician, so maybe the way I did is not correct either. If you do not know what you are doing and feel uncomfortable, leave to project be or consult someone who knows. Proceed at your own risk.
My relay board consists of 3 terminals for each input: NO, NC and COM. I just got into the habbit of switching both neutral and phase for each pump although with the specific power supply I used I know for sure which cable is which. This is not always the case as you may not have polarity protection.
I cut the cables from the power supply and connected them to the COM ports. I then connected the normaly open terminals to my pumps. When the relay turns on, the normally open connection closes and the pump starts. To be able to use 1 power supply for multiple pumps I connected the normally closed port to the COM port of the next set of terminals.
When pump 1 is turned on, terminal 1 and 2 both switch on, neutral and phase are both connected via the NO and COM terminal, the normally closed terminal is now open.
When pump 2 is turned it, the normally closed terminal is closed, so we can draw power from there. I don’t turn on both pumps at the same time but sequentially so this is not a problem.
You can find a more detailed explanation of how the modules work here.