DIY Programmable Hotkey Stompbox
by baritonomarchetto in Circuits > Electronics
25 Views, 0 Favorites, 0 Comments
DIY Programmable Hotkey Stompbox
I’ve found myself needing this on more than one occasion over the past few years.
Some time ago, I wanted to send keystrokes to a software looper to start and stop recording my synthesizer output while playing.
Today, I need a device to play and stop a drum loop on my favourite DAW for guitar practice.
Hands-free, is the leitmotiv here!
Whatever your application, if you have ever felt the need for a device that emulates a PC keyboard to control a software by feet, check out this Instructable! :)
In this instructable:
- I will show my programmable hotkey stompbox.
- I will show how to build it up, the circuits it is made of, the firmware that makes all this possible.
- I will also share Gerber files to have the PCB manufactured.
Let's go!
Supplies
The PCB I layed down is dimensioned for compatibility with the following components:
- 1x aluminum alloy case (1590B, 112 x 60 x 31 mm)
- 1x panel mount USB type C TPC connector, 4 wires (those used to add a USB charge slot in cars)
- 1X USB type C male connector (those with exposed terminals through a PCB)
The stompbox PCB is populated by the following components:
- 1x RP2040 Zero microcontroller board
- 2x PCB mount footswitch 3PDT 9 pin (latching or non latching)
- 4x PCB mount micro switch 6x6 mm, 20 mm height (tall aren't they? :D)
- 2x 680 ohm resistor
- 6x 10K ohm resistor
- 2x LED, 3mm
To work the aluminum alloy case, I suggest you to use:
- Power driller (mandatory)
- Drill bits for metals (mandatory)
- Step drill bits (optional, but highly recommended)
- Auto center puncher (optional)
The biggest hole diameter in this project is 12 mm. Nothing scary then!
SAFETY WARNING!
It is very important to protect yourself while attempting to work on any piece of furniture with power tools. Wear protective gloves, safety glasses and FP2 mask. Work in a well areated place.
Safety is not an option!
Hardware
There's little space inside a 1590B case. Most is already taken by the two footswitches, so only small room is left for any other component.
This is why I opted for the smallest microcontroller board out there: The RP2040 Zero. This thing is in the 4 cm^2 ballpark and equips a powerful (and cheap) microcontroller. A no-brainer.
Two classic PCB mount, latching* guitar effect footswitches are used to trigger keystrokes. This makes the device durable and solid feeling.
Four additional (momentary) microswitches are present. These can be used for auxiliary functions like sending other keystrokes, menu diving, operation mode selection, etc.
There are two on-board LEDs. One is directly wired to the 3.3V line and gives information about the existence of the correct tension to feed the microcontroller.
The other one is instead connected to a microcontroller GPIO and can be programmed to return a visual feedback of some action, debugging, etc.
I adopted a panel mount, type-C plug in order to have a sturdy connection. There are not many options for this, honestly, but I think the one adopted is a very good choice.
The Box is directly powered by USB power. USB also sends data from the device to the PC in order to emulate the key presses.
*I adopted "latching" footswitches because they are the common choice for guitar effects pedals, This makes them readily available and cheap. It is anyway possible to use non-latching footswitches because the software can handle them (more details later).
Software
Functions
The firmware I wrote performs a single, fundamental, task: emulates PC keyboard keypress at any switch press.
In the moment I am writing keys "SPACE" and "T" are emulated by pressing the footswitch, "i", "j", "k" and "l" by pressing one of the four tactile buttons. User can easily change the keys at software level.
A software debounce routine is implemented to avoid false readings due to switch bounce (and they bounce a lot!).
The board has two LEDs. The one wired to a microcontroller pin is used to give a sign of MCU life on startup: when you first connect the USB cable and the microcontroller turns on, it blinks for some second telling you he is running ok and waiting for switch pressed.
Good to know :)
Programming
RP2040-based microcontroller boards can be programmed both via circuit Python or Arduino IDE.
I choosed this second way, with the help of Earl Phil Hower's Pi Pico core. To install this core refer to the Author's notes on his github page.
As I said, in my prototype I adopted latching footswitches because easier to source. These, unlike non-latching switches, do not associate the press position to a state and release to another, but toggle the state at every press/release.
The software handles both latching and non-latching switches. I set a definition for the kind of footwitch:
Simply comment (//) or delete the line for non latching switches.
How to Build
In the following the operations you should do to build up this thing. See attached pictures for reference.
Case Drilling
This phase consists of two operations: face plate drilling and power connector hole drilling.
Face plate drilling is the realization of holes to host the two foot switches, the four tactile swithes and LEDs.
The bottom side of the PCB has a drill mask to simplify the work and help centering them "perfectly".
The holes with a white circle around are dedicated to the faceplate. The hole (single hole) named "Z!!" is the one to be used to drill the USB connector's hole.
Please notice that you have to remove the case's bottom before marking the height (Z!!) drill point.
As a general rule, keep driller speed low when drilling metals.
Operations
1) center the drill mask over the face plate, then on the correct case's side.
2) mark hole positions with a pen.
3) use a hole puncher to notch all positions.
4) drill a first centering hole in all position with the smallest drillbit possible.
5) enlarge holes up to the desired dimension.
Notice that the PCB is slightly asimmetrical and the power connector is shifted 0.20" (5 mm) apart from the exact center position of the case. Use the PCB dedicated hole (named "Z!!") to mark the exact Z hole center position.
Center the drill mask (bottom side facing you) onto the case external surface and lock it firmly with some adhesive tape.
The shared PCB drill mask also has the final dimensions of the holes silk-screened.
Keep all elements around so that you can check at every step if the hole you are drilling is big enough to host it.
PCB Assembly
Now that the case is ready (pfew!!) we can proceed with PCB population!
- Populate smaller components first (resistors), then the female headers to host the microcontroller board. Resistors values are silk-screened, so a value map is not necessary.
- Place in position tactile switches and solder one leg each (only one!) then. Be 100% sue they are correctly aligned!
Do not solder footswitches and LEDs for now.
Now, align components inside the case.
- Looseny screw foot switches in place (they must be able to move in this phase).
- (leave the LEDs out for now!!).
- Insert the PCB inside the case.
- If everything fits well, solder all switches legs to the PCB.
LEDs deserve special care. You want them to fit into the hole without popping out too far or creating residual stresses on the pads.
To acomplish this:
- Insert LEDs with the right orientation though the PCB. Keep them loose.
- Place the PCB inside the case and firmly screw the foot switched.
- Position LEDs such that they enter case hosting holes.
- Solder LEDs in place.
Power Connector Wiring
The panel mount USB connector here adopted has free cables to be soldered to a type-C male. The male will then be inserted into the microcontroller board.
The male type-C connector I have adopted has a small PCB exposing relevant (USB 2.0) terminals.
The cable color code for the panel mount USB connector is:
- V+ = Red
- D- = White
- D+ = Blue
- GND = Black
Carefully solder ground, voltage and data lines to the appropriate pads on the male type-C connector, and you will be good.
Testing
Visual Test
The stompbox is equipped with two LEDs giving a visual feedback about the health state of the device.
The power LED is connected to the 3.3V line (internally generated by the microcontroller board), so it gives feedback about the microcontroller being feeded adeguately. Issues here would call for a problem in the USB line (likely) or defective on-board DC-DC step down power converter (unlikely).
The second LED gives visual feedback about the microcontroller activity. It blinks briefly on startup to tell "hey, I am listening and ready to rock!" then turns off.
Functional Test
The simplest and effective functional test can be performed by opening note pad (or any other PC program where you can write) and press stompbox switches. This is a foot keyboard, remember? It can be used to send keystrokes to any software.
If the functional test works and you are experiencing some issue with your target software (i.e. your DAW), check its hotkeys assignation map.
Don't test the device directly on your target software because if something goes wrong, you will not be able to discern if it's a stompbox issue or software issue.
Acknowledgments
A special thanks goes to the nice girls and guys at JLCPCB for sponsoring PCBs manufacturing of this project of mine.
Without their contribution this project would have never seen the light (I would have stopped at my first prototype: no sharing, only my own personal use... definitely a less noble goal!).
In this run they also sponsored the production of a revision of the RGB Test Pattern Generator, the previous being affected by an error in the SCART pinout (never trust others footprints!). Now it's fully tested and working.
In this run they also realized for me a prototype of the main circuitry of one of my next project: a multi FX pedal. Let see how it goes!
JLCPCB is a high-tech manufacturer specialized in the production of high-reliable and cost-effective PCBs. They offer a flexible PCB assembly service with a huge library of more than 600.000 components in stock at today.
3D printing is part of their portfolio of services so one could create a full finished product, all in one place!
By registering at JLCPCB site via THIS LINK (affiliated link) you will receive a series of coupons for your orders.
You can have your PCB manufactured from $2, stencil from $3 (dropped from $7 recently!). Definitely worth a try, if you ask me ;)
Gerbers and sketch files I realized for this project are stored >>HERE<< (Github), free and for everybody.