Simple Dead Bug Computer Volume Control

Here's a follow-on to my post about using the LeoStick as a volume control. You must make the changes referred to in the LeoStick post if you want to try what I describe here. The Arduino micro also uses the ATMEGA32u4 chip - it's a Leonardo in a tiny package. So, it too can function as a computer volume control.

I was brainstorming how to use the Arduino micro with a minimum number of wired connections to a rotary encoder. It struck me that the micro is breadboard-compatible, so had pin spacing that could work with the rotary encoders that Adafruit sells. In fact, you  can solder the rotary encoder right on top of the micro,  "dead bug " style.


 

The first trick here is to align the pins from the encoder to micro pins that are also contiguous to each other.  One side of the encoder, used for volume up/down, uses digital pins.  The other uses Analog pins as digital pins. 

Also, there are two required GND connections to make the encoder work. The second trick is to  make a GND connection with analog and digital pins. You can do this by setting pins LOW:

pinMode(A3, OUTPUT);
digitalWrite(A3, LOW);


Like the LeoStick, this works on Linux, Windows, Mac and Android.

Click for code on github

Comments

Post a Comment

Popular Posts