arduino lcd displays flow meter gpm and total in stock
This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.
This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.
If they are fast or you have delays in your code, you should use an interrupt. There are 3 available from the UNO. Int 0 (D2), Int 1 (D3) and ICP1 (D8).
If they are very fast (>1Khz), only the ICP1 should be used, in conjunction with timer 1. This is useful for frequency or RPM measurement (in general flowmeters are not that fast)
If you use interrupts to count the pulses then two pulses arriving at the same time will be handled sequentially. The interrupt flag indicating a pulse has arrived is set in hardware the moment the pulse arrives, and the CPU checks all the interrupt flags between instructions. Each flag is handled sequentially, the order determined by interrupt priority settings and a "natural" order determined by the internal wiring of the CPU.
However there is a better way on the ESP32, and that is the Pulse Counter peripheral. This is designed to count pulses like the signals from Hall Effect sensors.
You can just leave the Pulse Counter counting your pulses, then periodically read and reset the pulse count to see how much water has flowed in that period. It looks from the documentation that you can have two inputs both making the same counter increment, so it will do the aggregating for you.
Displays the flow total volume, flow rated and sensed temperature clearly; custom icons on the display indicate the controller working status at a glance
This project was done for a Friend Of a Friend. He needs to monitor water flow rate and quantity for his solar heating projects. He is mainly interested in this two inch sensor but also sent along a small plastic hose bib type similar to the Adafruit 828. Both of these sensors are turbine types, water flow spins a plastic wheel which magnetically triggers a pulse output proportional to the speed at which the wheel is turning. There’s lots of these sensors made for irrigation and industrial processes. The display is sometimes called a “Totalizer”.
The electrical interface on the small flow meter has 3 wires, power, ground, and pulse output – relatively simple to connect to the microcontroller. But the large device has only 2 wires. It signals a pulse by shunting power to ground through a low resistance. The display must sense a pulse by looking for an increase in supply current. I designed an interface circuit that works with either unit by changing an option jumper. I constructed the interface circuit on a small piece of project board from Radio Shack (RIP). The positive supply feeds through a resistor which produces enough voltage drop when the large sensor is pulsing to trigger a digital low at the Arduino. The series resistor value is low enough that the power feed is still adequate for the small plastic sensor, so the option jumper just selects where to pick off the pulse signal. A series resistor and zener diode make sure the voltage ratings of the Arduino input pin are not exceeded. It’s a bad thing to overvolt an Arduino pin, please Don’t Ask Me How I Know This.
In this photo you can see the interface board soldered down near the front of the Altoids tin. I use “L” shaped bits cut from a paper clip, soldered to the board ground, and to the ground plane. The same technique anchors the Arduino board.
At first I worked up the circuit on a solderless bread board using code from the Adafruit web site. When satisfied with the results, I went ahead with building the Altoids tin prototype. The Arduino variant I used is a Sparkfun Pro Mini 5 Volt. It takes up little space and has a 5 volt regulator with enough capacity to run the 16×2 LCD. An LED and two push buttons protrude through the lid, these are regular 6mm square PCB buttons. I solder one side directly to the lid, the other side of the switch is supported by a bit of PCB material and a piece of paper clip wire.
This photo shows the LED and the Reset button. Note the bit of PC board on the high side of the switch has a groove filed across so the grounded paper clip is isolated from the signal connection.
This photo shows the Function switch. It’s hard to see, but there is a 0.05 ufd surface mount capacitor soldered between the signal side and ground. That capacitor is part of my debounce strategy.
The Liquid Crystal Display itself mounts on four 2-56 screws. The screw heads are soldered directly to the lid. I attached a 10k Pot for contrast adjustment to the back of the LCD and it’s legs are used as tie points for 5v and ground wiring to the rest of the display.
If I have to build another one of these, I might glue the Arduino board to the back of the LCD which will greatly reduce the wiring between lid and box.
There is a power jack for 9 or 12 volt DC input, and a 3 conductor phone jack to connect the turbine sensor. These are epoxyed to the box. Connection to the sensor plug is as follows:
Almost all of the turbine type flow sensors I looked at have two calibration factors specified: a “K” factor and an “offset”. During calibration the manufacturer measures the pulse rate outputs for a number of precise flow rates. These are plotted but since the turbine has some friction, the graph will not be linear especially at the low end and a linear regression is done to get a best fit straight line. The “K” factor represents the slope of the fitted line and has a dimension of pulses per unit volume moved. Offset represents the small amount of liquid flow required to start the turbine moving. You can assume that if any pulses are arriving at all, at least the offset volume of liquid is moving. The 228PV manual specifies:
In general, this formula applies to any measurement unit. It would be possible to convert a gallons display to liters by just scaling the K and offset factors by the constant liters/gallon. The Adafruit example sketch uses this method but measures pulse period in 1 millisecond increments which creates large gaps in the data if the pulse rate is over 100 Hz. At 200 Hz the pulse period will be 5 milliseconds, so a 1 millisecond period change is a 20 percent jump!
Adafruit states their sketch is just an example to verify their sensors functionality but I felt higher accuracy at large flow rates was essential. An internet search turned up several sketches using a direct interrupt to count pulses. The sensor pulse train is applied to pin 2 or 3, fires on the rising edge of a pulse and calls an Interrupt Service Routine like:
Can’t get much simpler than that. Run this for exactly one second and you have counted pulses per second. Apply to the above formula and get volume units transfered in that second. Accumulate that many units each second to find total volume transferred. So the code to actually calculate rate and volume is easy. I exorcised most of the Adafruit code and added my own formulas. I also added a line in the ISR to blink the LED along with the incoming pulses.
But this display needs to operate with multiple types of flow sensors. So I had to code an arrangement to set and permanently store K and Offset for whatever sensor was plugged in. That turned out to be the most complicated part of the sketch. I use the Function button to do this, taking advantage of the Arduino setup section which is only executed on a reboot. Holding Function down while resetting the processor starts set mode.
To make this a little easier, I added code to blink the LED if the button is held between 2 and 4 seconds, and turn on the LED solid if held more than 4 seconds. I hope this is no more annoying than setting a cheap digital watch.
This photo is the normal running display entered after exiting set mode, or on a processor reset. The first line records units moved per second, where units is in whatever the given K factor uses. Both the Adafruit sensors have factors specified in Liters/Second. The 228PV I’m working with uses units of Gallons per minute. The water meter on my house here measures in cubic feet. You have to consult the sensor data sheet.
I’ve constructed a second unit. This one is built in a nice looking Extruded Aluminum box from Adafruit. I thought the better enclosure would make construction easier. I was wrong. Because it can’t be opened you can’t reach in and solder anything, and you lose the convenience of soldering anything needing a ground directly to the tin box. That means wires have to be attached to every terminal, brought to a common point and spliced. I did try soldering the Pro Mini to the back of the LCD and that works but the contrast pot had to be wired out so the assembly didn’t save much wiring. This photo shows the completed display with K factor set to 1.0 and a 2000 Hz crystal controlled signal applied to the sense input:
Most of these flow sensors will have specified somewhere in the data sheet, a K factor and offset. What the manufacturer does is plot flow in output pulses per second (frequency) against flow volume through the sensor at a number of flow rates. Then they do a linear regression on the data to get a best fit straight line. An example is Fig 1 in http://www.hofferflow.com/datasheets/miniflow2.pdf.
There does not seem to be a standard for how K factor is presented. Sensors output a pulse stream at a frequency proportional to the flow volume as calibrated, this can be measured. With some sensors, you multiply the pulse frequency by the K factor to obtain a volume rate. Others however, require you to divide the pulse frequency by K.
In the sketch, I added a way to switch between these two methods by using the first character of the K factor. If this character is a “*”, the incoming pulse rate will be multiplied by the K factor, If the first character is “/” pulse rate will be divided by K. You may see a formula in the sensor data sheet like Freq = (Flowrate * K) – offset. Since we measure Frequency and need to display Flowrate, the formula is rearranged toFlowrate = (Freq + offset) / K and the K factor needs to be set to type “/”. Other sensors present Freq = (Flowrate / K) – offset. Rearranging that formula gives Flowrate = (Freq – offset) * K and you would set the K type to multiply, “*”. If the sensor documentation is not clear, just try it out. If the multiply/divide indicator is wrong, you will probably get totally unreasonable flows displayed. If so try changing the type indicator.
I was able to interface an existing netafim flow sensor to the rain sensor input on the OS, and modify the main.cpp to display the flow rate when valves are turned on. It was amazingly stable (see attached picture GPM display.jpg). the 6.36GPM varied from about 6.32 to 6.40GPM (once the line fill event occurred, which could take 1-2 minutes). During the line fill event you can see a much higher flow rate until the line is pressurized and stable (so the algorithm to record and detect leaks should wait until after 2 minutes before recording the actual flow rate and checking for leaks etc.
Two other images are also attached if you want to look at the reed switch output from the flow sensor. The pulse is around 50% duty cycle (I thought it would be more of a narrow pulse but isn’t). The rise time is pretty slow since the pull-up is weak, however I didn’t observe any weird GPM readings or multiple interrupts for each pulse.
The log files seem to be recording rain sensor events, so if this input is used for flow we should insert flow rate in the log once the valve is turned off instead of a rain sensor event for every pulse (fills up the log with those quickly). I haven’t done that yet.
Ideally the system would know if all valves are off, and after a predetermined time (lets say 1 hour) it see’s a couple pulses then it would email or text alerts to someone that there is a water leak. Our faucets outside are on the same lines so when we wash the car etc we may want it to only alert if a leak is detected for at least a certain amount of time.
If a valve is turned on, and if run >2 minutes, then the flow rate would be recorded and compared to perhaps a user defined range. If it goes outside that range, email/text alert would be sent out that the zone has a problem. This is great not only for water line breaks or heads that break, but also if the valve doesn’t turn on then you could detect underflow too.
Here is a summary of the lines of code I added to test the flow sensor. I’m using one from NETAFIM but just about any flow sensor that handles the flow rate of your irrigation system with a reed switch output should work. A good irrigation system flow sensor will cost a couple hundred bucks but well worth it.
In my web searching for digital (hobby cost) stuff the main issues seem to getting the correct sized stuff that have temp ratings for the actual flow sensors to match our needs, plus the rate per min needs to be able to go very low.
A lot of them appear to only rate to 60 C or 80 C , and we really need to be accurate with flow rates between 0 - 2 lt/min, many start at 1lt/min or more, seems the larger the diam sensors, the less bottom end range.
My flow meters are handy for ensuring the pump is running and when full on both lines its fine, but trying to read reflux water flow, I cant really tell because the flow is so low and the gauge sits at the bottom hardly moving at all.
so the one I linked is 1.5-25L/min... I think that this is a good range for 4"-8" pumped systems, 4" city water may not use that much, and the 1/4" or 3/8" one may be better for that... thoughts on that?
yep they were 1/4 inch which was very annoying i had to find some 1/4-1/2" reducers to match the SD fittings im not to sure how much of a restriction they cause for a small system but for @CothermanDistilling unit i would think it would make a difference for cooling
@cooperville - good stuff! true, a small restriction at just one point doesn"t kill the entire flow, just adds some resistance and may still work.... for the 4" dephleg, I actually was feeding it with city water through a 1/4" solenoid valve, but that was 60+psi still looking.... FWIW, futurelec cost for display with 1/4" sensor, and spare 3/8" and 1/2" sensors is $40..
@CothermanDistilling I will be home tomorrow and I will check the size of mine and where the heck I got them from. My 6700 are rated for 0.4 to 3.7 GPM but I get a steady reading as low as 0.2 GPM and with a standard 4" deph the sweet spot is usually 0.3 to 0.4 GPM with reservoir temps in the mid to upper 20C
I have the panel mount 6710M in 1/4", they read down to 0.01L/M and go to 1.0L/M, running one on the dephleg and the condensor, I constantly get 0.35L/M through the both of them when needle valves are fully open, not sure if it is restricted due to the 1/4" sizing or the pump is too low flow (it is a large aquarium pump and have used it successfully for the last 9yrs or so, but on a still needing a lot less flow) or if they are restricted at all... but they do seem to work,
bought on eBay for approx $78.00NZ and they were shipped to me in 2 days from the UK. thinking I might try some 1/2" sensors on the same meters and see what they are like and if flow does actually go up.
@Mickiboi - when you get it, can you show a picture of the display from a side angle and back angle, I saw that one, but not enough pictures... the numbers you guys are giving are great!
@CothermanDistilling Home at last!!!The 6700 has 3/8" connections. Have you tried to find the 8100T-44, it has 1/2" BSP connections and it seems very similar to the hard to find 6710M-44TM I sourced mine from filtersdirect.com
This last one is the the panel mount... so I am looking at two options, the one you have, 6700M with 3/8", all-in-one, or the "commercial" one with the panel mount and remote sensor such as the 6710M-44TM
Some of the sensors on these units appear to be the same ones that go for $3-5 right. If you are just paying for the electronic component mostly an arduino should be a much cheaper option? If your reboxing anyway. You would need arduino sensor and display.
@CothermanDistilling . My flow sensor finally arrived. It took 53 days, I could have sailed there myself and got it by then. Haven"t plugged it it or tested it yet. Seems ok to me though. It came with a temperature sensor. Looks like it should panel mount pretty easy. There is a 5mm edge overlap on it so if you cut the hole too big it wont fall through. As for the postage time try and find another supplier rather than the one I used.
flowSensor = (2 * pulseCount) / calibrationFactor; // number of pulses in half a second, so twice that for a minute divided by the calibration factor0
Thank you for this great article--it"s been helpful but my water flow project has an added dimension; I need to incorporate code that when over a period of time, e.g 100,000 ms, if there is no flow, then an analog pin on the UNO is given a HIGH (if no_flow==true).
Used the code and ran some test on the pulseCount value. This might overflow when byte datatype is used. Using volatile int there is no risk to that.0
Hi, how did you calculate the 4.5 for the calibration factor? I have purchased a slightly different sensor (as it better fitted the requirements for my project) but it"s showing me moving thousands of litres? I can use a measured amount (I.E. fill a 2L water bottle and count the pulses) but this seamed a little mad? Any help would be massivly appricated!0
It"s taken me a couple of weeks to rebuild this so it works with a Node MCU, but in basic you need to look into how NodeMCUs process interupts, as they are a little different to the arduino, Hopefully I will upload the code once the projects done1
I have a project to be made i.e. water Billing System using RFID(Mfrc522) on Arduino NANO. There is one difficulty that I haven"t been able to overcome. I hope someone could help me out.
edit code such that it as soon as water flows through it, it calculates and ask the user to swipe the card, and as user swipes an amount deducted and process continues.https://arduino.stackexchange.com/questions/75761/arduino-project-interrupt-error
I was stuggeling for quite a time to get my flow sensor working. Tried several tutorials and sample code"s I found online, this one was the most promising, and most well detailed and explained. Nevertheless it did not worked, values vere keep showing as "0", nothing happened. Until I tried to changed this line:
Now, numbers are coming, it seems to work. I still don"t understand why (*), and I am still not sure if the values are correct, but this I"ll be able to check via mesurement (pour some liters thru the sensor and see, what happens)
The code in this tutorial may be confusing for some. The signal pin from your flow meter should be assigned to the pin you define for sensorInterrupt on line 12 of the sample code. I was setting my "signal pin" and defining the variable on line 13.0
Running Javascript directly on an Arduino? No. But you could look into a library like "Johnny-Five" which does allow you to run an application written in Javascript on your computer and have it issue run-time instructions to an Arduino over a USB connection. Probably not what you"re looking for.0