# How to count pulses per second ?

Discussion in 'Electronic Design' started by Mike C, Feb 13, 2007.

1. ### Mike CGuest

Hi, I'm hoping someone could help me create a very basic circuit which
would:

Count the number of pulses it receives per second (from a 555 timer,
or a switch, for example) and if the number of pulses per second is
equal to, or greater than 10 it turns on a transistor.

So basically it should check every second if a clock frequency of 10Hz
is being met - if so, a transistor should turn an LED on and keep it
on for as long as 10Hz a second is hitting the circuit. As soon as the
clock stops, or the frequency goes below 10Hz, it should turn off the
LED.

Thanks so much for your help !

MC

2. ### D from BCGuest

Maybe give the LM2907 Frequency to Voltage IC a boo???
D from BC

3. ### Tim WilliamsGuest

If it's constant, missing pulse detector. Can be made from a few
transistors, or a few transistors and a comparator, or a single chip
(LMxxx?) that does it. Hell, it can be done with the 555, IIRC.

If it's not constant, then a decade divider like CD4017 set to reset every
second (so you need another clock) and something to say that it's got enough
counts or it doesn't.

Tim

4. ### Mike CGuest

Guys, thanks alot for your response. In this case, the clock
frequency is variable, so it would just need to count the number of
cycles per second, and a missing pulse detector may not do it. I can
see how a decade divider could work (I just dont have any lying around
now, and would like to build it this week). What did you have in mind
by doing it w/ just transistors and a 555 ... or a comparator .. im
looking for anything crude and simple.

Thanks again !
MC

5. ### Rich GriseGuest

The dead simplest would be an RC low-pass or high-pass, and a comparator.

You'll have hysteresis, if you don't want your comparator oscillating,
and it won't respond very quickly, but it'll demonstrate the concept.

Good Luck!
Rich

6. ### Guest

Do this: put your clock freq into a counter, say a divide by ten.
Every second, with another clock set to a freq of one second, look at
the output of the divide-by ten-counter. If it overflowed, it was
faster than 10 pulse per sec. Use an AND gate to check the output of
the divide-by-ten and the one hertz second clock.

7. ### Mike CGuest

sdeyo... : An excellent approach. I will attempt this shortly and see
if this works.. many many thanks

8. ### Ken SmithGuest

Is the "check every second" really a requirement?

If not, the question can be rephrased as "if the pulses have a period
less than or equal to 0.1 seconds"

I suggest a couple of retriggerable oneshots like the HC122. Both are set
for a 0.1 second time. The first is triggered simply by the pulse. The
second has the AND inputs of the trigger used to combine the pulse with
the output of the first.

9. ### Ken SmithGuest

LM339's come 4 to a package. You could make a one shot action by having
one discharge a capacitor and another monitoring the voltage on it. This
way, the first comparitor oscillating won't show at the output.

10. ### Mike CGuest

Ken: I'm not sure if "the pulses have a period less than or equal to
0.1 seconds" can be considered the same thing in this case... because
you could still have less than 10 pulses in a second even if they have
a .1 sec period.. but maybe i'm not understanding how it would work..

basically, two conditions have to be met for me:

1. If and only if the pulse train coming in >=10Hz (10 "up" cycles
per second with no particular duty-cycle pattern) only then turn on a
transistor.
2. Otherwise, if the pulse train count goes below 10 cycles at any
point, turn off the transistor at once.

So the output should be HIGH only if 10 cycles per second (or higher)
are counted, otherwise output is LOW. Here is an example of the
input and its required output : http://tiberian5.googlepages.com/
io.JPG

Thanks for all your time !
MC

11. ### Guest

I used this years ago to decode morse code. Determined if it was a
dash or a dot by if the counter overflowed or not. Same with long and
short spaces. Worked good!

12. ### Ken SmithGuest

Here's the real question: How long does the 10 cycles per second need to
be there before we turn the LED on?

If it is a full second then you need to have a system that measures the
number of pulses in one second. If the measurement only needs to be made
over a 0.1 second period then the dual oneshot idea will work.

If at any point it goes below 10Hz, implies that you will react in 0.1
seconds to a pulse being too late.

We may need a 3rd oneshot to impose the rule that the pulses remain at
10Hz for a full second, if that rule really exists.

13. ### Tim WilliamsGuest

Imagine this: the AC line frequency is 60.0Hz or so. It varies a bit. Yet,
there are many household clocks which keep time precisely by this standard.
Why aren't the power companies screwing these all up? Because, although the
frequency itself may not be precisely regulated, the number of cycles per
day, let's say, *is* kept in check. Although the clocks may cycle faster
sometimes, they also cycle lower sometimes, keeping it accurate over long
average periods.

The same works here. You can tap out nine pulses really quick, but if no
tenth pulse comes before this counting second finishes, your counter is
going to say fail. The average pulses per second is still ten, but they
didn't come evenly. THIS is the question we are asking you.

If the pulse length is roughly equal for all ten pulses (i.e., the rate
doesn't change much during that second), then a missing pulse timer type
circuit will work very simply. It will not work if the pulses are
significantly displaced (as elaborated above), because that long empty space
between the first 9 pulses and the 10th will trigger the timer to send a
fail.

Alright. Then please, don't call it hertz -- if you must, call it _average_
hertz. The reciprocal duration (i.e., Hz == 1/s) of each cycle varies, and
could be 2Hz or it could be 50Hz, so long as the average during that second
is 10Hz (10 pulses per 1 second, explicitly so).

Again, if it changes slowly (perhaps 9.7 to 10.3Hz), a missing-pulse
detector (set for perhaps 0.103 or 0.104 second trip time) will suffice for
reasonable accuracy. Which is another concern- how accurate must this be to
exactly 10 cycles? Are the cycles what count, or the time or frequency?
....And it'll take one second to reach this decision, correct? Obviously it
can't know if ten cycles have passed in that second unless they have.
(Arguably, you could have a circuit count the average *continuously*, with a
time constant of one second. Even a simple RC integrator would accomplish
this, roughly speaking. But this also reduces to a missing pulse detector.)
That looks like it is varying pretty widely, though the Hz input count makes
me feel like the input is some constant frequency during that count period.

Tim

14. ### Fred BloggsGuest

Your requirements are contradictory. On the one hand you insist that one
second be the shortest interval over which you make the determination of
once" if <ten pulses. Sampling a count at one second intervals cannot
possibly considered "at once." You will never get anywhere with this
kind of confusion, and it would be best if you describe the circuit in
specific terms of just exactly what it is instead of giving everyone
your hopelessly confused idea of the essential abstraction.

15. ### Ken SmithGuest

The requirements are only, sort of, contradictory. They could be read as
the 10Hz or greater rate must be maintained for a full second for the LED
to go on and a single late pulse turns it off again. Basically, this puts
a one second oneshot into the design where true on its output means the
LED is off.