Introduction: Home Automation - Watering Plants

About: What started as a passion for the technology - computers and electronics has finally coalesced into a career spinning webs on the Net.

I have a small garden with many fruit bearing trees and plants which require regular watering. The gardener I have is lazy and often skips watering. This resulted in stunted growth of the plants or in the worst case scenario, some plants withering away. I was desperately looking for some form of automation without breaking the bank. I chanced upon this Kankun Wifi Switch which is available from here for less than US$ 18/-

I hooked up this switch to a solenoid valve and a few feet of PVC pipes and now the plants are watered every day precisely at the set time - like a clock work. What is more I can turn the water supply on and off from my mobile phone even when I am away - wherever I may be - if necessary.

There are other options to automate such tasks. You can use programmable micro controllers like Arduino or Raspberry Pi. First of all they cost more with a wifi module when you compare them with this wifi switch. In fact I have half a dozen such switches on duty in my home automation project. These switches are inexpensive additions to any home automation projects. You can control them from anywhere and you can schedule turning them on/off directly from a cronjob.

For those with technical bent of mind, this Switch uses a Qualcomm Atheros AR9331 processor which is a highly integrated and cost effective 400 MHz System-on-a-Chip (SoC), mated to 32 MB RAM onboard. It uses a relay rated at 10 A (250V) to control the plugged in appliance. It runs OpenWrt - a Linux based firmware program - originally developed to control gateways and routers.

It doesn't have a real time clock onboard and depends on synchronization with external time servers. It requires net connection anyway for you to access it from anywhere. So this itself is not an issue. The relay's contacts are rated at 10 A and so you can control any load up to a maximum of 2500 W. But my control loads don't exceed 500 W in any case. And in this case to control the solenoid valve, it hardly needs to pass 4 mA which is just about 1 W.

What you need:

1. Kankun Wifi Switch

2. Solenoid Valve 250 V (I salvaged mine from a Water Purifier)

3. Set of PVC pipes, joints, rubber tubing to connect to the solenoid valve

4. Working Wifi Router with Internet connection

5. Multi strand wire to connect the solenoid to the switch

6. Plug to fit the switch


1. Solder the terminals of the solenoid to a connecting wire. At the other end of the connecting wire fit the plug. 2. Prepare the Wifi Switch as a scheduled timer. The process is a little complicated. But there is a blog with detailed step-by-step instructions here.

Wifi Switch can be operated with its own scheduling arrangements using crontab.

Create 2 files in /www/cgi-bin/ like so:




echo 1 > $RELAY_CTRL




echo 0 > $RELAY_CTRL

Call one of the above as you need to turn on or off using a cronjob:
To turn on the switch every day at 10.30 and turn off at 10.45 :

10 30 * * * /bin/sh /www/cgi-bin/son

10 45 * * * /bin/sh /www/cgi-bin/sof

3. Wrap the terminals of the solenoid with insulation tape. Connect the inlet of the solenoid valve to the water supply. And the outlet to the PVC hose.

4. Position the solenoid valve and the rubber/PVC hoses and secure them with a plastic tag.

5. Turn on the switch manually and check that the valve opens and water flows out from the end of the hose.

6. Drill, punch holes on the hose where needed and route the hose around the garden.

7. Ideally get some length of smaller diameter rubber tubing and hook them into the holes of the main supply hose. The smaller tubes will be directed to the root of the plant saving water in hot climates.

Now you can assign the task of watering the plants to this little smart switch. If you have any queries or need any clarifications, I will be happy to answer them here.

Thanks for reading my Instructables.