Im trying to figure out the best way to measure how many gallons is running through the meter in total (running total). To keep track of when to replace filters or do maintenance. I have a second flow meter which I want to measure total volume as well, it's just on another water line.
I've been looking through code and trying different methods all day, I can't find a datasheet on this flow meter. How do I figure out how many pulses per liter or how many ml / pulse...If it's that obvious I feel dumb, been a long day.
Yep, do what I did: pour a couple of 2-liter coke bottles of water down a line connected to the flow meter and count how many pulses I saw. It's affected somewhat by pressure, but IIRC, not an issue unless you have wildly varying pressures.
I've got a handful of these sort of sensors - from the 6mm/0.25" for measuring my water filter, all the way up to 38mm/1.5" for whole house measurement - and none of them did what the spec sheet said. They tend to perform especially poorly at the very low end of their range.
A 5gal bucket should be enough volume to calibrate both the small and large sensors. You know how much water you're put through; count the number of pulses and you should be able to make a pretty good estimate of pulses per unit volume, or volume per pulse.
1.58 pulses per liter = 0.633 liters per pulse, 38 pulses per second would be 24 liters per second or 1443 liters per minute. Is this a fire engine?
It's the wacky way they spec the pulse rate versus flow rate, should be 38 pulses per second per liter per minute.
The object is to use a water flow sensor to determine whether a specific amount of water has been poured into a receptacle. I used the tutorial at -to-Use-Water-Flow-Sensor-Arduino-Tutorial/ and the code there, courtesy of Arvind Sanjeev, as my guideline. I made adjustments in an attempt to calibrate, as I measured and poured 500mL each time.
Adjusted the "calibrationFactor" in Arvind's code till it got closer to 500mL consistently. Also instead of taking the reading once every second, I modified a couple lines of the code to compute ten times per second, thinking it would be more precise.
The problem I'm seeing is, if I pour the water faster or slower, the results vary. I poured extremely slow and the result was way off, by almost +200mL! I'm wondering how to account for this, and whether it needs to be dealt with via code and/or the physical setup of my fixture? My theory is that when it's just a small flow of water being poured, the sensor keeps spinning (coasting?) resulting in a higher reading?
a flow meter of good quality should measure the flow correctly as long as the tube is always filled with fluid and a certain minimal flow is hold. The datasheet of your flow sensor should tell you which range it is able to cover. Outside this range the accuracy drops significantly. So if your application needs to handle very low volumes use a smaller tube and a smaller sensor.
I think your plumbing is extremely suss. You should try to have properly matched solid straight pipe for a couple of hundred mm each side of the turbine. Here, you have changes right at the inlet and outlet. The latter may well be fatal. Also, I submit your thinking is wrong, and the longer the time interval the better. Contrary to comment above, these devices can be very accurate. As Pylon says, they do need to be sensibly chosen for anticipated flow rate. Even then, the flow rate displayed over one second intervals is unreadable, but the daily quantity can still be within 1% of commercial devices costing serious money.
First as mentioned the plumbing is important, an old rule was ten pipe diameters upstream and five pipe diameters downstream of straight pipe. That is the inside diameter of the pipe. That means if I am using 1/2" pipe (12.7mm) I want at least a minimum of 5.0" (127mm) upstream of my flow sensor and about half that downstream. The idea is to remove as much distortion and swirl in the medium being measured. Straight pipe means no fittings, elbows, reducers or any other obstructions to the flow. How important this is really depends on how accurate and important your measurement is.
All of this applies to turbine and paddle wheel type sensors with a pulse output. There are plenty of other types but just a focus on what was used in the instructable referenced. When really getting into flow it can be a science unto itself. We are looking at this from a hobby perspective and using inexpensive parts. Not concerned with things like pressure and temperature.
The main things to be concerned with are the range and what is called K factor. The range will have a minimum and maximum value expressed in engineering units of flow and the K factor in this case is pulses per unit of volume. No reference to time at this point. Flow systems normally provide us with a rate function and a totalizer function. The rate could be expressed as units of measure per units of time Liters per Min (LPM) or Gallons per Min. Totalizer function merely counts pulses and divides or multiplies. If My K Factor is 5.0 that means I get five pulses per unit of measure. This is where limits apply. That is only true of being inside the range. It does not mean I can apply flow using an eye dropper and expect results. This is where things like pipe diameter figure in.
Something you can try for a simple dirty check is place a ball valve inline. Apply your water or whatever. Open the ball valve filling a precision marked container. Count the pulses increment up +1 count for each pulse. When the container is at a calibrated level (volume) shut the ball valve off. Whatever the pulse count is your K factor. If you want to get cool about it use a solenoid valve to start and stop the flow. If you want to get really cool place the container on a scale. One US liquid gallon of fresh water weighs roughly 8.34 pounds (lb) or 3.785 kilograms (kg) at room temperature. Have the scale turn off the solenoid. This sort of stuff can really get dragged out.
Follow the code sample and you can see what is being done and how. If all you want is a totalizer function then just write some code to increment a pulse count up using a start and stop. Once you know the K factor for a given flow turbine over a range (actually you get an Average Mean because it won't be a true constant over a range of flow).
Thanks all. This is an escape room geared project, intended for a puzzle where the object is to follow clues to produce a definite measurement of water... for example, 500mL. Pour the 500mL through the sensor, the door unlocks (with some allowance for variance). Pour the wrong amount and the test is unsuccessful... also of course trying to come up with ways to prevent them from just "eyeballing" it or continuing to pour water until the successful amount is reached.
Yes! This is pretty much what the puzzle is supposed to be, except they are given 4 gallon and 9 gallon container and have to make 6. (Although it would be a fictional measurement smaller than gallons.) The Arduino part is to determine that they've gotten the correct amount.
Then in the interest of keeping it simple I would just have them weigh their result using a S type load cell in conjunction with the Arduino. Flow can also be used totalized but there is so much more room for error. Cool though to get a door to open.
Yeah that's what I'm thinking now that I've done more testing and applied some of the suggestions here. In addition to this being my first Arduino project, I'm novice when it comes to the plumbing/water flow stuff.
One challenge with regard to having the result weighed: the ability for a player to trick the system. Example: if the puzzle calls for exactly one quart of water, player fills the jug about halfway because "that looks like about a quart" and then if the lock doesn't open, player incrementally adds a little more water.
I guess some of depends on how many attempts a player gets. Either with weight or counting pulses there is a window. That goes into your code. Just for example a quart of water weighs about 2.09 Lb. so you create a window, consider the tare weight of the container. You code will define if the weight total is greater than or less than, then open the door, else do nothing but you could say else increment a count +1. When the count reaches a preset number that's it. Then you get a system reset.
Be it a pulse count based on volume from a flow meter or a weight count you still have a window. Plenty of possibilities. The thing with writing code is as you go along you keep thinking of features to add. Finding the best sensor often involves some experimenting.
I am very new to Arduino, and have been given a project that, from what I see, requires years of experience. Basically I need to calculate how much water is flowing through a pipe. I am using a _______ Flow meter, that produces pulses from what I understand. I have done the wiring from an outlet to a converter, which drops the voltage down from 110 volts to 24 volts. I than wired the PulseOut wire to drop to 5 volts to be plugged into the arduino Leonardo that I am using.
I guess my question is how can I write a program to "count" the pulses per sometime? I did a lot of reading on the forum the last couple of days and still cannot piece together a code that will allow me to count the pulses, which I can than convert to gallons per minute. I am assuming I will have to use some interrupts, or pulseIn functions, and use the PWM ports. I just do not understand how they piece together.
connect your sensor outputting 5V to pin 2 (Interrupt 0), so you will have to rejigger your LCD pins. Since you are not using it in the code, you should be OK . There are comments in the code for you to understand...
3a8082e126