Previous in Forum: Necklace made of neodymium magnets...?   Next in Forum: Power Transformer Neurtal Earthing
Close
Close
Close
11 comments
Rate Comments: Nested
Anonymous Poster

Optical Shaft Encoder Question

04/17/2007 10:33 PM

hi

I read that 8 bits are required in the counter of an optical encoder to measure one revolution of the motors shaft. How to calculate this?

Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.
Guru
Technical Fields - Architecture - New Member Popular Science - Weaponology - New Member Engineering Fields - Control Engineering - New Member Engineering Fields - Electrical Engineering - New Member Engineering Fields - Electromechanical Engineering - New Member Hobbies - Fishing - New Member Hobbies - Target Shooting - New Member Hobbies - Hunting - New Member

Join Date: Dec 2005
Location: Clemson, South Carolina
Posts: 1722
Good Answers: 18
#1

Re: Optical Shaft Encoder Question

04/18/2007 9:38 AM

Not enough information . . .

8 bits is 28 = 256

What kind of encoder is it? The number of lines in an encoder determines the resolution. That is, if it has 256 lines, one revolution produces 256 counts, and the resolution is 256/360 degrees, or 1/256 of a revolution.

__________________
We have met the enemy and he is us . . . Walt Kelly
Reply
Anonymous Poster
#2
In reply to #1

Re: Optical Shaft Encoder Question

04/18/2007 8:52 PM

Hi

thanks for the reply.

it is an incremental encoder.the question was what is the minimum number of bits required in the counter( signal condioner) to measure one revolution of the motors shaft.

Reply
Guru

Join Date: Sep 2006
Posts: 4513
Good Answers: 88
#3
In reply to #2

Re: Optical Shaft Encoder Question

04/18/2007 10:52 PM

Do you need to know how to determine the direction the encoder is moving? Depending on your application, you may need to increment or decrement the counter in accordance with the direction the shaft is rotating.

Reply
Associate

Join Date: Dec 2005
Location: Right here in Australia
Posts: 27
#4

Re: Optical Shaft Encoder Question

04/19/2007 12:13 AM

Thinking aloud:

8=23 , and 3 would be the minimum bits to count clock or counterwise with any certainty of absolute position. 1 bit increments, 1 bit decrements, 1 bit is the home position.

yes, no, maybe?

__________________
Do or do not, there is not try, but there is failure...
Reply
Anonymous Poster
#5
In reply to #4

Re: Optical Shaft Encoder Question

04/19/2007 12:21 AM

sorry, I forgot to mention the resolution of the encoder is given as 1.8 deg.

sorry to bother u all without full info.

anyway thanks... sometimes the brain doesn't work!!:-))

Reply
Guru
Australia - Member - New Member Fans of Old Computers - H316 - New Member Hobbies - Model Rocketry - New Member

Join Date: Jun 2006
Location: Port Noarlunga, South Australia, AUSTRALIA (South of Adelaide)
Posts: 3048
Good Answers: 75
#7
In reply to #5

Re: Optical Shaft Encoder Question

04/19/2007 2:05 AM

If you wish to measure it to within ±1.8° then

360 ÷ 1.8 = 200

Which means you need to divide the encoder into 200 segments

If you had a 7 bit encoder you can count up to 128 or 27 which is too small so you need to use at least 8 bits which can count up to 28 or 256.

The answer is therefore 8 bits but if you wish to measure in exactly 1.8° steps you will not be counting all the way to 256 but rather stopping when you get to 200 which in binary is 1100 1000 rather than going all the way to 256 which is 1111 1111.

__________________
An elephant is a mouse built to government specifications.
Reply
Guru

Join Date: Sep 2006
Posts: 4513
Good Answers: 88
#6
In reply to #4

Re: Optical Shaft Encoder Question

04/19/2007 1:58 AM

One very simple way of doing this in hardware is to use a D-type flip-flop. Connect Channel A to the D input, and Channel B to the clock input. When the shaft is turned clockwise, Channel A lags Channel B, and when turned counter (or anti) clockwise, Channel A leads Channel B.

Assuming the shaft is turning clockwise, the first rising edge of B will latch the value of A, a logic '1.' The flip-flop's Q output will stay at logic 1 for as long as the shaft is rotated clockwise or is not reversed.

If the shaft rotates counterclockwise (read the timing diagram, below, backward), the first rising edge of B will again latch the value of A, this time a logic '0.' The flip-flop's Q output will stay at logic 0 for as long as the shaft is rotated counterclockwise or is not reversed.

The latched value of D in either case appears on the flip-flop's Q output. Either Q or Q-not can serve as the direction indicator, depending on the needs of your application, and can be used to toggle the direction of the count (up/down counters typically sport an up/down pin).

You can use either Channel A or Channel B as the counter's clock input, with the direction signal from your flip-flop determining the count direction.

You can also use a dedicated encoder interface chip, or you can program one of the PIC microcontrollers to do this sort of thing for you.

Hope you found this info handy.

Reply
Guru
Technical Fields - Architecture - New Member Popular Science - Weaponology - New Member Engineering Fields - Control Engineering - New Member Engineering Fields - Electrical Engineering - New Member Engineering Fields - Electromechanical Engineering - New Member Hobbies - Fishing - New Member Hobbies - Target Shooting - New Member Hobbies - Hunting - New Member

Join Date: Dec 2005
Location: Clemson, South Carolina
Posts: 1722
Good Answers: 18
#8
In reply to #6

Re: Optical Shaft Encoder Question

04/19/2007 8:46 AM

Europium,

Your details make acceptance of my laziness easier to bear. I was hoping that someone would post details.

Another thing to consider is that quadrature encoders will yield 4 times the basic line count. That is, a 256 line encoder will give 4 X 256 or 1024 pulses per revolution, so the resolution is 1 part in 1024 +/- 1.

Also, I seem to recall that stepper motor incremental steps which became popular in the 70's was 1.8 degrees, and engineers wanted to put encoders on them for closing the loop, one reason being that stepper motors would not always take steps when commanded to do so. (It has to do with resonances, rates of change of step commands to get through resonant speeds, etc. -- very irritating stuff.)

Anyway, when putting an encremental encoder on a stepper motor, people found that even the encoder feedback didn't work always. After digging into the problem, it was found that when rotor inertia, load inertia, etc. was analyzed, a single step, for example, would cause the motor and load to "ring," which means that it had a natural frequency of oscillation caused by static electromagnetic fields and the salient magnetic poles of the rotor seeking to find a home, and the encoder electronics couldn't keep up with the counts up and down, either because the motor/load didn't oscillate far enough in one direction to cause a corresponding up/down count in the opposite direction (because the "ringing" was a damped function) resulting in a count that was off by 1.

A way around this was to reduce the number of lines on the encoder to 50 for a 200 steps per revolution stepper motor, as well as to add a little friction to the system to reduce the oscillations to a minimum. Kinda tricky sometimes.

Hope this addition helps.

__________________
We have met the enemy and he is us . . . Walt Kelly
Reply
Guru

Join Date: Sep 2006
Posts: 4513
Good Answers: 88
#9
In reply to #8

Re: Optical Shaft Encoder Question

04/19/2007 12:12 PM

If finer-resolution direction sensing is required, these two circuits (below) decode the direction on the first edge of either channel.

This circuit can be used with a counter that has a single clock input and a direction input:

This next circuit can be used for counters which have separate 'up' and 'down' clock inputs:

Reply
Guru

Join Date: Sep 2006
Posts: 4513
Good Answers: 88
#10
In reply to #8

Re: Optical Shaft Encoder Question

04/19/2007 12:39 PM

Yeah, phase jitter or "dither" can be problem; not just with steppers but with any system that exhibits a resonance or vibration. There are ways around this. Some "smart" encoders, for instance, can dynamically adjust their 'hysteresis' on-the-fly with systems that have problems with dither. At added cost, of course. Photocraft is one such manufacturer of 'smart' encoders.

Reply
Active Contributor

Join Date: Apr 2009
Location: Barneveld Wisconsin
Posts: 10
#11

Re: Optical Shaft Encoder Question

04/16/2009 3:47 PM

Gosh...

I was hoping to chime in as the "Encoder guy" on this forum, but you all gave such good answers. There is a lot of knowledge and talent on here.

Without really knowing the application I would like to mention that it is typically ~easier~ and less expensive to use an incremental encoder if possible. The key is whether or not you need to know where you are at on power up.

An aboslute encoder gives you this ability, but with the cost of added wiring.

There are of course lots of protocols to transmit the data fro the encoder so "added wiring" may be an arguable point.

Reply
Reply to Forum Thread 11 comments
Copy to Clipboard

Users who posted comments:

Anonymous Poster (2); aXiom K (1); Bill (2); James Miller (1); masu (1); user-deleted-13 (4)

Previous in Forum: Necklace made of neodymium magnets...?   Next in Forum: Power Transformer Neurtal Earthing

Advertisement