Alert.png

Notice: This page contains information for the legacy Phidget21 Library.

Phidget21 is out of support. Bugfixes may be considered on a case by case basis.

Phidget21 does not support VINT Phidgets, or new USB Phidgets released after 2020. We maintain a selection of legacy devices for sale that are supported in Phidget21.

We recommend that new projects be developed against the Phidget22 Library.


Click on the 2phidget22.jpg button in the menu bar to go to the Phidget22 version of this page.

Alert.png

Encoder Primer: Difference between revisions

From Phidgets Legacy Support
Line 119: Line 119:
* The encoder must output (on A/B/I) a voltage above this specified value to be absolutely sure the interface will interpret the signal as a 'One'.
* The encoder must output (on A/B/I) a voltage above this specified value to be absolutely sure the interface will interpret the signal as a 'One'.
* See comments above.
* See comments above.
=List of encoders=
* Sourced from Digikey
* Customers should look for encoders that advertise 'Quadrature'
* Encoders often advertise 'detents' - which are perceptible clicks as the encoder is rotated.  Encoders with detents are usually meant for operation by people as control knobs.
* Encoders for manual (people) operation will often have a built in pushbutton switch on the shaft.  This functionality is seperate from the encoder.  Encoder interfaces available from Phidgets will often have support for digital inputs - this switch can be wired in to a digital input.
==Mechanical encoders==
* Mechnical encoders are usually very cheap, and meant for manual (people) operation.
* Mechanical encoders will have a shorter lifespan, measured in the number of rotations.


==Add to this page==
==Add to this page==
{{ContentNeeded|Make sure to mention that 4-pin encoders still work with either controller, as long as everything is connected up properly.}}
{{ContentNeeded|Make sure to mention that 4-pin encoders still work with either controller, as long as everything is connected up properly.}}

Revision as of 17:05, 22 February 2012


Introduction

Encoders are the best device for tracking the position of an object. They come in 2 main types, rotary and linear. Rotary encoders track angular position while linear track position in one spatial dimension.

How they work

Encoders work by counting ticks that are spaced evenly and very close together. On higher quality encoders the ticks are closer together resulting in greater measurement accuracy.

Types of encoders

Rotary

Mechanical encoders consist of a metal disc with slots cut into it which spins beneath a series of wire brushes. When the brushes are over the slot the circuit remains open, but when the brushes contact the disc they close the circuit. These are brushes at different radii and the encoder is guaranteed to have a unique pattern of closed circuits for each set step in angular position.

Because of the physical complexity mechanical encoders have to be larger than the alternatives to get the same accuracy.

Optical encoders have a similar disc to mechanical encoders except it has a number of opaque or transparent areas. Then a light source in conjunction with a set of photo detectors perform the same function as the wire brushes in a mechanical encoder. For each angular position step there is guaranteed to be a unique set of active photo detectors.

Linear

Optical linear encoders dominate the high performance market for linear encoders. Typical incremental scale periods can get down to sub-micrometre and with interpolations accuracy can be as fine as nanometre.

Magnetic linear encoders use Hall Effect readheads to measure ticks, they typically have measurement resolutions in the order of micrometres.

Capacitive linear encoders work by sensing the capacitance between reader and scale. Commonly used in digital calipers. The downside is they are vulnerable to foreign materials such as dust or dirt. Resolution is in the order of micrometres.

Quadrature encoding

File:Quadrature encoder.png
Top: Representation of a quadrature encoder wheel. Bottom: Output from the encoder.

Quadrature encoders are common, using two output channels to dictate both a change and the direction of change. In a quadrature system, two parallel mechanical switches or optical slots are offset slightly. This way, as the slots pass by the sensor, the staggered output indicates both the number of pulses that have occurred (the change in position) as well as which output channel is leading the other (direction of change).

Choosing an encoder

The first thing to consider when choosing an encoder is what degree of accuracy you are going to require. Is the application a simple human interface (knob or something similar) or are you trying to precisely track the movement of a motor? Mechanical, magnetic, and capacitive encoders have the advantage of being extremely cheap. So even though they don't have as high accuracy as optical encoders, for applications that don't require it such as turning a knob on a control panel they are ideal. For any situation where you need modest to high accuracy, you only real choice is an optical encoder.

Products that fall under this category

Glossary

Connector

  • Specify our standard encoder connector
    • Steal from the 1047/1057 product manual
    • Spec the connectors part numbers involved
    • List of cables for encoders

Response Frequency

  • If we are considering an encoder, this is one of the specs that dictates the maximum speed the encoder can turn at.
    • This is the internal limitation of the electronics in the encoder. For a given encoder, this limits the maximum number of pulses/counts it can interpret per second.
    • This spec should probably be destroyed, and replaced with a upper limit on how fast the encoder can turn (in RPM)
    • Each encoder will have a limit dictated by the lower of the maximum mechanical rotation rate, or the response rate of the electronics.
    • Is the ICS3004 360 PPR spec based on counts or pulses?
  • The maximum response of a mechanical encoder depends on the amount of contact bounce. Once the encoder is turning fast enough, individual switch closures are lost in the noise.

Supply Voltage

  • We should consider specifying for the encoder interfaces that they provide +5V to the encoder.
  • Any encoder that connects to Phidgets should be rated for +5V operation.
  • This spec is not important for mechanical encoders, that are just a series of switches. In fact, a mechanical encoder doesn't even use the +5V power supply.
  • Optical encoders use the power supply for (among other things) powering LEDs. Usually optical encoders will have a series resistor on the LED to limit the current to an optimal value. If you are using an optical encoder not sold by Phidgets, please check the datasheet to ensure the LED current is limited internally - otherwise, you might have to put a series resistor on the +5V line.

Number of Pulses

  • Consider renaming, or standardizing
  • Counts is the lower resolution spec
  • Pulses is the higher resolution spec.
  • Do a survey, and figure out what is most prominent.
  • We'd also have to standardize in our code samples and API documentation.
  • 1065_0 returns the lower resolution value.
  • Consider giving both as specs, so customers who have the wrong model (by our standard) can see the difference and infer what we mean.

Output Circuit

  • In the case of a mechanical encoder, the output circuit is just switches to ground.
  • In the case of optical encoders, there are a lot of different options.
  • Very simple optical encoders will use phototransistors as a 'switch' to ground.
  • Also called open collector.
    • These encoders may have pullup resistors built into the encoder, or they may rely on the interface to provide them.
    • Phidgets encoder interfaces have reasonably weak pullup resistors built into them.
    • If your encoder specifies an external pullup of greater resistance than the Phidget has integrated, you won't be able to use the encoder with Phidgets.
    • If your encoder needs a lower resistance (a stronger pullup), it may still work, but at a lower response rate. If you want to make the pullup stronger, you can add pullup resistors on the cable. (Show picture / diagram of this)
  • Open collector is an example of a single ended drive - as opposed to differential.


  • Push Pull optical encoders have more complex electronics, and they can actively drive the A/B lines high or low. The Phidget still has pullup resistors - which are not necessary, but in practice they don't cause any problems.
  • Another way of saying this is that Push Pull optical encoders can respond much more quickly than the photo transistor based optical encoders - because they are not relying on pullup resistors, which have to be weak by definition. The push pull electronics can very quickly drive the cable to 0 or 1.
  • Push pull is an example of a single ended drive - as opposed to differential.


  • Differential output optical encoders
    • Differential outputs use two push-pull drivers per signal line (A, B, I). In each driver pair, one driver is always transmitting the opposite of the other. The benefit of differential is it will emit less electromagnetic interference, and is less susceptible to electromagnetic interference on the cable introducing extra counts.
    • Phidgets do not support differential optical encoders. US Digital makes an adapter board (find part number), which will convert differential signals to single ended, so differential encoders can be used with Phidgets.
  • Making your encoder more immune to electromagnetic interference.
    • If you are finding that your encoder is showing extra counts, or losing counts during operation, there may be electromagnetic interference in your environment, coupling into the cable.
    • A good test is to leave the encoder not moving. If your encoder is open collector, it will be more susceptible to interference when the A/B lines are at +5V (as opposed to ground). If any counts appear as the encoder is still, interference is likely to blame.
    • The heavyweight solution is to use a differential encoder.
    • A more practical solution is to make a shielded cable.
      • USB cables are easily repurposed as shielded cables.
      • Show picture of USB Cable chopped up, soldered onto encoder jacks.

MAX RPM

  • Merge this with the maximum RPM based on electrical limitations,
    • We could indicate whether this is a mechanical or electrical limitation.

Maximum Count Rate

  • For encoder interfaces
    • This is the maximum count/pulse rate that the interface can receive without losing pulses.
    • Have to standardize if we are talking about high or low res spec.

Internal Output Pullup Resistance

  • Discussed above
    • Customer can put resistors on cable in parallel if they want to lower resistance. - Put resistors on A/B channels, to +5V.

Software Update Rate (typical)

  • This is how often the number of counts / pulses that have been recognized is streamed up to the PC.
  • Customers often think that when they call a function, we poll the device, but actually the data is being streamed at a constant rate, and they are retrieving the latest values received by our libraries.

Encoder Input Low Voltage

  • The encoder must output (on A/B/I) a voltage below this specified value to be absolutely sure the interface will interpret the signal as a 'Zero'.
  • If you are unsure, you can use a multimeter to measure the voltage on A/B/I. This does not guarantee that this voltage spec will be achieved as the encoder is being operated at high speed. If you are unsure, and you have an oscilloscope, you can monitor the voltage on A/B/I during operation. Alternatively, you can operate the encoder at greater speed than you will see in your application and verify it does not lose counts.

Encoder Input High Voltage

  • The encoder must output (on A/B/I) a voltage above this specified value to be absolutely sure the interface will interpret the signal as a 'One'.
  • See comments above.

List of encoders

  • Sourced from Digikey
  • Customers should look for encoders that advertise 'Quadrature'
  • Encoders often advertise 'detents' - which are perceptible clicks as the encoder is rotated. Encoders with detents are usually meant for operation by people as control knobs.
  • Encoders for manual (people) operation will often have a built in pushbutton switch on the shaft. This functionality is seperate from the encoder. Encoder interfaces available from Phidgets will often have support for digital inputs - this switch can be wired in to a digital input.

Mechanical encoders

  • Mechnical encoders are usually very cheap, and meant for manual (people) operation.
  • Mechanical encoders will have a shorter lifespan, measured in the number of rotations.


Add to this page

Make sure to mention that 4-pin encoders still work with either controller, as long as everything is connected up properly.