OpenSprinkler Forums Hardware Questions OpenSprinkler 3 wire Flow Sensor

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
  • #41300


    Could a 5v relay be put between the 3 wire flow sensor and the OS?
    I was looking at something like this.


    Solid state relay

    Flow meter

    I would think it would work…..



    You can actually use this flow sensor directly with OpenSprinkler. Specifically, you will need to solder the red wire from the sensor to the VIN (+5V) pin (all mapped out pins are on the top-left corner of the circuit board). This allows OpenSprinkler to provide 5V power to the sensor. Then connect the yellow (data) wire to the sensor terminal’s left port, and black wire to the right port (this is internally wired to OpenSprinkler’s GND pin).

    Although OpenSprinkler is supposed to only accept dry contact switch sensors, in practice due to the way it’s implemented (a digital input pin with pull-up resistor), any sensor that outputs pulsing signals (between 0 and 5V) are also acceptable. This flow sensor has a Hall effect sensor, which is powered by 5V and outputs 5V squarewaves. So it should work just fine.

    Because there is a 4.7k series (protective) resistor between the sensor (which outputs up to 5V) and the digital input pin (which is only 3.3V tolerant), you don’t need a level shifter (most digital pins have internal zener diodes, which will clamp the voltage coupled with the series resistor).

    The only practical issue I can imagine is that this sensor can send very high frequency pulses which may exceed the maximum frequency the firmware accepts (200 pulses per second). If needed, this can be changed in software to accept higher frequencies.



    Hi Ray,
    following your post, I wired up a cheap hal-sensor driven flowmeter with ease! Working so far, providing readings. But specs are 270 pulses per liter, which is a 0.0037 liter per pulse. Any chance you can mod upcoming release to support others than full integer in liter/pulse setup? (or pleae direct me to how modify myself). Those Flowmeters are cheap and I have demand for various installs here.




    I am about to install a hall effect flow meter into my mains line, my sensor is rated 1-120 l/m with Q=4.5. Therefore, at full flow it will produce 540 pulses per second, in excess of the maximum of 200 stated by Ray. I see a few options to solving this:
    1. Assume the flow wont go above ~45 l/m (poor option)
    2. Modify the firmware to allow 540 pulses per second
    3. Introduce hardware to reduce the pulse rate by some factor

    Option 2 is likely the easiest, although changes like this always have downstream maintenance issues with future firmware updates. The micro would also have to deal with 540 interrupts per second, although the isr overhead would be low since all it does is increment a counter.

    I think option 3 might be the best solution here with a divisor of 27 to give 10 pulses per litre and a maximum pulse rate of 20/sec. A regulator, Attiny85 and transistor should fit the bill here nicely. Configuring the transistor as an open-drain allows for voltage level matching using pin1 of the flow sensor on OpenSprinkler with its built in pull-up resistor. This setup might even fit into the head of the flow meter, or perhaps as a daughter board within OpenSprinkler.

    Anyone have any comments?



    @mcmuller: currently the firmware only allows up to 2 decimal points precision for pulse rate. You can actually input 0.37 as the pulse rate, and just remember that the reported volume is 100 times the actual volume.

    : same as above: try to multiply pulse rate by 10 or divide by 10 so that it fits in the range.

    Another way is to input 1 as the pulse rate, so that the reported volume is actually the number of pulses. You have to further multiply it by the correct pulse rate to get the final number, but hopefully this is not too complicated.



    @Ray Thanks, that hint was helpfull!



    I am finally getting around to installing my water meter. Going through the maths and firmware for determining the best divider to use from my sensor, I have hit a bit of an issue. In this thread @Ray states the maximum rate of pulse accepted is 200 pulses/sec, however, looking through the firmware the debounce period seems to be 50ms which would only allow 20 pulses/sec?

    The only practical issue I can imagine is that this sensor can send very high frequency pulses which may exceed the maximum frequency the firmware accepts (200 pulses per second).

    ulong curr = millis();
    if(curr-os.flowcount_time_ms < 50) return;  // debounce threshold: 50ms
    os.flowcount_time_ms = curr;

    For my application this isn’t a huge issue since my flow meter far exceeds the max rate so will need a divider anyway. If I divide by 270 rather than 27 I should end up with a single pulse per liter giving a maximum rate of 2 pulses/sec at full flow of 120 l/min. Or perhaps divide by 135 to give max of 4 pulses/dec.



    That’s a good point. That debounce time should be 5ms in order to get up to 200 pulses per second. Need to fix that in the firmware. Admittedly, the flow sensors we tested all have a pulse rate strictly below 20 pulses per second. The 3-wire flow sensors generally have much higher pulse rates.



    I really think just having raw pulse output from flow sensors can be useful by itself. In my case, I have 2 flow sensors installed on my irrigation lines. One is at beginning of mainline by shut-off valve, and a second one is at the end run (downstream of flow) of a valve which only waters a small garden of tomato plants. In the latter case, water use is minimal but I like to check that its programmed runtimes are operating normally.

    Mainline (2-wire) flow meter is built to output 1 pulse to 0.1 cubic ft. or 0.748 gallons. There are at least 8 valves which would pull water from this mainline. So monitoring overall water use is the only function of that flow meter.

    OTOH my second valve has a flow sensor(3-wire) which monitors a couple of micro-irrigation spray nozzles. It is programmed to water each day, 4xday, but for 1 minute only. I see on graph of pulse transmitter #118134 that these watering events are taking place because I see four peaks of flow with graph of pulse data. That is on page 1 of link below:

    If you scroll further down the doc to second page, I have a graph of (wireless) pulse transmitter #301214, I think it’s evident that it’s impossible to detect such a small amount of water use from the second valve by looking the ‘big picture’ graph of mainline flow data. So in this case, scaling pulses to gallons (or milliliters) is totally unnecessary and mostly an exercise in futility.



    One other thing I’ve learned in trying to calibrate pulses to water flow (in gallons per minute or milliliters per second) is the problem that can arise if you’re using a shallow well pump, and water table begins to drop because of extended drought and no rains. What eventually happens is that the water table drops, the pump starts pulling in a little air mixed with water, and it will gradually get worse until the pump runs completely dry and burns up the motor. A flow sensor will probably not detect this condition in a timely manner, because the internal paddle wheel of flow sensor still can be spinning to produce pulses even when it’s pushing air mixed with water. Your line pressure is dropping, actual GPMs are low but again, and you may have inaccurate flow data as the pump is overheating and water pressure is dropping off.



    My apologies if this post is a duplicate… The original post seems to have been deleted when I editied it to be notified of follow-up replies…

    I’ve just hooked up a 3-wire [Nymet] flow sensor to one of my controllers (2.1.7(2) firmware). All of my controllers are v3.0 hardware and I’m assuming that 3-wire sensors are now ‘fully’ supported with that platform becuase it includes external connectors for a +5V supply as well as GND and two sensor inputs (SN1 & SN2). Having read that SN2 is not currently used, my flow sensor is conencted to SN1 (as well as +5V/GND).

    My flow sensor is conencted to the controller that is located next to my pump, and when that controller opens a valve, appropriate messages appear in the log. There is a problem displaying log messages since installing the flow sensor, but I’ll raise that matter in another post.

    The main issue I have at the moment is that the flow sensor doesn’t seem to trigger any events if there’s no program running on the local controller. If valves conencted to any of my other controllers are opened, and the pump starts running as a result, the flows do not appear to be recorded.

    Is that the way things are meant to work? I can reason that it may not be desirable to be writing a constant stream of log messages, but it would be of value to be writing messages when non-zero flows were detected.

    My application is a rural application and apart from monitoring normal pump output regardless of whether or not the local controller was running a program, I was also hoping to use this data to detect, and ultiamtely [automatically] respond to, abnormal events, like a blown hose joint or a burst pipe.



    Sorry, if I’d searcheed a little more widely first, I might have noticed that the following post ( seems to answer my question.

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums Hardware Questions OpenSprinkler 3 wire Flow Sensor