When teaching DIY MIDI controller development I usually recommend using the Arduino platform due to its large user community and the extensive amount of learning resources. However there is a similar hardware platform that is actually better suited and easier to use for building USB-MIDI controllers, which is also more powerful at a cheaper price; the Teensy platform. The only downside of using Teensy compared to Arduino is that there just aren’t as many examples or tutorials in regards to MIDI controller development, therefore I’ve written this tutorial to help overcome this shortcoming and aid in highlighting Teensy as a great hardware platform for the audio/MIDI maker community.
In this tutorial I’m going to show you how to build a simple MIDI controller that consists of 8 retro arcade push buttons for sending MIDI message, as well as a toggle switch for choosing whether the arcade buttons send note message or CC messages. It may seem like this controller has limited functionality compared to commercial MIDI controllers, however this project will serve as a good introduction for developing more complex controllers but without throwing you in at the deep end. Here is a video example of what you’ll be building:
A Teensy-based DIY USB-MIDI controller demo. First the buttons are sending note messages to trigger drums samples, and then the toggle switch is used to set the buttons to send CC messages to trigger effects. This demo uses Ableton Live and the Sugar Bytes Turnado plugin.
- A Teensy board. If you’re on a budget get the Teensy LC, else if you think you may want to do more complex Teensy projects in the future I recommend the more powerful Teeny 3.2. Make sure you get a Teensy with pins, unless you fancy soldering them on yourself.
- 8 arcade push buttons (though any large push buttons will work).
- 1 SPST toggle switch
- A solderless breadboard
- An enclosure. This could be any small sturdy box around the house, or a multipurpose project box.
- Hookup wire. Stranded 7/0.2mm would be best, though solid core 1/0.6mm or something of a similar size would also work. Preferably of different colours, but not essential.
- USB Micro-B cable
- Led-free solder (optional)
- 28 pin 0.6” IC socket (optional)
- Stripboard (optional)
- Wire cutters
- Wire strippers or scissors
- A tool for making holes in the enclosure. Scissors/craft knife will be fine for cardboard enclosures, however you’ll probably need a Dremel (or something similar) for plastic or wood enclosures.
- Soldering iron (optional)
- Safety glasses (optional)
- Stripboard cutter (optional)
Step 1—Connecting Wire to the Buttons and Switch
First you need to cut 18 pieces of wire; each of a length that will allows buttons inserted into the top of your enclosure to be connected to a place in the bottom of the enclosure, but with a lot of slack so that the inside of the enclosure can be accessed without the buttons being disconnected. It would be preferable for half of the wires to be black and the other half to be of various other colours to make wiring the circuit less confusing, however this is not essential. Then strip about 1-2 cm of plastic off each end of each wire; wire strippers are best to use here however it can also be done with scissors. If you are using stranded wire twist the ends to stop them from fraying.
Next you need to connect a pair of wires to each button and switch so that they can be connected to the Teensy. Each button/switch should have two pins/connectors on the bottom, and this is where the wires need to be connected. If your switch has three pins just ignore one of the side pins. You want to connect one black wire and one coloured wire to each button/switch; the orientation doesn’t matter. To connect them simply twist the metal wire securely around the pin, threading it through the hole if there is one.
Finally I strongly recommend that you solder these wires into place. If you are unable to get hold of a soldering iron and the wires are firmly twisted and connected you may be able to skip this part, however the only way to ensure that the connections won’t become disconnected throughout this project is to solder them. If you’re new to soldering I recommend watching this video to learn how to solder, however it is fairly simple and main involves the following process:
- Add a small amount of solder to the iron tip
- Place and hold the iron tip on the connection/joint you want to solder (in this case the button/switch pin and the wire)
- Touch the end of the solder reel onto the joint, but not the iron tip.
- When the joint is hot enough the solder will melt onto it.
- Lift the solder reel and iron off of the joint a give it a few seconds to dry
Please solder in a well-ventilated area and use safety glasses!
Step 2—Building the Circuit
First lay your breadboard horizontally and place the Teensy on either side but with the USB port facing outwards. Make sure the Teensy is over the middle divider of the breadboard. Next cut and strip a short bit of black wire that is long enough to reach from the Teensy to the blue/black/negative strip along the side of the breadboard. Connect this wire from anywhere on the negative strip to the terminal strip connected to the ground pin on the Teensy—this is the bottom far-left pin if the USB port is on the left, or the top far-right pin if on the right (labeled ‘G’ on the Teensy LC).
Lastly you need to connect all the push buttons and the switch to the Teensy. The toggle switch needs to be connected to digital pin 0 which is next to the ground pin, and then the push buttons to digital pins 1 to 8 that are the following pins on the same side. Connect the coloured wires to the breadboard terminals connected to these pins, and then connect all the black wires to the breadboards negative strip (see below photos).
And that’s the circuit complete. Simple, huh? If you’ve done some electronics before you may have expected that we would need a resistor between each button/switch and the microcontroller, however Teensy boards have built-in pullup resistors on each pin which means no external resistors are needed. This makes circuit building simpler, and is one of the lesser-known advantages of Teensy over Arduino.
Step 4—Writing, Compiling and Testing Code
Now the circuit is complete, it’s time to get the software-side working. To develop for Teensy you need to download and install two pieces of software:
Once both bits of software have been installed complete the following steps:
- Connect the Teensy board to your computer via the USB cable. If it is a brand new Teensy the onboard LED may now be flashing.
- Launch the Arduino application
- Go to File -> New to open a new Arduino project
- Replace all the text in Arduinos text editor with this code
- Go to Tools -> Board and select the specific Teensy board you are using. If you cannot see the Teensy board section go back and make sure you correctly installed Teensyduino.
- Go to Tools -> USB Type and selected ‘MIDI’.
- Go to Sketch -> Verify/Compile, or instead just click on the tick icon on Arduinos toolbar.
- If no errors appear in the console pane at the bottom, the Teensy software window should pop up. If this did not happen and errors appeared, go back to point 1 and carefully follow the instructions again.
- As stated in the Teensy software window, press the button on the Teensy board to put it into Program mode. The LED should no longer be flashing.
- In the Arduino software go to Sketch -> Upload, or instead just click on the arrow icon on Arduinos toolbar.
- If the upload was successful the Teensy software would have shown a progress bar followed by ‘Reboot OK’, and no errors would have appeared in the Arduino console pane.
If you are having trouble getting things working, see the official Teensy ‘getting started’ guide. Also note that when re-uploading code to the Teensy you can skip point 9.
You are now ready to test the circuit. Open up your DAW/MIDI software of choice, connect to the MIDI device called ‘Teensy MIDI’ (or something similar), and start pressing the arcade buttons. Each button should send a different MIDI note or CC message, and when you flip the toggle switch they should start sending the opposite type of message. If some or none of the buttons are working go back over the circuit and make sure all the connections are correct, as well as checking that the wires are securely connected to the buttons.
Step 5—Inserting Electronics into Enclosure
Congratulations! You have just built a working DIY MIDI controller! However right now it is probably a sprawling mess of wires over your desk making it not very playable. To fix this you need to move the circuit into an enclosure and insert the buttons/switch into the top of it.
First you need to make 9 holes in the top of your enclosure to hold the arcade buttons and switch. Arrange the holes for the arcade buttons in two horizontal lines of four with the toggle switch on either side of this. You also need to make a small hole on either side for the USB port.
Next you need to remove the buttons/switch from the breadboard (but remember where they connect to) and insert them into the holes. Your particular arcade buttons will either have a nut or two springy tabs to fasten them to the enclosure, though your switch will most probably have a nut and washer.
Finally you need to insert the breadboard into the enclosure and reconnected the buttons and switch. From left to right and looking at the top of the enclosure, connect the top row of buttons to digital inputs 1–4 and the bottom row to 5–8.
Now close up your enclosure, making sure no wires become disconnected in the process, and your DIY MIDI controller is finished!
Step 6—Moving to Stripboard (optional)
If your new controller is just going to stay on your desk it will be fine to leave it how it is. However, if you plan to take it on the road with you, you may find wires will start becoming disconnected from the breadboard. To prevent this from happening you will need to replace the breadboard with a piece of stripboard that requires all connections to be soldered. See this guide on how to use stripboard. I recommend connecting the Teensy board to the stripboard via an IC socket (28 pin, 0.6” wide) so that the Teensy can be easily removed from the circuit, which allows you to easily replace it if it breaks or remove it for another project if needed.
So that’s how you can make a simple DIY USB-MIDI controller with Teensy and a really simple circuit. With Teensy you can connect a large number of different controls and sensors and create highly complex and customizable MIDI controllers—just take a look at the Teensy projects page to see all the amazing Teensy-based audio and MIDI devices that people have made.