How to count pulses per second ?

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

Reply to
Mike C
Loading thread data ...

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

Reply to
Mike C

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

Reply to
D from BC

Microcontroller sounds like the best bet. A PIC 16F628 would be ideal for this. Much easier than messing about with lots of inflexible logic. Also a good grounding too for future projects. With a 4Mhz 628 you could realistically count upto about 100Khz with some decision making in there too. (actually runs at 1MIPS though).

A programmer (suitable for the 628) will set you back say £20 tops. One of the easier chips to program. MPLAB is also free.

Lots of examples on PICLIST (type it into Google)

Reply to
Aly

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

-- Deep Fryer: A very philosophical monk. Website @

formatting link

Reply to
Tim Williams

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

Reply to
Mike C

--- Nonsense. I can do it with one chip, one resistor, one capacitor, no programmer and no learning curve.

Not only that, I can build it, test it, tweak it and post the schematic in a few hours while you'd still be struggling with source code.

-- JF

Reply to
John Fields

:)

I'd have to agree w/ JF. Learning curve would be big (at least for me).. the "one-chip in a few hours" would just work so much better :) JF: would you be able to shed some light on what I should do. (A schematic would be simply amazing)

MC

Reply to
Mike C

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

Reply to
Rich Grise

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.

Reply to
sdeyoreo

--- Basically, what you do is set up a retriggerable monostable multivibrator (one-shot) so that as long as the edges which trigger it keep coming in before the one-shot times out, they start a new timeout period, which should be precisely 100 milliseconds plus or minus whatever slop you can tolerate. That way, as long as the inputs occur quickly enough, the output will always be stable and the LED will never come on.

Which brings up another point:

If the signal drops below 10Hz and then goes back to >= 10 Hz, would you like the LED to stay on forever (Until it gets manually reset or something like that) or to go off automatically if/when the input signal goes back to >= 10Hz?

Be aware that if the latch is what you want it'll probably take more than one chip to get there.

-- JF

Reply to
John Fields

Yes but an 8 pin PIC could do this without a timing resistor and capacitor and do it in an absolute counting way that handles irregualr pulse timing like from a person pushing a switch. It would require writing some simple code and programing, of course, but would be cheaper and more stable and have a lower parts count and a smaller footprint than the one shot. The 25mA output current will drive LED's better than a one-shot. The clock is internal, no other parts required except a bypass cap and LED resistor that you have to have anyway. The one shot is OK for a do it once solution but is not the best for even moderate production of a few units. Besides, once one learns how to program and blow parts, there is no limit to what else can be done. That's a much more valuable learning curve than screwing with a one-shot.

Reply to
Bob Eld

Guys, thanks alot for your responses, all excellent & informative posts. I will most definately attempt this solution with a pic at a later time, convincing arguments in favor of the pic... and any suggestions with regards to obtaining a good and relatively inexpensive pic starter kit are definately appreciated.

In the meantime, I'd like to attempt a temporary quick-fix to my problem, as i'm working with limited components in a relatively short time-frame.

JF: I'm not sure if a monostable would fix the problem (but correct me if im wrong) Two conditions need to be met:

  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.

I'm afraid I still dont have a working solution (PIC programming aside :)

Guys, thanks for all your help again.

Reply to
Mike C

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

Reply to
Mike C

--
Please bottom post. 

That's a horse of a different color, I think. 

Duty cycle usually refers to the percentage of time a pulse is 
active compared to the sum of the active and inactive time of the 
pulse, but it seems like what you're asking for is to detect the 
occurrence of 10 or more pulses in one second regardless of the 
pulse width and separation between pulses, no?  That's a little 
trickier, but still easily doable in hardware.  Also, I asked 
earlier whether you wanted the LED to go off permanently if the 
pulse train dropped below 10pps or to come back on automatically if 
it subsequently rose to >= 10pps, but I haven't seen your reply. 
Which would you prefer?
Reply to
John Fields

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.

--
--
kensmith@rahul.net   forging knowledge
Reply to
Ken Smith

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.

--
--
kensmith@rahul.net   forging knowledge
Reply to
Ken Smith

JF: Correct, i need to "detect the occurrence of 10 or more pulses in one second regardless of the pulse width and separation between pulses", and the LED to "come back on automatically if it subsequently rose to >= 10pps" .... so the only time the LED would be off if pps

Reply to
Mike C

enough

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 :

formatting link
io.JPG

Thanks for all your time ! MC

Reply to
Mike C

--- Try this (View in Courier)

Vcc--------------------+--------+------+ | | | +---+ | | | | | | [1M]---|CPO | +----|RC R B|--+ 13|___ ___|12 | 1|_ |13 +-O|CP1 5-9|----|---O|A Q|--+ |15| | | +---+---+ | +--|MR | [4.7µF]HC123|14 [1K2] | +--------+ | | |A | HC4017 | | [HLMP4700] | | | | GND>--+----------------+--------+------+

An HLMP4700 is a 2 mA high-efficiency red LED which you can drive directly from the HC123's output.

If you cant get one, or any other low-current LED, or you'd rather use a 20mA LED, do this:

Vcc--------------------+--------+------+------------+ | | | | +---+ | | | | | | | [120R] [1M]---|CPO | +----|RC R B|--+ | 13|___ ___|12 | 1|_ |13 C +-O|CP1 5-9|----|---O|A Q|---[1000R]---B 2N3904 |15| | | +---+---+ E +--|MR | [4.7µF]HC123|14 | | +--------+ | | | | HC4017 | | | | | | | GND>--+----------------+--------+-------------------+

Also, you won't be using the other one-shot, so connect the unused inputs (pins 9,10,and 11) to ground.

I haven't shown the power pins either, and +5V goes to pin 16 and ground goes to pin 8 on both packages.

-- JF

Reply to
John Fields

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.