Mechanical MIDI - An Arduino based MIDI controller using mechanical keyboard switches
May 15, 2022
I've been getting into the world of Arduino and microcontrollers as of late and so far, it has been a blast. It is honestly one of the most rewarding learning experiences I've had. I think this is due to the instant gratification in the project-based learning approach. As you learn to do certain projects and skills, you get to see the direct results of your efforts in the physical world. You can see the servos moving how you programmed or the LEDs lighting up in a certain sequence. This is something I find that normal programming lacks a bit at the beginning, but Arduino is amazing at this.
As I've been exploring microcontrollers, I wanted to find a way to link it back to the world of audio electronics. After doing some research, I found out about using the Arduino as a MIDI device using an Arduino MIDI library. I thought this was a great way to try out a specific idea I've had for a bit which is a MIDI device with the switches from a mechanical keyboard. I am a big fan of alternate keyboard styles (as oppose to just a piano key bed) and thought that uses mechanical switches would allow for an alternate layout and a nice playing experience.
I started looking for a tutorial on the Arduino MIDI setup as I was still a novice with the programming itself, and was able to find a great video from a YouTube channel named Nerd Musician. In this video, the creator goes over the entire programming process for making a MIDI controller with Arduino and even goes over a lot of the hardware usage. Since the video was so in-depth, I ended up using this as the basis for my code and just made a few changes as needed to fit my build. I then did some breadboarding just to make sure everything was working and the code worked with the keyboard switches.
From there, I went on to design the enclosure for the controller. I wanted a somewhat compact device that was easy to keep on a desk. The hardest part of this model was getting the switch holders to a place where they were a good height for playing, which meant they had to be sunken into the enclosure (just for reference I used Cherry MX Browns for my build). I ended up achieving this by having the part which actually holds the keys be separate from the model and have it slot in (held together with some hot glue).
From there, I just assembled and soldered everything. In order to have a USB sticking out of the case, I used a small Micro USB to USB-A cable and attached one end to the Arduino and the other end to the case. I could then plug this into the computers USB port. I also designed the case so that the area in-between the 12 note keys and the octave keys perfectly fit the Arduino Micro that I was using. While the soldering was a bit tedious, it wasn't very hard so luckily no issues came up here.
After that the build was all finished and the device was able to be used in any application where MIDI via USB could be used (DAWs, standalone plugins, soft synths). The final build had 12 note keys, 2 octave keys, 2 potentiometers, and an extra key that essentially "opened" a potentiometer and set that parameter to 127 while the key was pressed. Overall, I was quite happy with how this turned out. It was a bit of a learning curve at the beginning and one of my harder enclosure designs at this point, but it really helped me learn a lot. In the future if I were to try another version, I would want to try some of the programming more on my own, I'd like to try and add more keys using a multiplexer or a keypad matrix, and I would maybe like to try a PCB design for this. In the end though, it was a great learning project and I look forward to doing more audio-based microcontroller projects.