I must mention project14 is awesome!

It gets me started doing project I have always wanted to do, but didn't find the time.

For some reason because it is done in a community way, I find myself more stimulated doing nice projects


In my garden, I have a dummy irrigation system. I have two timer electric valves, one for the flowers and one for the trees which require different watering times.

They both work every day for particular time and don't know to adjust themselves to the weather.


I always wanted to do the following project:

  • Shut down the water on a rainy day
  • Extra feed on the summer heat
  • Do it automatically using the weather forecast
    • Today I just open/close the master valve manually


I am living in a remote place in my country, everybody around me are farmers.

Shipping electrical components to my address can take more than 2 months (e.g. TIP120 took 2.5months to arrive)

Luckily buying agricultural equipment is a piece of cake.


My neighbor is working in one of these companies called www.bermad.com.

They profession this equipment and I have access to their datasheets using the website.


These two solenoids have enough electric specifications to understand how to operate them.

I place to use H-Bridge "SparkFun Motor Driver - Dual TB6612FNG (1A)" https://www.sparkfun.com/products/9457

I know others may like the LN298 flavors H-bridge but I this this one is better in power dissipation and efficiency.


From the factory, I ordered the DC solenoid with valve on it - http://www.bermad.com/product/210-ls-2w-m-2/

Will update more after receiving the piece next week.


Update 1

First this to do is describe in high level the design.


The arch goes like this:

I happen to be the proud owner of dragonboard 410C https://www.96boards.org/product/dragonboard410c/

Its Qualcomm's Raspberry pie solution.

I quite like it, since it can do heavy lifting and comes with 4 cores and 1GB RAM.

I will use it to do the IOT part (web server, cron, etc...)

The arduino will do the real time processing (en/dis the solenoid).


  • Main valve will be in the garden, I have there 3 wire cable towards the roof (in the walls).
  • The arduino will be on the roof and using a motor driver will pulse on/off the valve.
    • Arduino will use the electricity cable to signal the motor (cable is not occupied in current moment)
  • Motor driver is TB6612FNG http://https://www.sparkfun.com/products/9457 which can go up to 15V (more than enough)
  • Arduino will have a BT module to receive orders when to on/off
  • DB410c will do IOT and have integrated BT/WIFI.


Design details

Arduino sketch template

The following sketch have communication implementation, I didn't have the time to also turn on/off motor driver.

Also, adding motor logic is straight forward in the ON/OFF elsif

Arduino code in github: https://github.com/idanre1/iot_irrigation/blob/master/water_control.ino


I also did the db410c script (perl) to sample weather from the internet and communicate it to arduino.

  • $url can control hometown
  • $cache is for debug


IOT side template code

Perl code in github: https://github.com/idanre1/iot_irrigation/blob/master/iot_wrapper.pl


I hope my next update will be when I will receive the valve.


Update 2: Receiving the valve


Yesterday I have received the valve, till now I have prepared all of the SW for both the Dragonboard and the Arduino (will update github sometime).

Again, the Dragonboard will run perl to forecast weather, send command to the Arduino using it's internal BT module.

Arduino will be armed with BT module to SW serial port, and a motor driver in-order to turn the valve both ways


Breadboard Video


This is the circuit


This is where I plan to put the smart valve (see video for more details)


This is the main valve

These are the pipe connections:



Next stage

I have left to solder it all in a nice way, store it in a water resistant box and put it in the roof.

I plan to send the signal to the solenoid from the roof, it means ~9-12V over about 8 meter cable.

I hope the added resistance of the cable (this is a regular 220V cable, so resistance is not negligible...) will not mess the signal too much and things will go easy.


Update 3: Assembly

I have wired the valve to the water pipe and to the electricity cable, Hooked up the arduino and motor driver on the roof and managed to communicate the arduino using the BT from the db410c.

db410c is running Debian linux so I can SSH the db410c using any wireless device around the house.

Below is the video of the assembly


GND is shared by all modules

VCC is currently 5V

VMOT is 13.5V


Final notes

I have been trying to create the power supply to the arduino from the same wall-wart.

I had an excelent discussion about it Power arduino using lm338k.

Thanks gecoz, peteroakes and jw0752 who helped me understand how to make a descent power delivery to the module.

Eventually I found a 9V nominal wall-wart around the house that will suite my solenoid needs better (Thanks again Peter and Fabio for your help)


The power circuit looks like that (Arduino is actually the VCC line you will see in the next photo):

Final Photos

You can see I drawed two lines with a marker to better find the power lines.

Vm is where the 9V is connected directly to the motor driver power to change the solenoid state.

I put a 100uF directly to vM and 1uF directly to VCC just for making sure...

There is also a zenner 3v6 and a resistor between arduino TX and BT RX for reducing the 5V from the arduino to the 3v BT module.

On the arduino RX and BT TX I didn't put anything because 3V is considered V_h in the arduino - so signal integrity is kept.


Here you can see eveything composed in the box

(eventually I used a different wall-wart, not shown in picture)

Also you can see I made a tiny hole for the BT module to pop out, or nothing will pass in the air.

I will put transparent plastic cover to prevent flying bugs to come in, but still the BT connection will last.

The box also come with nice places to put screws, I used it to screw things in a tidy way.


Everything from behind


I think that concludes the project.

I had a great time, and also learned allot, especially on power delivery.

And I don't have to bother every day turn on/off the irrigation system