On my desk i have a headphone amplifier for my AKG K702’s headphones, below it i have my self built Onixia integrated amplifier for my bookshelf speakers. I have been thinking about making a global volume control for both devices for quite some time… here is the results of my efforts.
Although you may think a rotary encoder is just a rotary encoder, when selecting one for a specific purpose such as a volume knob, the feel and quality can play a large part in your design decision. You only have to look at the vast part numbers in any given range to appreciate this. The different manufacturers cater for detent or no detent, the number of detents or the amount of pulses. Even how much torque it takes to either turn the shaft or depress it for the shaft button. Where quality is concerned, this is really down to build and electrical contact quality and how much denouncing you will end up doing in your design. It really can be a minefield…
I will touch on the phenomenon of denouncing for the layman, this usually occurs with mechanical switches. If you imagine you have a simple circuit with a battery, an on/off switch and a light bulb… you press the switch and the light bulb turns on. This could be described as a simple analog interaction. Now if you imagine a switch with dirty contact points, and the contacts arc, the light bulb will flicker a lot due to being turned on and off many times a second similar to a bad connection on a plug.
This can be used to explain how a microcontroller sees the physical world, especially concerning 2 pieces of metal touching each other in an imprecise way, as in the case of a mechanical switch. This is a concern as the Microcontroller will sense the switch thousands of times a second for a change in state, usually High (1) or Low (0) e.g. on/off .
In reality, all switches good quality or not are bad connections to the Microcontroller and sampling it thousands of times a second while a person presses a button, does not help and inevitably errors will occur and the incorrect data will be passed on.
Read More: USB Media Volume Control