Go Down

Topic: Counting teeth, and skipping pulses (Read 3099 times) previous topic - next topic


I have a piece of equipment that I am trying to hack together to make it do my bidding, and need a basic little logic circuit to do the job.  I know this could easily be done with the Arduino, but I thought it would be a little overkill for this task.

I have a optical gate that counts mechanical teeth.  I need the current microcontroller (out of my control) to count the teeth, but instead of 5 counts, I want it to see 4.  I need it to control the motor 1 more click than it is now.  I am thinking this may be able to be dealt with some logic gates, where it throws out the first click, and only counts the next four?

Voltage levels are in the 5v range, so logic gates should easily handle the job.  The speed is slow in the world of electronics, Hz range I would guess.

Any suggestions?


It is fairly difficult to do with the gates.

I would use a 8pdip avr and program it for that.


It is fairly difficult to do with the gates.

I would use a 8pdip avr and program it for that.

Actually its impossible to do with just gates - you need at least a monostable or timer or equivalent to provide elapsed time information - you need to distinguish the starting pulse of a train of pulses based on the delay since the last pulse.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


If I have to do it with logic gates, I would use a pll (4046) with a 4x divider and run the signal from the pll through a 1:5 divider.

So a 5khz signal into the pll will generate a 20khz output signal. Dividing that by 5 gives you a 4khz signal.

Overly complicated in my view.


Can the OP clarify if there are 5 teeth, or if the issue is frequency dividing - I thought it might be a case of counting distinct groups of 5 pulses.

If its a continuous signal you could use a divide-by-5 counter to gate the pulses.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


The problem sounds like changing hardware vs. fixed software. The software is expected 4 pulses while the hardware is generating 5 pulses: for example, you have changed your encoder (from a 400-ppr encoder to a 500-ppr encoder, for example) but not able to rewrite the software.


dhenry is correct.  I have a mechanical gear that the teeth are counted by a optical sensor.  I want the gear to advance 5 teeth, but the software won't let it.  My thought was that with a little board in the middle, I could have the base software only 'see' 4 pulses.  I thought I might be able to just throw out the first pulse, and allow the rest to pass.  The frequency of the pulses does not seem to be important, and the software doesn't even care how long the pulses take to get there (jammed hardware will run until the drive belt it gone, regardless of how long).  This is to control a conveyor advancement mechanism,

I could use more than just gates, I was just trying to keep it simple if possible.  However, if it takes more than a handful of chips, I might as well just use a microcontroller.

Thanks for the input though.


I want it to see 4.

Can you explain more precisely why you want to see 4 instead of 5?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


Nov 01, 2012, 10:35 pm Last Edit: Nov 02, 2012, 12:52 am by justone Reason: 1
A long time ago they made rate multipliers (74167 is a decade one) . You could set the rate you wanted on the BCD pins and for every 10 clocks into it you could get out from 0-9 pulses. So all you would have to do is set it for 8 pulses and then for every 10 (5*2) you would get 8(4*2). The pulses would not be evenly distributed (jitter) but in your case it wouldn't matter.

In old nc machines this was a method for doing linear and circular interpolation without the need of a cpu.

I still have some in my junk drawer.


That (hc167) is actually an interesting chip. I have never seen it before.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131