Go Down

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

#### kiltjim

##### Oct 31, 2012, 04:04 pm
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?

#### dhenry

#1
##### Oct 31, 2012, 04:16 pm
It is fairly difficult to do with the gates.

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

#### MarkT

#2
##### Oct 31, 2012, 05:27 pm

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 ]

#### dhenry

#3
##### Oct 31, 2012, 05:57 pm
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.

#### MarkT

#4
##### Nov 01, 2012, 02:33 pm
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 ]

#### dhenry

#5
##### Nov 01, 2012, 02:45 pm
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.

#### kiltjim

#6
##### Nov 01, 2012, 05:27 pm
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.
Jim

#### robtillaart

#7
##### Nov 01, 2012, 08:05 pm
Quote
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)

#### justone

#8
##### Nov 01, 2012, 10:35 pmLast 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.

#### dhenry

#9
##### Nov 02, 2012, 03:16 pm
That (hc167) is actually an interesting chip. I have never seen it before.

Go Up