REXYGEN Community Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Login

    Measuring water flow with UniPi

    REXYGEN Studio
    4
    4
    1.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      contactform
      last edited by

      Hello,
      I need advice which REXYGEN system function block to use for water flow measurement. The sensor is connected to my UniPi v1.1 and gives me input 200-400Hz (according to the flow). I need to measure the flow every second. I tried using the COUNT block, but no success. Illustrative image is attached.
      0_1554841301410_water-flow-unipi-rexygen.jpg
      Thank you in advance for your help.
      Karel

      1 Reply Last reply Reply Quote 0
      • cechuratC
        cechurat
        last edited by jaroslav_sobota

        Hi Karel,
        the COUNT function block is definitely a good choice, however you should be aware of project timing because of quite high input frequency. I recommend you to have a look at example "0120-23 Frequency of Pulses". Change the project timing so the "tick" parameter is 0.001 s (within the EXEC function block) and "ntick0" according to your needs.
        It means that Quick Task will be executed every 1 ms and task on Level0 every 0.001*ntick0 [s].

        Note that the period of 1ms is quite challenging for Raspberry Pi. I would recommend to use Raspberry Pi 3B+ and watch diagnostics.

        Hope it helps.

        Regards, Tomas

        1 Reply Last reply Reply Quote 0
        • E
          enovikoff
          last edited by

          I just had to solve this problem myself. I did some back-of-the-envelope calculations and decided a Pi was just too slow to count pulses this fast AND do all the other work I wanted it to do. So I created a small printed-circuit board with the MCP23017 connected to a SN74LV8154 dual counter after searching fruitlessly for a Pi HAT that included a counter. The counter counts the pulses, the MCP23017 interfaces the parallel outputs of the counter to the I2C bus, and I modified the Rexygen-supplied MCP23017 driver to return the count values and multiply them by calibration constants. Another possibility would be to use a separate microcontroller like the STM32 to count the pulses and return the sum by I2C, but I didn't want to learn the entire software environment of the microcontroller just for that one task.

          This solution is working very well, however it required electrical engineering knowledge and learning a PC board design tool (kicad).

          If you only care about flow rate, another option is to build a RC filter circuit to transform the pulses into a voltage, and use a ADC card to read in the voltage. This doesn't work well for total fluid volume calculations because again, the Pi would be required to integrate the voltages at a high speed.

          jaroslav_sobotaJ 1 Reply Last reply Reply Quote 0
          • jaroslav_sobotaJ
            jaroslav_sobota @enovikoff
            last edited by

            @enovikoff said in Measuring water flow with UniPi:

            after searching fruitlessly for a Pi HAT that included a counter

            What about the Monarco HAT? It has 2 high-speed counters onboard...

            c4629344-c4c5-48a8-a65e-7e00fd14755d-obrazek.png

            Jaroslav

            1 Reply Last reply Reply Quote 0
            • First post
              Last post

            This is a community forum for REXYGEN users and fans. Detailed information can be found at REXYGEN homepage.

            There is also an outdated REXYGEN community forum.

            Powered by NodeBB.