Introduction: Automatic Watering System / Automatization Machine
First, let me introduce you my project.
My device is automatic watering system (you can switch on/off water solenoid but also instead of solenoid you can switch anything else which use alternate current - it means that my device is also universal automatization machine).
My idea was born when I was watering my terrace garden and I discovered that the temperature of floor (made from concrete brick) is too high. Hot floor was heating the air to very hight temperature. Because my garden plants don't like hot temperatures I must cool the floor with cold water. Also I must water my terrace garden everyday.
So that's the reason why I have made this machine which will do all the mentioned things for me.
Step 1: Video Demonstration of My Machine
Here you can watch video demonstration of my machine. You will see all the functions in action. Labels are written in Slovak language (my native language) but if you want you can check english translation of this words in next step.
UPDATE: I have updated temperature checking functionality as I mentioned down. Please don't forget to check my last step & if you like it VOTE for this instructable in Automatization contest.
Step 2: What You Can Do With This Machine ?
You can connect AC power source to L and N, and 3 objects which you want to switch (for example water solenoid).
You can switch on/off any of up mentioned 3 objects connected to LA, LB and LC. You can switch on/off any possible combination (a, b, c, ab, bc, ac, abc) of these objects.
You can switch on/off any ,,round,, (by word round I mean combination of 3 objects for example "a" or "a c" ...) for specific time - you can setup running time from 1 second to 18 hours.
You can setup planned switch on/off of specific round to specific amount of time at some time during a day for example you can setup round "abc" to be switched on for 1 hour 4 minutes 5 second, and it will be switched on and start counting time at 07:30.
PLANNED FUNCTIONALITY (Not implemented yet) - monitor temperature and when temperature overcome some value switch specific round on until temperature decrease.
Step 3: Review of Functions
My device have 5 mods (5 different menus).
In each menu you can setup something different.
Here you can see what you can do in each menu & button functionality in each menu :
1.) First menu is big clock menu
You can see / set actual time there.
Button 1 - Next menu
Button 2 - Increase number of hours by one
Button 3 - Increase number of minutes by one (by long holding it's automatically increasing each 0.25second per one)
Button 4 - Switch on / off display backlight.
My device after ,,booting up,, automatically switch off display backlight.
2.) Second menu is "Test of round" menu
You can turn on / off specific round there.
Button 1 - Next menu
Button 2 - Switch on selected round
Button 3 - Switch off selected round
Button 4 - Next round
3.) Third menu is "Switch round for specific time" menu
You can turn on specific round for specific time there.
Button 1 - Next menu
Button 2 - Increase selected position by one (hours, minutes, seconds)
Button 3 - Go to next position (from hours to minutes, from minutes to seconds, from seconds to hours)
Button 4 Short hold - Next round
Button 4 Long hold - After release of button start round (switch on) for specific amount of time
4.) Forth menu is "planned waterings" menu
You can plan 10 different waterings there.
Button 1 - Next menu
Button 2 - Increase selected position ( hours, minutes, seconds, hours, minutes, round, enabled/disable)
Button 3 - Go to next position (time of watering, time when watering should start, round, state (enabled / disabled))
Button 4 - Next watering (You can setup 10 different waterings - first is watering number 1 and the last is watering number 10)
5.) Fifth menu is "review of active watering" menu
You can see actually running watering there.
If there is not running any watering you can see label "watering is not active - polievanie nie je aktívne".
If there is active some watering you can see round of watering and remaining time.
Button 1 - Next menu
Button 4 - Switch on / off display backlight
6.) Settings menu
This menu is not implemented yet.
You can setup "critical" temperature and round and when the temperature of the termistor exceed setuped temperature specific round will start watering until the temperature will be decreased.
UPDATE: This menu is programmed yet. You can see it in the last step.
Step 4: Components Which You Will Need
All resistor and capacitors (without 22pF capacitors) have SMD 1206 package.
2x22pF capacitors (not SMD)
1xSHK20L Fuse holder
1xLCD 16x2 with HD44780 driver
3x3mm or 5mm green leds
1x32768Hz clock crystal (XTAL)
1x16MHz crystal (XTAL) HC49/S package
4 or 5x (reset button is optional) omron 10mm switch (button)
1xAVR 10 Pin ISP header
1xAtmega329p or Atmega128 (if you use atmega128 you must swap two programming pins explained in programming section)
1xPCF8563 (RTC) in SMD SO8 package
2x1n4148 diodes in MINIELF smd package
1xCR2032 backup battery (for RTC)
1xBC817-40 NPN transistor in SOT23-BEC package
Optional : You can solder optional SMD 100nF (1206) capacitors between VCC and GND on long ways.
Step 5: Schematic
Here you can see schematic.
Step 6: Etching PCB
I use to etch my PCBs in ferric chloride but you can use any of etching chemical which you like (have good experiences with).
a) First order some clear PCB (with or without photosensitive paint). If your PCB haven't god photosensitive pain apply some Negative UV photosensitive paint on it and let it dry.
b) Print my PCB design (attached here as polievacs.pdf) to transparent foil.
c) Put foil over clear PCB and put it together under source of UV rays for 1-2minutes depending on how strong is your UV source and which photosensitive paint you have used. Be careful and put it with right orientation - text should be readable (not mirrored).
d) Put your PCB into 1% water solution of NaOH to remove illuminated part of photosensitive paint (part of copper which will be etched).
e) Put your PCB in ferric chloride for 10-30 minutes depending on how strong (weak) your ferric chloride is.
f) Wash the PCB and remove paint (by rubbing it with some abrasive material or use some solvent f.e. alcohol).
g) Optional: Put your washed PCB into soldering solution (I used sulfuric acid based soldering solution with thiourea)
Your PCB is finished :)
Step 7: Drilling Holes
Use 0.8mm and 1mm drill bits. In PCB design I have used drill-aid ulp which make holes smaller - better for drilling (you can fit drill bit into correct position in hole much more easily). Optional you can use other sizes of drill bits.
Step 8: Soldering Components
Now it's time to solder components. Start with small components in SMD package, end with bigger components.
Here you can see components positions. There are also 4 wires in top layer - connect if from upper side of PCB with some isolated wire.
Step 9: Programming UController
If you use atmega128 instead of atmega329p you must swap MOSI/MISO pins from 12,13 to pins 2,3.
Connect your programmer to PCB (I used USBASP programmer).
Load main.hex and program it to the uController.
I used my linux PC with installed avr-gcc to run avrdude and program it.
avrdude -c usbasp -p atmega329p -U flash:w:main.hex
If you want to use atmega128 contact me and I will provide you compiled hex for atmega128 with translated texts into english.
Step 10: Box for Machine (Package)
I'm going to design 3D printed box for this machine. When I will do that I will update this instructable. You can also use some custom box in which will my machine fit.
Step 11: Powering
My device need 5V power. You can use external adapter but if you will use this device to switch 230~ (230~ connected to L on AK300/6 connector) you can attach hi-link convertor (transformer with electronic inside) to board (
which will convert 230V AC to 5V DC. You can also power it from USB with programmer as you can see on picture.
Step 12: Updates
Currently I haven't god enough time but during summer holidays (1.June - 31.August) I will design 3D printed box for my device, translate texts into english (if somebody will want to build my device), implements termistor and UV diode functionality (that is the reason why there is 2 connectors AK300/2 - one for thermistor with on PCB integrated voltage divider (100Ohm, 10kOhm resistors) and second for antiparalely connected UV diode) both of these connectors are connected to analog to digital converter of atmega329p (atmega128).
Please vote for me in Automatization Contest.
UPDATE: I have reserved some time and finally programmed temperature checking functionality.
Simply buy DS18B20 (1$) temperature sensor and connect it to the X-2-2 and X-2-1.
VDD - leave unconnected (In DS18B20 datasheet is mentioned that if you want to use termometer in parasite power source mode you should connect VDD to ground but I have experienced that this sensor stop working when I do that. So leave it unconnected)
GND - X-2-1
DQ - X-2-2
Then reflash your Atmega with main.hex which I provided to you in THIS step not main.hex from previous steps.
Your are done. Now you can setup critical temperature and watering round in menu. Every time when there is measured temperature (my device will measure temperature every 10 seconds) bigger than critical temperature watering start on defined watering round and when the measured temperature decrease under critical temperature watering on defined round will stop.