0

I want to build a flow meter but the Gal/Min rating of something like this flow meter is too low. I am thinking of strapping two side by side with suitable plenums for In and Out.

I have found some sketches like this but wondering how to use the two inputs to aggregate the results to GPM and Gallons total for display on an LCD screen. I am unsure what happens if two Hall-results arrive at or about the same time but on different Data Pins.

I have priced some single sensors with a higher flow rate for the pipe size but they run to several hundred dollars. Gallons are not critical as long as I can be within about 5% error over ten minutes, our average tank fill time.

Can someone please point me at some code to get me started for an ESP32 and LCD. I'd even consider adding a Nano if that makes things easier. I imagine that would certainly prevent collision issues. Basically I need to be able to handle the flow rate to a single LCD.

Thanks

0

A Hall Effect Sensor like that just gives you a pulse every rotation (or two pulses per rotation, etc) of the internal vanes.

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.

  • Great, thanks, but reading those docs and the example code it is a little out of my programming league. Would the 2-Inputs go to the same pin or different pins? I am not sure why they say that that two ports need to be shorted. I need to find some existing code. I seem to be able to understand it better by reading code than docs. I am old. :) – LinuxFerLife Jul 23 at 20:16
  • There is an example linked from that page. It's not for the Arduino IDE, but you can take most of it. The whole of the IDF SDK is included with the ESP32 core in the IDE, so all the function calls they detail there work fine. – Majenko Jul 23 at 20:18
  • Thanks again, that was the "code" I was referring to above. I looked at the .c page, but still unsure where and how the second input goes for it to be amalgamated in the count. I have a small version flow sensor arriving a few days to test, but would like to find some code that already uses two inputs. I am not that smart --yet. – LinuxFerLife Jul 23 at 20:28
  • TBH I only just found that peripheral exists. I have no clue how to use it. It seems that each counter has two "channels" which can be either count up or count down. Each channel is associated with one pin (no idea what pins). The ESP-IDF is much better documented than many frameworks though, so it shouldn't be too hard to work out. – Majenko Jul 23 at 20:35
  • Cross referencing that documentation with the code and the ESP32's datasheet should reveal clues. – Majenko Jul 23 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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