Example Rotary Encoder
I have recently acquired a piece of hardware from a friend. The item in question is a really cool, high current triple output power supply. I have big plans for a remote control head for this unit that will turn it into a really cool bench power supply. Before I get to that project, I am in the midst of building a few bits and pieces with intentions of adding them all together for the power supply.
In my opinion a simple to use, intuitive user interface is always the best approach when designing an instrument type of project. This little gizmo may prove useful to you. Using a simple rotary encoder to adjust values and to navigate menus is just one approach to this goal. I have a number of CUI Inc. ACZ16 Series mechanical rotary encoders lying around, so I have decided to use this device for my project. Of course an optical encoder is probably more ideal, but my decision here is purely one of convenience. Besides they are cheap!
Some Theory on Encoders
Basically, what we are about to do is detect when a major transition step occurs within the encoder. Depending on what transition occurred, we can tell if the encoder was rotated clockwise or anti-clockwise. Refer to Figure 1 below for the timing (switching) diagram. The output of our encoder will produce two square waves. One signal from the A and one signal from B terminal. These two signals are produced out of phase by 90 degrees. When we observe a low-to-high transition on terminal A, we can then look to terminal B to see if the signal is high or low. If B is high we know that the encoder was turned clockwise. If B is low, we know that the encoder was turned anti-clockwise. Now, since we are human and by nature slow, this algorithm works for us. If transitions are missed or any number of strange occurrence happen, we should not care in this application. Things should happily move along unnoticed. If you are looking for a more precise control method or your application is accuracy dependent (Like for example, a position encoder on an electric motor) – this bit is probably not for you.
Figure 1: Arduino Encoder – Output Waveform Data
Arduino Encoder – Test Circuit
ARDUINO – CODE EXAMPLE
ARDUINO – Wiring and Prototyping
SEE MORE AT WWW.TECHMAESTER.COM