Pages: [1]   Go Down
Author Topic: Counting teeth, and skipping pulses  (Read 1822 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 50
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It is fairly difficult to do with the gates.

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

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11694
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11694
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 50
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I want it to see 4.

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

Rob Tillaart

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

Offline Offline
Full Member
***
Karma: 2
Posts: 200
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

* sn74167.pdf (296.02 KB - downloaded 13 times.)
« Last Edit: November 01, 2012, 06:52:13 pm by justone » Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: