navigationGo.pngQuick Navigation
allprojects32.pngAll projects
hardware32.pngHardware
links32.pngLinks

favoriteStar32.pngTop projects
Alan numitron clock
Clapclap 2313/1386
SNES Pi Webserver
USB Volume/USB toys
Smokey amp
Laser cutter
WordClock
ardReveil v3
SNES Arcade cabinet
Game boy projects
cameleon
Home Presence Detector

github32.pngGitHub
AlanFromJapan

navigationMail.pngContact me

alanfjmail.png
3flags.pngWho's Alan?


Akizukidenshi
Elec-lab
Rand Nerd Tut
EEVblog
SpritesMods
AvrFreaks
Gameboy Dev
FLOZz' blog
Switch-science
Sparkfun
Suzusho
Datasheet Lib
Reddit Elec
Ermicro
Carnet du maker (fr)

USB Volume Control

Last update: Tue Nov 28 13:28:49 2023
Disclaimer: this is just my recreation of the one found here http://obruboff.ru/english-pages/usb-volume-control/. All credits go to him, many thanks for sharing! Спасибо!
Software: USB without Arduino
Hardware: RapideUSB

Presentation

Principle

Points of interrest

Important subtlety I didn't get at first: we implement a "Consumer device" not a "Keyboard"! Hence my surprise that the codes for the Volume control on Keyboard and the ones implemented were different (see the HID doc chapter 10 vs. chapter 15).
Good thing is there are lots of nice functions possible to implement too, like a "Next" button that I'm much more interrested to bind to the click of the rotary encoder to that rather than mute.

Alternate version 3 buttons

Late December 2019 I changed my keyboard to one I like but has no media keys, so I made a 3 buttons one for mute/vol+/vol- and on LInux/Eclipse.

Schematics

Bill of materials

  • Rotary encoder, in my case cheapo eBay guys which are not EC11 as I lost hours to understand (thank you eBay vendor). Same principle though: 2 pins A & B pulled up, if you turn left they go low in order A then B, if you turn right it's B then A. Once you get that, you're in business. But again not fancy encoders with state keeping like EC11 of Alps.
  • A board for USB, like the great RapideUSB board by your host (^_^)
  • All the usual V-USB dings and dents : 2x 3.6v Zener diodes, 2x 68 ohm resistors, 1x 1.5kOhm, 12MHz crystal, caps, ...
  • ATtiny2313 or ATmega8a for instance, but program is small so no real problem here. You'll just need a few pins to read the encoder and the button
  • Some leds for the bling bling

Implementation

Cheapo encoder

Both wires A and B are pulled UP with a 10k resistor, the middle pin (C) is grounded. I might have got the direction wrong, I do that from memory, but you get the jist.
  ____          _____|_____          ___
A     \________/     |     \________/
  _______          __|__          ______
B        \________/  |  \________/
                     | 
         Left              Right

Source code

As usual in GitHub:
  • The version with the rotary encoder (Atmel Studio project)
  • The version with just 3 buttons (Eclipse project)
  • Pictures


    In built status box... it's a cypress block carved inside

    With its perfectly rounded pao-santo button. Lineseed oil finish.

    //Another version for another PC with 3 buttons: sound up/down/mute, with its enclosure //

    Links

    Helpful sources

  • http://hackaday.com/2017/01/11/encoders-spin-us-right-round/
  • Inspiration

  • This is just my implementation of this so many thanks for sharing !See original here ⇒ http://obruboff.ru/english-pages/usb-volume-control/
  • Default keyboard mapping: http://www.usb.org/developers/hidpage#HID_Usage in Section 15 "Consumer Page"
  • All content on this site is shared under the MIT licence (do what u want, don't sue me, hat tip appreciated)
    electrogeek.tokyo ~ Formerly known as Kalshagar.wikispaces.com and electrogeek.cc (AlanFromJapan [2009 - 2025])