![]() The ClickEncoder library makes it easy to attach an interrupt service routine (ISR) to a timer which periodically updates the current rotary encoder state. We could go through the effort of reading and evaluating the input data from the rotary encoder ourselves, but yet again, there's a great library that provides that functionality already. Following schematic shows how the rotary encoder and the Arduino ware wired. The most important piece of this circuit is the rotary encoder, since it provides the data whether volume needs to go up, down or has to be muted. The class Consumer only needs to be initialized and can then send arbitrary key codes using its begin method. The problem with this built-in keyboard emulation, is that it won't allow for sending extended key codes, which is exactly what we need in this case.įortunately, there's HID - a great open source library on GitHub, that supports emulation of media keys perfectly well. Keyboard EmulationĪlthough the Arduino API provides a Keyboard class out of the box, this is not what would do the trick for this project. Having a vision and all components in place, these were are the individual steps necessary for putting this project together. Of course a couple of the "usual suspects" will be required as well: This part can probably be considered optional, but adding haptic feedback through a vibrating mini motor disc adds a nice, professional touch to this volume control device. To provide visual feedback on interaction with the volume control, an Adafruit Neopixel Ring with 12 RGB LEDs will be used. This matches the volume control use case perfectly, since a keyboard's media keys neither "know" about the volume's absolute value, but only send commands to increase or decrease it.Īdditionally, this very Rotary Encoder can be clicked and serves as a button, which will be used as a mute toggle switch. That way we can easily emulate a keyboard, and with the proper library send media key commands that will set the PC's volume accordingly.Īs opposed to a Potentiometer, which reports absolute values and is limited in either turning direction, a Rotary Encoder reports the relative change and can be turned infinitely in each direction. This Arduino runs an ATmega32U4 processor which can serve as a USB HID ( Keyboard or Mouse) device. an Arduino Nano or Mini will not provide out of the box. I specifically went for an Arduino Pro Micro in this case because it offers a feature, that e.g. The Tinkercad model is available here or you can also download the exported STL files for 3D printing directly on Thingiverse. I used Tinkercad for modelling the case and the knob. Maybe I will build the box out of wood some time in the future, now that I have figured out the final design (narrator: "he probably won't").įor the knob, I went with a translucent filament to enable some cool visual feedback (see below) when interacting with the volume control. 3D printing would allow for quicker prototypes and iterations. I shortly considered making the case out of wood to give it a more classy and distinguished look, but then I decided against it. The need for a case usually means 3D printing for me. This was the list of required components I came up with for this project: The Case I wanted a physical interface for controlling the volume on my PC. AutoHotKey) but I was not 100% happy with that solution, since it was Windows-only, also I kept forgetting those shortcuts and most importantly I really wanted a physical interface to control my PC's volume. I have already blogged about a solution involving shortcut keys, scripts and additional software (e.g. Me, on the other hand, I am using a mechanical keyboard that lacks any kind of media keys - thus, no o volume control either. ![]() 3DPrinting Fun Electronics Make DIY Arduino Why?Ī volume control for my PC? Why would I need that? Well, as it turns out you probably won't.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |