Hi ChristopherThe previous two replies have given a lot of information but maybe an example of use might help you as well.Lets take something that needs precise and controlled linear motion, like a print head on an inkjet or 3D printer. If you have an encoder on the drive mechanism then you (or in this case the microcontroller driving the printer) will be able to deduce exactly where the printhead is (from the number of pulses from the encoder. In most cases though the mechanism will have a microswitch or an optical interrupt sensor to tell it when the carriage is in the home position.Or look on any modern oscilloscope. The knobs usually turn right round, not just 3/4 of a turn like the old potentiometers. This is a clue that they are using a rotary encoder. These enable the user to step through menus or through the values in a menu. A scope might have many settings for vertical sensitivity, from 5mV per division (or less) up to even 100v per division. To do this with a rotary switch would require one with many positions - you can get them above 12 positions but they are expensive. Use an encoder and you can sense the direction and number of steps that the knob is being turned, and select your setting using software.Many encoders have a push switch on them as well, you can use this to select a setting or cycle though different menus, So this makes them a very versatile component.You also get absolute encoders which output a code giving the position of the encoder. They would be used in such things as weather stations (to indicate the wind direction). To avoid wrong outputs they use Gray codes where only one bit of the output changes at a time.There's a good article on rotation sensors here, and the wikipedia article is also worth a look - it covers both rotary encoders and absolute encoders .And Max our esteemed editor has written a good series of articles on Gray codes:Gray Code Fundamentals – Part 1 (Introducing Gray Codes)Gray Code Fundamentals – Part 2 (Generating Gray Codes)Gray Code Fundamentals – Part 3 (Sub-2^n Sequences)Gray Code Fundamentals – Part 4 (More on Sub-2^n Sequences)Gray Code Fundamentals – Part 5 (Non-Boolean Gray Codes)
There's enough in this subject to keep you busy for days.... but hope this has added to your understanding.