Every Liter Counts! Arduino Water Doser "Shield"

14,563

79

79

Hi! With this instructable , you can dose a desired amount of water. The system can work in mL and L. We will use an Arduino UNO, a flow meter to count the amount of water, a LCD to show the status , push buttons to change settings and a relay to activate a solenoid valve.

The system can have many applications: water the garden, mix water with some ingredients, fill a tank, control water consumption, etc.

In a first attempt, i tried to make it on a breadboard, but due the 8 push buttons (a lot of wires), disconnections, wrong measures and the need to test outside or near a water source, I decided to make a "shield".

If you never made a PCB, maybe this is a good time. It is easy, you only need to be careful with the involved elements. I made a quick guide for the PCB . If you need more details , you can find good tutorials on this page.

NOTE: The accuracy of measurement , is given by the quality of the flow meter. This is not a high precision doser. You will need patience to calibrate the system, but the final result is pretty accurate.

Watch the video!

Step 1: Materials

PCB

-One side copper board 13x10 cm minimum ( Glass fiber recommended)

-Ferric chloride

-Plastic container

-Plastic gloves

-Thermal transfer paper (the yellow one)

-An Iron (for thermal transfer)

-Solder Iron , Solder wire, polishing pad

-Drill , 1mm drill bit

Electronics

-Arduino UNO

-LCD 16x2

-Water flow meter ( I am using the YF-S201)

-10K resistors x 8

-1K resistor

-10K trimpot

-Push buttons x 8

-Single row male straight pin headers x 21-pin

-Single row curved pin headers x 6-pin

-Female pin header conectors 2 x 6-pin

-5V relay module

-Solenoid valve (12, 24 VDC recomended)

-Conectors, wires

And Piping according to your needs

Step 2: Preparing the PCB

Maybe this is the harder step, if you never made a PCB. You only need to follow the directions.

There is a lot of ways to make a PCB, this one works for me:

1.- Prepare the board by polishing the copper surface. You need get a smooth and brilliant surface. Then wash it with dish detergent. Once you did that , do not touch the surface again (finger prints). Let it dry

2.- Print the files (PDF) on the thermal transfer paper. In my case, I have a paper for toner (not ink), so you need the correct printer for your paper. Print on the smooth/brilliant surface of the paper.

Note: The files are ready to transfer, do not use mirror to print. If you want, print first on normal paper to make sure.You will see the letters backwards, but it is ok.

3.-Put the paper with the printed surface downward, and fit it to the board(copper surface). Put some tape to fix it

4.-Now, use a hot iron to transfer the tracks to the copper surface. Do this by moving the iron , and press for about

2-3 minutes.

5.- Let it cool and then remove all the paper. You can wash it carefully to remove the remainig paper. Do not damage the tracks!.

6.-Prepare the solution in the plastic container.Use plastic gloves!. I use a proportion of one part of ferric chloride for two of warm water (40 C). I needed 300 ml to make the PCB (100ml of ferric chloride and 200ml of warm water) , but it depends on the size of your container.

7.- Put the board in the solution, move the container, now and then, "making waves" to remove the copper. Normally , it takes about 20-30 minutes.Check the board constantly.

8.-Once all the copper was removed, retire and wash the board (use plastic gloves to manipulate). Polish again to remove the ink and see the copper tracks.

9.-You can cut the remainig parts of board if you want.

10.-Now you have to drill the holes. Use a 1mm drill bit. The holes are marked in the center of the circles with no copper.

11.-Now, you can transfer the top.The printed paper has to fit with the holes. Use the corners of the push buttons lines as reference. You can do this against a strong light or the sun. Put some tape to fix it.

Repeat the steps 3-5.

And the PCB is ready!

Step 3: Making the "Shield"

Now, mount and solder the components. First the pin headers. You need push the pins, to get a "long pin" or you can use other type of pin header. See the picture.

Then the resistors. Every resistor is marked on the top with the respective value.Continue with the push buttons , trimpot , curved pin headers and female pin header.

WARNING:You need to put some tape in the "cover" zone , to avoid contact with the metallic USB socket

Mount the lcd and the arduino. "0" and "A5" show you the correct way to mount it.

NOTE: Your final shield may differ from mine, because i have fixed some issues (relay connector, "cover" zone, Contrast stamp)

Step 4: Pipeline

To be honest, i do not know the name in english for all the components, anyway, the pipeline depends on your application.See the pictures to have an idea of how to make the pipeline . Don´t forget to make a well connected and sealed circuit, because the pressure of water can splash out all the place and the electronics!

WARNING:The flow meter has an arrow ,indicating the flow direction.

Step 5: Calibration

With the "shield" and the pipeline ready, test your water flow meter.

You need a water source. I tested the sensor near the wash machine ,using the water supply connector on my solenoid valve (the same type)Arduino can not drive a solenoid valve,that is why i used a relay, so you need an external power source,according to the voltage of your solenoid valve, see the schematic. Use the "COM" and "NO" to interrupt one line. I am using a 220V solenoid valve from an old wash machine. If you need to buy the solenoid valve , i recommend a low voltage one (12 or 24 volt). Do not forget to choose one that you can supply.

Even if the flow meter indicates the pulses x liter, you need to test it, due the particular shape of your piping.

For example, my flow meter output is 450 pulsesxliter, but in the test i only got 400. Other factor, I could not work with the supply valve fully opened, because the readings became unstable.So you need to calibrate the water supply valve too.

NOTE:Do not forget to work within the parameters of your sensor, in my case, 1-30 l/min and 1.75 Mpa.

Like i have said, all depends on the quality and specs of the flow meter.

Connect the sensor to the shield. The top has printed the respective connectors.

+ = 5V (Red Wire)

- = GND (Black Wire)

S = Signal or Pulse (Yelow Wire)

The relay module has the same marks.

I prepared a code to count the pulses. You can use START/STOP and RST CNT. Use a 1 liter bottle, bucket or beaker, and press the start button. Stop when you reach 1 liter. Repeat a few times to get a pattern. Press the RST CNT button to reset the counter and start again.

Now, you know the pulses x liters of you sensor.

Watch the video.

Step 6: The Water Doser

Hardware Features:

LCD: Show the status, "SP" is the set point or desired amount of water and "CNT" is the counter. I introduced a code that makes the lcd , works like two screens. The ml function and the L function are completely independent.

START/STOP: Is a "toggle" function. to keep the Relay and the system runnig when you release the button. If you push again, the system stops and the relay is "OFF".All buttons do not work if the system is ON

UNIT:Change between ml and L, keeping the settings and values of the previous screen. Also is a "toggle" function. If it is low, you are on ml screen and if it is high, you are on L screen.

RST SP: Reset the set point on the current screen, to enter a new one.

RST CNT: Reset the counter on the current screen to start a new count. If the counter is higher or equal to the set point, the system will not start.

Adders Buttons: You have 4 push butons to change the set point, +1, +10, +100, +1000. This is a easy way to change the settings. The adders buttons do not work while the system is running. You can´t add +1 on the ml function.

Software Features:

I took the sensor as a push button (pushed very fast!) It uses the same "debounce" function of all buttons. The sensor sends a "high" when completes a round (every 2,5 ml aprox). The rest of the time is "low", the same effect when you push a button.

You only need to introduce your pulses x liters and the ml x pulse as follows:

In the previous step, you tested the sensor and got your output pulses. Try to round the number.

float cal_1=2.5; //Calibrate ml x pulse

Where cal_1 = 1000/pulses per liters (my case; 1000/400 = 2.5 ml x pulse

int cal_2= 400; //Calibrate pulses x liters

This is a perfect round number to work. I don´t know if you will be so lucky than i was.Make a last calibration to adjust the error to minimum

The variables are "int" ,so if you need bigger numbers, change to "long" or "unsigned long"

On the video, you can see the operation of the shield. With a little patience, you can achieve a near-perfect performance.

Step 7: Auto Reset

Edited 10-23-2018 ,Testing

Request from users. After the counter reaches the setpoint will be set to 0 automatically to start a new count. You can always use the Reset button while the system is not running.

Backyard Contest 2016

Participated in the
Backyard Contest 2016

Maker Olympics Contest 2016

Participated in the
Maker Olympics Contest 2016

Low Water Gardening Challenge 2016

Participated in the
Low Water Gardening Challenge 2016

Share

Recommendations

  • Beauty Tips Contest

    Beauty Tips Contest
  • 1 Hour Challenge

    1 Hour Challenge
  • Pets Challenge

    Pets Challenge

79 Discussions

0
None
ts.ozkan74

5 weeks ago

SP is lost on LCD screen when start button is pressed and the sensor does not count pulses

WhatsApp Image 2019-05-22 at 02.44.23.jpeg
1 reply
0
None
NicolasJ7ts.ozkan74

Reply 5 weeks ago

I can't see the shield. Did you wire up the circuit?

0
None
Irvana5

3 months ago

can you tell me how to change the program to add more than one output, so it can fill more than one fill.

0
None
ShakhawatH1

4 months ago on Step 7

Thanks for a quality project. Sir, Is can I add a dc pump on the place of Solenoid valve. If yes then how? and what is the coding ?

0
None
irfan10

6 months ago

I NEED SEPERATE CODE FOR BOTH LITER AND MILLI LITER.
SO PLEASE KINDLY UPLOAD HA COEDE FOR BOTH OF TTHEM AS SOON AS POSSIBLE..
BECAUE I HAVE SUBMIT A PROJECT IN MY COMPANY ..
I WILL BE THANK FULL TU YOU..
THANK YOU

1 reply
0
None
NicolasJ7irfan10

Reply 6 months ago

Sorry, my friend, I don't know if I get you wrong but "Company" means profit to me and you can't use these projects for commercial purposes. You can see that at the beginning of this tutorial: "Creative Commons".
On the other hand, if you can't modify the code that means that you need to learn more about coding and Arduino and that's up to you. I hope you understand.

0
None
WaelT4

7 months ago

hi, very good job ,thanks alot.
plz. i want to use keypad 3*4 instade of bottons ... only lcd 2*16 and keypad 3*4..and i don,t need ml unit , only unit of Litre i want ...
plz, can you modify the code for me?
lcd to pins (7,8,9,10,11,12,13)
keypad to pins(A0 ~ A5)
PLZ, I NEED THE CODE FOR NESSARY ...
thanks for advance..

1 reply
0
None
NicolasJ7WaelT4

Reply 7 months ago

Sorry, my friend, I don't like keypads, when I need that kind of interface, I go for touch screens. This tutorial is intended to help your way for your own projects but I can't write codes for you. You can find lots of tutorials with keypads, then you can apply that on this project. I hope you understand.

0
None
dhirajp7

8 months ago on Step 7

This updated auto reset is working perfectly as expected. Thanks a lot

1 reply
0
None
RadeS2

11 months ago

Anyone made this from these instructables directions? Working ? Made PCB unfortunately have to see pictures cos there is no schematic, picture shows some transistors as well while there is no transistors in directions? Display backlight turnsoff but nothing else, at the end I will ditch PCB and try on protoboard , but thinking to turn to other similar working project.

NOT COOL to post instractable that wont work!!!

FIDDVX8IRUZMKWQ.LARGE.jpgF0ICX1EIRUZML3T.LARGE (1).jpg
6 replies
0
None
ZafirisRadeS2

Reply 8 months ago

when we reply here , down to the window say '' be positive and constructive''. Nicolas project working just fine ( better than fine) and i will give him my images when i finished a project because i have lot of work that period. so... be polite my friend because here are one of a guy that i admire of his responsibility. read careful the instructions and if u have any questions just ask with respectfull to the person that he give as great picture for our imagination. Read carefull because its a working project

0
None
svrZafiris

Reply 8 months ago

There Nikolas now you have admirer , male admirer who isn't afraid to come out ...(in non-constructive way)

0
None
svrNicolasJ7

Reply 8 months ago

how deep, see now that you are admired for your humor, you funny funny g

0
None
NicolasJ7RadeS2

Reply 11 months ago

NOT COOL it's to post a comment before asking for help, this is not how this site works, you can see that i always answer every question or comment. The project is fine and I don't know about your electronics skills. You can read the comments from users Zafiris and 24242424h.About the pictures you send, you can read in step 3:

"NOTE: Your final shield may differ from mine because I have fixed some issues (relay connector, "cover" zone, Contrast stamp)"

About the circuit: you need to print the pdf files and transfer to the PCB, that's all, the pdf is fine. By the way, where is the transistor? the "10K" mark? that's a trimpot, maybe that why you don't have the LCD working.

As I can see in your profile, you are new here and have never posted a tutorial. Next time, watch your words and follow the instruction carefully.


0
None
RadeS2NicolasJ7

Reply 11 months ago

Basically you are saying that this tutorial is for IT and electronic engineers who can't made this simple PCB and code themselves? I made a few much much serious projects from Github, easy , when tutorial is made and written normally. But not this one. Not sure in your electronics skills, but TO-220 housing seen at 1:55 in your video is mostly used for transistors?? Isn't it ?

To other instructables users ..please, please in case you have working project , post pictures here so I can make apology to the person who made tutorial.

In any case, you need to improve your writing skills, at least writing tutorials skills. I made PCB and now I'm stuck with this and will differ PCB and your project to make it work.

I thank you for your effort

kreten.jpg
0
None
dhirajp7

Question 9 months ago on Introduction

Pls guide for code which automatically set zero on CNT. Presently we have to press 2 buttons, 1st reset CNT and then start button. How we can skip CNT reset step? Pls send code for this.