Converting pulses per minute (uneven pulse width) to analog output signal

Thread Starter

Mahonroy

Joined Oct 21, 2014
406
Hey guys, I have a flow meter that outputs pulses based on the flow. 1 pulse per gallon of liquid.
There is a rotating mechanism inside the flow meter. The faster it rotates, the more pulses it generates:
1 pulse per minute, up to 40 pulses per minute. (same as 1 gallon per minute up to 40 gallons per minute).
Also, the faster the flow, the more narrow the pulse width is because the mechanism is spinning faster.

A typical application would be to count the number of pulses per minute and correlate that to flow.
Another option would be to count the time between pulses and correlate that to flow.

What I am wanting to do is to create a circuit that takes these pulses, and converts it to an analog signal (0vdc to 3.3vdc). I will then read this analog voltage and correlate that to a flow.

If the pulse widths were set to be the same, regardless of flow rate, then I could use a low-pass filter to convert this to analog.

But since the pulse widths decrease as flow rate increases, a low-pass filter will not work because the duty cycle isn't changing.

Is there another method for accomplishing this? I feel like if there is a way I could somehow normalize the pulse width of these pulses, then I could then use a LP filter, but I am not sure how to do that?

Thanks and any help is greatly appreciated!
 

Thread Starter

Mahonroy

Joined Oct 21, 2014
406
Seems like an odd requirement in the digital age, but have you considered a low-pass filter?
Yes, but I mentioned above regarding the low-pass filter is that it would not work, because the pulse width decreases as the flow increases (proportionally because its based off a spinning mechanism, the duty cycle is not changing).
 

BR-549

Joined Sep 22, 2013
4,928
Why not detect the transition, and pair it with a time stamp(RTC). The stamps give you the number and length per time.

Compare that to a look up table for desired range.
 

LesJones

Joined Jan 8, 2017
4,174
You could trigger a monostable multivibrator from the rising (or falling.) edge of each input pulse. That way you would make the length of the output pulse constant. If these constant width pulses were fed into a low pass filter it should give the result that you want.

Les.
 

crutschow

Joined Mar 14, 2008
34,280
You could use a 555 non-retriggerable one-shot to give a short pulse (say 20ms), for every sensor output pulse.
But that will have a very low average output voltage when averaged over a minute for 1 pulse per minute (about 80mV).

How fast will the circuit need to respond when the flow rate changes?
The circuit above would need a LP filter with a several minute time-constant.

I think you may want to consider some sort of digital approach, such as measuring the pulse period.
This could be with a microcontroller, or a digital counter driving an LED display.
If you really need an analog output, that could be done with a DAC from the digital period.
That will respond within one pulse period to a change in flow rate.
 
Last edited:

Alec_t

Joined Sep 17, 2013
14,280
I agree with Crutschow. At only 1 pulse per minute a wholly analogue approach would be next to impossible and far from accurate.
 

djsfantasi

Joined Apr 11, 2010
9,156
A blue-sky idea...

  1. Start with a pair of binary counters to count the number of pulses from the flow meter
  2. Add a circuit to provide one pulse per minute. A 555/divider circuit for example. Use the output of this subcircuit to reset the counters in phase 1 (above).
  3. Build an R2R ladder as a cheap DAC.
  4. The output of the DAC circuit is an analog voltage corresponding to the flow rate.
 

Thread Starter

Mahonroy

Joined Oct 21, 2014
406
Thanks for the suggestions so far!

I dug deeper into the 555 timer approach (monostable multivibrator), and here is what I have come up with so far (I simulated it):
555_timer_2.jpg

The left graph is the flow meter pulse, the middle graph is the 555 timer output, and the right graph is the output passing through an RC filter.
I changed the frequency from anything from 0.666 Hz (40 pulses per minute), to 0.0833 Hz (5 pulses per minute), and it seems to work ok. Downside is its slow to stabilize at a value.... how it is now it takes about 4 minutes to stabilize.

I wonder if there is a way to essentially get the period, and convert that directly over to an analog reading... or a way to get more of an instantaneous reading instead of having to wait for the filter to stabilize?

The reason why I can't do it digitally with a microcontroller and timer is because the only interface I have available is I2C. For this project, I2C is the only interface I have available for this.... so I can use I2C to interface up to an ADC.... but I am not really aware of any other way to get this information via I2C... so it seemed analog might work. I can also only take a reading every couple seconds or so. So there is not really a way for me to time the pulses directly.
 

danadak

Joined Mar 10, 2018
4,057
This is a one chip solution, accurate to ~ 12 bits.

upload_2019-6-17_19-11-49.png


PSOC 4 or 5LP. Most resources still unused, see right hand window.

This also has I2C if you need to offload values.


Regards, Dana.
 
Last edited:
Top