logo
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
Switch-science
Sparkfun
Suzusho
Datasheet Lib
Reddit Elec
Ermicro
Carnet du maker (fr)
Marutsu
ATmel blog (defunct)

USB Volume Control

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.

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.

Pictures


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

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

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.cc ~ Formerly known as Kalshagar.wikispaces.com (AlanFromJapan [2009 - 2017])