In Field Battery Operate Latching Valve Water Irrigation Timer Controller With DIY PCB

by watcharain in Circuits > Microcontrollers

2692 Views, 32 Favorites, 0 Comments

In Field Battery Operate Latching Valve Water Irrigation Timer Controller With DIY PCB

intro1.jpg
20210315_153843.jpg

I have a small vegetable farm in Thailand. we still use a lot of worker to do watering. Now I try to make some solution for make a timer for watering plant and use less worker for watering.My requirementis that It must be good on field with out need to lay long cable for electricity. I also don't wan't to controll water from the water center as I already layout pipe on the field . The most important thing is I want to make my own controller which can be customize and expand feature in the future like adding LoRa, Zigbee IOT, Sensors and make that suit my farm.

Before start,I would like to inform you that I'm from Thailand , My English Language may not good but I will try my best, Sorry if there are some mistake in my English in this article.

So . the major key feature of this project is

1.Simple Controll timer for water irrigation by ON-OFF water valve, 4 times a day.

2.Must be battery operate, more safty than use electricity and easy to implement in field.

3.Suitable for running any where in farm that have water pipe.

4.Cost effective.

5.Can be expand feature in the future.

After done several of searching for solution and tools. I come up with Latching vale as the use less power to controll and also use AVR Controller as cheap and easy to find with a lot of resource. I use my old school basic language as easy for me to understand and i use it long before arduino came out so,I go with BascomAVR. I use Autodesk EaglePCB for designed a PCB. Autodesk Fusion360 for make box cover. Now i got every thing ready, Now lets make it step by step.

Parts, Tools and Supply

  1. Dc Water irrigation Latching Solenoid Valve. Can be any size depend on size of water pipe. Can be bought from amazon, alliexpress.
  2. PCB, PCB Etching Acid, Cutting / Drilling Tools.
  3. Electronics component, LCD 16*2 , Atmega328p, Mosfet, Capacitor etc. You can find all component need in Eagle Schematic file.
  4. Battery and Battery Holder, Any battery between 7-18 V.
  5. Waterproof electronic box.
  6. Autodesk Eagle Pcb software for pcb printout, Laser Printer.
  7. AVR ISP for programming AVR microcontroller.

Knowing Type of Water Solenoi Valve.

valve2.jpg

There are 3 common type of water solenoid valve. DC solenoid valve, AC solenoid valve and Latching Valve. Most common type that use in many project in watering plant is DC solenoid valve, This type of valve use DC power to energising coil to raises the plunger and enabling flow let water pass through. But this type is not good for batery operate as they need continue power energising the coil.This project then use a Latching Valve. The different to the other is that they need only one pulse or power to energising the coil and the plunger will hold it state. The direction on plunger close or open depend on polarity electric power pulse that apply to the coil.If we apply + - to coil it will pull back plunger in to coil and if we swap it,put - + to the coil it will push plunger out.

This Dc Latching Valve need pulse of power to operate. They need around 6-20 V with about 500ms of pulse time to energising the coil. Once pulse apply they will latch it state there for no need any power to provide ti the coil any more until it need to change it state.That's why it very good for batery or energy saving operation.

Circuit Design

circuit.jpg
HbridgeCir.jpg
fullcircuit.png

For circuit design, I use Autodesk Eagle for design schematic and pcb. Eagle is easy and flexible schematic and pcb designer. I had been using if for very long time. It very suitable for D.I.Y and Hobbyist. This program will allow you draw schematic, place component that need and generate component to pcb board editor. So. There are 2 main editor windows of Eagle , Schematic editor and pcb Board editor. I like this program as you can change or edit or create libraly to suit your project. On Eagle board editor you can arrange component the way you need and manual rout pcb trace as you like. As for me I didn't do very complex pcb or multilayer pcb or any big pcb so it free version /education version of it is more than enough.

Now for this project circuit designed. They have serveral part that we need to create

  1. Main Micro Controller , In this case I use ATmega328. It's pins identical to Mega8 so I use Mega8 in this design as it already have this in eagle libraly.
  2. Regulator Part use LDO MCP1702-5V simple with tantalum capacitor.
  3. LCD 16*2 use 16 pins single row Pin Header.
  4. Hbridge using mosfet BS170 and smd FDS8958 Dual N and P channel in one package.

The important part that control latching valve is the H-Bridge Circuit. This circuit consist of 6 mosfet 3 each side this will allow micro controller control output of voltage eather low (0V) or high (V+) using 2 digital pin each side. This circuit can be replace with Hbridge Motor Driver ic. But for me I would like to learn basic electronics so I decide to use simple mosfet Hbridge circuit. I'm not a professional in electronics so my circuit just designed by my learning and experiment, This is not precise calculate circuit. I just looking for mosfet that available in my place and find datasheet. As long as electrical characteristic suit my need ,current,voltage. But so far this circuit do the job very well and stable.

After designed and put every component to Eagle schematic editor. Link all signal pin between components.We switch to the Eagle board editor. Every component from schematic will now show in board editor. Ready for boaed designed.

PCB Layout Designed

board1.jpg
board2.jpg
board3.jpg
board4.jpg

After schematic designed. Next we will create a PCB Layout using Eagle Board editor. After switch circuit to board in the first time Eagle will create board file with all component from the schematic.Then we can arrange place of components as we like. After that I will rout each component with signal line. Now, For one side PCB. If you want pcb copper routing top layer like mine then the bottom layer will need to designed connect as straight jumper wire. It will be easier to connect. If you want copper on bottom then top layer should be straight jumper wire.

For using my method to make D.I.Y pcb. The copper signal line connection should be use a thicker line atleast 0.016inch, I use 0.024inch width for copper signal line. For via diameter better at 0.08inch. And for groundplan I used hatched style plane as it will make easier for DIY PCB and soldering. Now!! It's ready for D.I.Y. Pcb Process.

Downloads

D.I.Y. PCB Home Made - Fast and Easy , Less Requirement Tools (Part 1)

pcb1.jpg
print-eagle.jpg
pcb3.jpg

PCB is quite tricky part for Hobby. Some use CNC to engraving it, some use dry film or negative pcb film, or some send to PCB maker, That require time and special tools.

But for simple single side PCB like this. To make the PCB I use my easy method and it give a very good result. The requirement material and tools is

-Laser printer , as this method will transfer laser ink to pcb using heat.

-PCB can be any 1 side pcb , I use Epoxy FR4 1 side copper pcb.It can easily found at electronics store.

-Cloth iron , and peice of cotton fabric.

-Thin glossy paper like advertise paper or magazine , the one i use is Lego catalog book.

-Scotch Brite for cleaning dish, we will use green side.

-Pcb etching acid, can easily found at electronics store.

-drill, cutter and ruler and some common everyday tools.

Now We ready to go..

To make PCB , follow these step.

1.Cut and shape pcb to size of designed pcb board. Can use cutter or saw.

2.Clean copper side with green Scotch brite. Make sure that clean all the area.

3.Dry it with paper, we can easily see copper brighter and have shallow surface scratch line all over it.

4.Print PCB copper line layout using laser (Black only) printer. Print it on the Thin glossy paper like advertise paper or magazine , the one i use is Lego catalog book. This is very important for good result. Must be thin, glossy and easy absorb water. some thing like Lego manual , catalog or weekly magazine.

5.To set print PCB layout to paper, We need to print only copper layer, To do this, in Autodesk Eagle Board design, Goto setting layer , click on enable view layer (eye symbol) only Top,Vias and Pads if your design pcb routing on Top layer or Bottom ,Vias and Pads if your design pcb routing using Bottom layer. In board view it will show only copper line and pads and vias.

6.To print PCB layout, We need to select option Mirror, Black And Solid. This setting will give solid black printout. We also need to mirror it as we will transfer it to pcb.

7.Cut printed paper to fit board dimension. Place printed side face to copper side.

8.Cover it with cotton fabric, Be careful not slide paper away from copper face.

9.Iron it with cloth iron.try press it and make sure iron it all over the place especially edge of pcb. This step may need to try serveral time to make it perfect, it depend on time, iron and heat. I used about 2 miniute of ironing and it come out perfect.

If it perfect one, you will see that paper stick to copper without any air bubble.You will also can see a bit of pcb print line bold on the back of print paper.

10. Let it cool down and then soak in the water.

D.I.Y. PCB Home Made - Fast and Easy , Less Requirement Tools (Part 2)

pcb4.jpg
pcb5.jpg
20210311_213319.jpg
20210312_204237.jpg

Lets continue part 2.

1. Now. After we soak pcb in water for about 10 minute. Paper will start to worn out.

2.Use your finger gentle rub the paper in water. It will come out from pcb and leave black ink stick on to copper surface.

3.After all paper come out. It will leave only nice laser ink on pcb.

4.Put it in PCB Etching acid. Slightly shake container helping etching process go faster. After a few minute all unwant copper will come out only left copper that cover with black ink. Wash out acid as soon after finished etching process.

5.Drill hole that need.

6.gentle clean ink out from pcb with green side of scotch brite.

7.Cover it with with Pcb cover chemical if need, In case that need to protect copper line from oxidation.

8.Assembly components to pcb.

Coding...

code1.jpg
flow.jpg

For coding the microcontroller. I use Basic language as i more familiar than C langauge. But in the future it should not be hard to rewrite to arduino C langauge.I use program BASCOMAVR it's a simple basic langauge for AVR.I use this program long before Arduino project came out.

Program Flow:

I just write a simple program. After I power the board, in my case I use 9 Volt battery, It will ask to enter RTC(real time clock) to it in hh:mm 24Hr format. After enter real time it will ask to enter start time of timer1 and follow with stop time of timer1. Enter timer repeating for other 3 timer. If enter 00:00 both start and stop timer, That timer will disable and not activate valve. After end of process it will let microcontroller enter sleep state. Microcontroller will be set to wakeup from sleep every minute to check if there timer that set to ON or OF the water valve.If there are match timer, then it will operate H-bridge mosfet circuit to send pulse to the solenoid to push or pull the plunger. Let water flow or stop flow.

User interface design:

Just a simple 1 LCD 16*2 character and 2 buttons. First button is for change number and other for goto next number.As follow program flow from start LCD show "EnterRtc" use 1st button to change value and use 2nd button to navigate to next digit. The only drawback that if enter 1 digit wrong we need to re-enter the whole process.

So far so good. This project have been testing in the field morethan 2 weeks now. Every thing working great. This simple program are good enough for vegetable plant. For my farm they only need 2 time of watering so I config timer only 2 timer and left another 2 unused.

To program AVR ATmega328P can use basic file and compile with BascomAVR or can be direct programing chip with this HEX file.

Future

20210312_204319.jpg

In the future, It can implement IOT, Lora Wan, Zigbee to it. In case more unit on the field will help more easy to config timer and monitor. Sensors like Temperature, Humidity, Flow can be easily add to the project. As I make this D.I.Y. PCB. Change on adding more feature on it wil be easy to add to schematic and board with Autodesk Eagle Program. With this method of making PCB it easy to create more prototype version of PCB and testing on the field. After get a satisfied result I can make a production PCB by export this Eagle PCB file to Gerber file and send to PCB manufacture to make more unit to for my farm.

Hope you enjoy this Instructable. If there any question please feel free to leave comment,I will try to do my best for answering the question. Thank you for reading my First instructable.