I want to pour 500ML of water with Arduino water flow controller with maximum accuracy. How will I get the maximum accuracy with this sensor? Could someone can give suggestion for accuracy or any other sensor that i can use? enter image description here

  • 3
    What flow controller? What accuracy? Commented Jan 11, 2016 at 12:24
  • I want to fill jar with 500 ml of water. I thought this can done with two ways either water flow controller sensor or Ultrasonic sensor. Is water flow controller sensor will pour accurate 500 ml into jar. If it pours more or less then my marking on jar will fails. so that' why i want accurate performance.
    – Sagar Lone
    Commented Jan 11, 2016 at 14:50
  • 1
    option three is using a scale (i.e. weigh the water). Forth option is a Liquid Level Sensor. There are probably even more solutions. PS you still haven't told what flow-controller-sensor you are using!
    – Gerben
    Commented Jan 11, 2016 at 16:09
  • What flow sensor? Why is water flowing both directions through the pipe? How much money have you for 'maximum accuracy'? i.e., What accuracy do you really require? How will you turn off your water? How will you allow for the amount of water between the valve and the jar if the flow rate changes?
    – Transistor
    Commented Jan 11, 2016 at 21:55
  • Flow Sensor / Fluid FLowmeter Control Switch YF-S201
    – Sagar Lone
    Commented Jan 12, 2016 at 12:45

4 Answers 4


The flow meter you specified, YF-S201 Hall Effect Water Flow Meter (datasheet) measures the water flow rate, producing signal output frequency in range 16Hz (at 120L/H) to 90.2Hz (at 720L/H). Datasheet claims "error range +/- 10)". Note that this only measures the rate of flow, it is not a valve and so does not control the flow.

Problem with using a flow rate sensor to measure total quantity of water, is that you must constantly integrate the flow rate over time to get the total volume. Any errors in rate measurement or integration time, will accumulate; so this is generally not an accurate approach. Cumulative errors are highly undesirable, because they are difficult to detect and compensate. You have to not only measure the output frequency, but also carefully control the time between measurements, because you are integrating over time. This will be even more of a problem if you are printing out messages to the serial port.

If the water supply is well regulated and always provides a steady flow, then you will open the valve for a specific time interval. But if the supply pressure is not well regulated, then you may accumulate integration errors and dispensing will not always be accurate.

If you care about dispensing precisely 500mL of water, a more practical solution is to use a weigh scale (load cell). First, measure the tare weight of the empty container, then dispense (using a control loop) until net increase in weight is 500g. With this setup, the dispenser accuracy is determined by the load cell repeatability error (0.1% for a good quality load cell, a couple % for a fair quality load cell) and the measurement accuracy of the ADC (depends on resolution and reference voltage stability). You could try using the Arduino's on-chip ADC which is only 10 bits, or for best accuracy use a real 24-bit weigh scale ADC. The load sensor's offset error is set to zero by measuring the tare weight of the empty jug, so you only need to be concerned about gain error at 500mL and repeatability of the load sensor. This approach does not have cumulative errors.

You have not specified what kind of valve you will use to control the flow. If you use a solenoid value, the valve is only on-or-off, there may be some overshoot due to valve reaction time (10ms), so you will need to experiment and determine an "off threshold" before reaching 500g.

Since you have no way to compensate if the system overfills the jar, you will need to dampen the system response so that it slows down as it approaches the target level, without overfill. I'd therefore suggest using a proportional valve instead of a solenoid valve. Start with a fast flow rate when net weight <400g and then switch to a slower rate as the jar reaches its target weight.


I suppose that you already found a solution. If you haven't, one inexpensive way for the Arduino to sense when the water reaches the desired level is to drill two thin parallel holes into the container (using a wire gauge drill bit, provided you're not using glass or something difficult to drill) slightly below the "trigger point." Then, you can insert two thin strands of conductor so that they protrude a millimeter or less inside the container(consider something like graphite 0.5 mm pencil leads to prevent corrosion). You'll need to seal the holes using epoxy. If you make a voltage divider and put these two pencil leads in the place of the second resistor, you can measure the resistance change (using an Arduino analog input pin) when the pencil leads are "connected" by the water. Once you find the ADC value for the "water full" state of your connection, you can make the Arduino turn off the flow when this value is detected. You should place the pencil leads below the "trigger point" so that you can experiment with different delay periods between sensing the water and turning the flow off (to compensate for the water that remains in the pipe "downstream" the flow controller. I've used this approach successfully to measure flow rate, but I can't guarantee it would work in your application.


You haven't specified what level of accuracy you are aiming for so I have assumed 0.01ml.

What ever solution you go for you will also need an accurate temperature and pressure sensor, because these will affect the density of the water. Each individual sensor you use has a degree of error associated with them. You would nee to calibrate each sensor to establish what level of error each individual instance of a sensor has.

Weight would seem to be the best solution. Surface tension could affect a flow metre or a contact sensor. I have to be honest I don't see how an ultrasonic sensor could give you any degree of accuracy. With a weight sensor you would need to establish the dry weight of the container then pour the liquid in until the desired volume was achieved. A quick response to close the very end of the inlet pipe would be required to prevent un-necessary drips.

As to marking the container, are you using some computer controlled marking tool, because if you are just drawing on the side with a Sharpie you may as well use a measuring jug. :)

You should be able to get a weighing PCB, a pressure and temperature sensor off any of the usual electronic sites to suit you budget and the libraries will be on Git hub.


Another option is to use a stepper motor and a Peristaltic Pump (or IV pump). You can use this to control the flow rate AND volume. For speed you need to make the motor run faster and for volume just run the stepper motor x times to get x volume. I do not know how precise it is. Good luck with what ever option you pick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.