USB Volume Control

If you buy expensive computer speakers, they often have a volume knob you can mount somewhere on your desk so you aren’t dependent on the onboard volume control. [Kris S] decided to build his own version of the remote volume control. Not surprisingly, it uses an Arduino-compatible Digispark board and a rotary controller. The Digispark (that [Kris S] bought for $2) is compatible with the Adafruit Trinket. This is key because the Trinket libraries are what make it easy to send media keys over the USB (using the HID interface) to control the volume.

Really, though, the best part of the build is the good looking knob made out of a pill bottle (see the video below). The micro Digispark is small enough to fit in the lid of the pill bottle, and some wax and pellets add some heft to the volume control.

The standard Arduino library has trouble sending multimedia keys, but in a previous post I built a gesture-based volume control that managed to pull it off.  We’ve also covered a similar volume control in the past. That one is also very good looking, but was a more complicated build than what [Kris S] pulled off here.

35 thoughts on “USB Volume Control

  1. Great project. I’ll be making on of these perhaps with a lippo and WiFi.

    Seems to be two versions of the Digispark. One has a very small (micro?) used socked and the other has a USB plug printed in the circuit board. I ordered 5 of each.

    Now I will go see if there are three or even two interrupt pins so I can run it in the lowest power modes for battery / wifi operation. If not well I have plenty of 328’s around.

    1. Hello, I’m kris S,. the creator of the video. If you do make this wifi/lipo control knob, please let me see it when its finished! I’d be very interested to see how you make it.

      I did something similar, I made two arduinos communicate via RF and added a mini lipo as well as wireless charging capabilities. Just need to get around to editing the video. (I’ve had the video files on my drive for months and haven’t had time to edit it)

  2. Even though the my laptop has a Fn combo for volume, I use an app that turns the mouse wheel into a rotary volume control when the pointer hovers on the task bar. Still, I suppose it’s nice to have a big knob to twiddle on occasion…

      1. https://www.highrez.co.uk/downloads/xmousebuttoncontrol.htm

        XMBC, X-Mouse Button Control. There are other similarly-named programs, don’t get them get this one!

        It’s utterly free, no fees asked for, no nags, no ads. Proper free stuff. Dunno if he even gives the option of making a donation. Software how it used to be, before the pathetic penny-ante begging and blackmail that “app marketplaces” brought upon the world like a very lame plague of dead locusts, or something.

        So yeah it’s good! Lets you assign any mouse button to any key, or key combination. Allows custom “shift states” where you can set, er, shift states, selectable by whichever mouse button you like, to let the buttons act differently. Also a VERY handy function to change the assignments from one program to the next, even as you switch between two running programs. I used this to change mouse buttons 4 and 5 (on the side) to volume buttons. Except when I was over the Start bar (Windows XP). In that case, they were Previous and Next Track, the mouse wheel became volume, and clicking the wheel became play / pause.

        So that I could control MP3, or whichever media, playback from just the mouse and basic Windows. When not over the Start bar, the mouse acted as it should, with as I mentioned, the two otherwise-useless side buttons working to control volume.

        The volume / media controls were implemented by the program pressing virtual keys on my keyboard, in this case the multimedia keys some keyboards have. My keyboard actually doesn’t have them, but Windows and XMBC support them so yay!

        Anything’s possible, really, very good, and did I mention the price? I have no connection to the undoubtedly lovely dude who wrote the program, just an uncharacteristically (for me) happy customer! If you’ve got extra mouse buttons you don’t need, get it! It might also do other stuff, too. Cheap at twice the price…

    1. I have this snippet in my master AutoHotkey script (I believe I copied it from their forums)

      #If MouseIsOver(“ahk_class Shell_TrayWnd”)
      WheelUp::Send {Volume_Up 5}
      WheelDown::Send {Volume_Down 5}
      #If
      MouseIsOver(WinTitle) {
      MouseGetPos,,, Win
      return WinExist(WinTitle . ” ahk_id ” . Win)
      }

  3. AFAIK if the soundcard is at max you are hearing all 16 bits of sound (maybe 24), if you turn down that control you are hearing less and less bits of final calculations of the sound level.
    I would like to hear otherwise from anyone.
    So I will always keep the computer at the soundcard at max or nominal and use the amplifier pot only for loud or normal listening. The screen control is not used for anything other than fading sound while talking or such and to be returned to nominal, preferred exact same setting.
    This is why I have a problem with whispered demos from behind a camera aimed away form the speakers voice on YouTube. Normalize to max. I wish YouTube would. Normalize your music collection. Nobody would run a radio station with no level normalization, virtually all adhere to the Volume War.
    Expensive computer speakers have a analogue fader in the amp circuit final before the power amp. If purely digital straight thru then you are condemned to listen to low bit density most of the time, unless the amp has only barely enough power out. With Blurtooth of course there are even less bits than wired.

        1. That does apply to digital outputs like S/PDIF or HDMI. For that reason, it is recommended to keep volume at max on the PC and use the volume control on the amp or DAC to actually set the volume.

          And even with analog output, it’s often a good idea to keep the volume on the PC at or near max and attenuate it later on since that improves the real world SNR.

      1. Previously worked with PC audio CODECs, can confirm for most late ’90s and up soundcards. The mic / line input and final output gains that the mixer settings control are always in the analog domain.

        And Bluetooth has just as many bits (for A2DP) but there’s some degree of compression going on (SBC, AptX, sometimes MP3)

    1. @echodelta
      Who the hell still has a sound card, aside from folks who do recording work??

      I’d have thought that anyone who isn’t willing to spend $35 on a DAC will either get an actual receiver or be satisfied with motherboard audio.

      1. It’s still a sound “card” even if it’s part of the motherboard! Even if it’s part of the same chip that runs the SDRAM, or the CPU! Some of us are old, or at least old before our time. They were called “sound cards” then because they were cards, my first one was, Soundblaster 16 that lasted me years, pretty much until they stopped putting ISA slots on motherboards, or else I’d probably still be listening to it. I realise I’m not really old in PC-owning terms, but stuff advances so quick! It’s like living in a new different future every 6 months.

        I got the version with the Panasonic CD-ROM controller on, rather than an extra IDE channel. I already had 2 hard drives, and I wasn’t sure my PC would be happy with a second IDE channel. Of course, they all are now, where IDE still exists that is. But with DOS 6 and Windows 3.1 you didn’t pick a fight with the machine if you could help it!

        Not sure the controller made any difference for the Panasonic 562 2x Speed CD-ROM drive I had, and paid a hundred quid or so for! I can’t remember the actual price, that’s probably a mercy. But it probably wouldn’t have been any faster over a different connection, and even if it was, the CPU would never have kept up with decoding anything that came over a link like that. Even audio came in from the CD-ROM’s own on-board DAC, through a lead to the sound card (CARD!).

        Waffle waffle… now ask me how much my 3rd and 4th megabyte of RAM cost me. More than the 8GB I put in this thing! WAY more! Was it worth the price? Well, it got Doom playing, what do you think?

    2. >Nobody would run a radio station with no level normalization
      They call that compression (aural compression) and it flattens the dynamic range to the point that it completely wrecks any music. Can’t stand it. Classical broadcasters use less of it, while pop stations crank it up to 11 to sound loud. That used to be important back in the days when the radio dial was actually a dial.

      Compare a song with loud & soft parts (Bohemian Raphsody maybe?) between a broadcast and a CD/Vinyl version. If you care about music, just say no to compression.

      1. Compression and normalisation are different things used for different reasons.

        Compression relates to how much dynamic rang is available through the medium. In the case of AM radio I would expect the available dynamic range (or signal to noise ration) is probably about the 30dB mark. FM radio would be higher but still less that you would expect from media directly in a stereo.

        Incorrectly normalised audio that is then compressed would sound even worse then a compressed audio as it would take advantage of the full (and limited) dynamic range.

        Most radio stations compress at about 3dB but many externally produced ads have much higher compression making them sound louder and in my opinion, very irritating.

    1. Go to the next electronics dumpster, grab some keyboards with an integrated volume knob and take them apart.
      One is bound to have dedicated PCB for the vol knob (and some multimedia keys) in working condition.

      The DELL keyboard SK-8135 for example has an integrated 2 port USB hub as well.

  4. A question if I may …
    I don’t have an ATtiny here to test this for myself.

    When you build one of these things and plug it in to a PC for the first time – will a standard Windows operating system have the drivers installed or does the system need new drivers installed.

    This is something that a lot of people could use and can be made cheaply. I am thinking of some oddball xmas gifts.

    1. Yup, they have a configurable HID Descriptor which is used to identify the device to the host.
      In this case the TrinketHidComboC file has descriptors that make the ATtiny appear as a mouse, a keyboard, and a Consumer Control Device aka Media Keys (play/pause, etc).

      1. Thanks for that. I assume the volume control is just (or only) a part of the media input or is it also a part of a keyboard. I’m not sure from what you say if they are using a composite device with server vid’s pid’s or three separate devices with their own vid, pid.

        Can I just rip off a vip, pid for something that is already in the operating system? (I won’t selling these or making more than a handful).

        Is there a common Vid / pid that has volume control like perhaps micro soft keyboard?

        1. There are usable ones for this kinda thing already. I tried tinkering with v-usb for the tiny85 and if you download the v-usb package there is a text file in the zip that tells you what vid and pid you can use.
          I haven’t looked too much into the trinket stuff yet, but it might have the same thing, or may have a vid and some pids set up already. And yes, the tiny85 would show up as 3 devices. A media keyboard actually shows up as 2, a regular keyboard and a consumer control device that is configured with the available keys (volume, play, next, previous, etc)

  5. It’s nice how it’s simple and it all worked out.
    And of course you can also use it as a control knob for other things, it’s up to your imagination and what you need.

    I like it when people have a need for something like this and then successfully hack something together that fulfills expectations I like it when I happen to do it (and it works) and I like it when I see others do it. Something about it is just very satisfying you know, when you beat a problem/annoyance. And it’s what HaD is all about too..

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.