USB Media Volume Control

Summary of USB Media Volume Control


Summary (under 100 words): The author built a global volume control to operate both a headphone amplifier and an integrated amplifier. They emphasize careful rotary encoder selection because detents, pulse count, torque, and build affect feel and electrical contact quality. Mechanical switches cause contact bounce (debouncing), which can make microcontrollers read false transitions and produce missed or reversed encoder steps. Good encoder choice and handling of debouncing are key to reliable volume control operation.

Parts used in the Global Volume Control:

  • Rotary encoder (choice varies by detent, pulse count, torque, build quality)
  • Microcontroller (to read encoder and control volume)
  • Headphone amplifier (AKG K702 headphones connected)
  • Onixia integrated amplifier (for bookshelf speakers)
  • Electrical wiring/connectors
  • Power supply (for microcontroller and control circuitry)
  • Mechanical mounting/knob for the rotary encoder
My most rewarding projects are the ones which i actually use. I like my audio gear so, this was the perfect companion project!

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.
USB Media Volume Control

Encoder Choice….

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 debouncing you will end up doing in your design.It really can be a minefield…
I will touch on the phenomenon of debouncing 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 lightbulb 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) eg. 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. With a rotary encoder this will manifest itself as missed steps or even steps back when going forward.

For more detail: USB Media Volume Control

Quick Solutions to Questions related to Global Volume Control:

  • How important is encoder choice for a volume knob?
    Encoder choice is very important because detents, pulse count, torque, and build quality affect feel and electrical contact quality.
  • Can encoder quality affect volume control performance?
    Yes, encoder build and contact quality affect debouncing and can cause missed or reversed steps if poor.
  • What causes missed steps on a rotary encoder?
    Mechanical contact bounce and poor electrical contact cause the microcontroller to read false transitions, producing missed or reversed steps.
  • Does torque and detent matter when selecting an encoder?
    Yes, torque and detent count matter for user feel and overall design decision.
  • What is debouncing in simple terms?
    Debouncing is when mechanical switch contacts briefly make and break contact, causing multiple on/off signals that a microcontroller may misread.
  • How does a microcontroller perceive mechanical switches?
    A microcontroller samples switch states thousands of times a second and can see imprecise metal contacts as noisy transitions leading to errors.
  • Can good encoder selection reduce the need for debouncing?
    Good encoder build and contact quality reduce contact noise, which helps but does not eliminate the need to handle debouncing in design.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top