Teensy is similar to Arduino, but perhaps better suited to making a USB MIDI controller. Liam Lacey shows how to make your own DIY MIDI controller using Teensy with 8 retro arcade push buttons.  
A Teensy microcontroller board 

Step 1—Connecting Wire to the Buttons and Switch

Stripped wire
Wire connected to a pin of an arcade push button
Wires soldered to the pins of an arcade push button

Step 2—Building the Circuit

A Teensy LC on a breadboard with the ground pin connected to the breadboards negative terminal 
The toggle switch and push buttons connected to the breadboard 

Step 4—Writing, Compiling and Testing Code 

The Arduino software configured for Teensy USB-MIDI development

Step 5—Inserting Electronics into Enclosure 

My enclosure – a painted corrugated cardboard box with holes cut out for the buttons, switch, and USB port.
The push buttons inserted into the enclosure
The breadboard inserted into the enclosure 
The finished DIY USB-MIDI controller 

Step 6—Moving to Stripboard (optional) 

Moving the circuit onto stripboard


Liam is the Head Of Development specialising in software development at Modal Electronics, the company behind the 002, 008, CRAFT and SKULPT synthesisers, and was previously the lead software developer at nu desine, the developers of the AlphaSphere MIDI controllers. He was also an Associate Lecturer at UWE, Bristol, UK where he gradua... Read More


Can this code be modified to use more than 8 buttons if so how many could be used. I think I see a total of 24 digital lines, one is of course used for the toggle. I could be reading it wrong though.

Can a dual color LED be hooked up so you know what mode you are in (CC or Note) or can a small LCD display be hooked up to do the same thing?

Liam Lacey
Yes the Teensy LC and 3.2 has 24 digital pins, so you could have up to 23 arcade buttons and 1 toggle switch.
You'll then need to change the NUM_OF_BUTTONS value in the code as well as other places that this value is used.

The simplest way to use an LED would be to use a single colour LED where 'off' is one mode and 'on' is another, where only 1 digital pin would be needed. A bi-colour or RGB LED could also be used, but involves a more complicated circuit. An LCD display could also be used - see https://www.pjrc.com/teensy/td_libs_LiquidCrystal.html.

Hello sir , do you know about FL studio ???? I want to make my own very small usb midi contoller for FL studio with your help. I want to tell you about functioning of my device by a picture(i draw) ,,,,how can i post comment with picture??? Thank you
Liam Lacey
I don't think you can post pictures here unfortunately. I would recommend uploading the picture to an image hosting website such as imgur or photobucket and posting a link to the image here.
Great article. I have created a smaller version of this to control vMix software on my Windows 10 laptop. The buttons work great but I would like to have the LEDs light up using the Tally light outputs in the software. Is it possible to modify this code to receive the tally signals? I am a total newbie when it comes to coding for midi control so any help with code would be awesome....
Thanks in advance.
Liam Lacey
Hey, sorry I don't know anything about Tally light systems. Does the vMix software allow light signals to be converted into MIDI messages? If so the MIDI messages could then be forwarded to the Teensy and easily processed in the code.
First of all thank you very much for this awesome tutorial and sorry for my English. I´ve built a 16 arcade button controller and I have upload the code in to my Teensy++ 2.0 but I have a problem. I´m using FL Studio but I´m not getting any sound I don´t know what´s wrong. The programme recognizes the "Teensy MIDI" but it hasn´t any port asigned. I really need some help because I´m a total noob whith DAW programmes.
Again, thank you for the tutorial and for your time.
Hi, Liam!

Thank you for this tutorial.

What I want to do is only two button midi controller.

Talkback controller (SPL 2381) & Logic Pro X.

When I switch ON the Mix button on the SPL, it would enable the certain plugin in Logic and when the Mix button is OFF, it would bypass the plugin. The same goes for 2Tr A button on the SPL controller.

I tested it with other midi controller and it works as expected.

Is Teensy LC enough for my project?
I would also like to know if it is possible to switch between MOMENTARY and TOGGLE mode, or is it Momentary only? (this mode is what I need for my project)

Thank you

Liam Lacey
Hey Roger,

A Teensy LC will be more than powerful enough to build a two-button MIDI controller.

As long as you use push buttons (as opposed to toggle switches), the buttons can behave as both momentary and toggling - see https://www.arduino.cc/en/tutorial/switch for an example of how you could implement this in code.
Hey Liam,

Thank you for explanation.

What is the maximum capacity for buttons on Teensy (In case I will change my mind and also connect other buttons)?

Can't wait to assamble my first micro controller project, though still waiting for Teensy.

Liam Lacey
Hey Roger,

The Teensy LC has 27 Digital I/O pins, meaning you can directly connect up to 27 buttons, however there are methods (e.g. multiplexing) of connecting more buttons if needed. Most of the other Teensys contain more pins - see https://www.pjrc.com/teensy/techspecs.html for more information.
Hey Liam,

27 buttons will be more than enough.

Hello! Thanks for the tips. How would I go about changing the code or even set up if I wanted to make this using LDRs rather than buttons. It should be simple but I'm just not too familiar with the code requirements.

Liam Lacey
Hey Erin,

As Teensy is an Arduino-compatible platform, do a Google search for "Arduino LDR" and you'll find plenty of existing tutorials and examples that will show you how to do this. The main difference from this project is that you'll need to use analog pins to read the LDR inputs.

Hope that helps!
Het Liam,

I'm working on my master's thesis right now and part of it is creating a MIDI controller for a software guitar looper made in Pure Data. My concern is that I want it as cheap as possible, so I'm thinking about buying Teensy LC. Question I want to ask is. I want to have 12 buttons that will have basically the same functionality as yours (sending a MIDI value of a note), that would be OK, but also with this I want to have 4 extra rotary potentiometers for adjusting volume. That makes a total of 17 inputs. I read that Teensy LC has 13 analog inputs and plenty of other digital I/O pins (in total around 27 I guess). So fimally my question is. Will Teensy LC be enough for this project or do I need Teensy 3.2 which has 21 analog inputs? I'm new to this and would appreciate any comments on this. Thanks a lot!

Liam Lacey
Hey Honza,

You'll be able to use a Teensy LC for your project.

If you have a look at the LC pinout diagram at https://www.pjrc.com/teensy/card6a_rev2.pdf, you could use pins 0-11 for your buttons and pins 14-17 (referred to as pins A0-A3 when using them as analog pins) for your pots.

Hope that helps!
Hello great article!
I've been trying by my own to make à similar controller.
I just have a problem, once I program the teensy, if I unplug and replug the teensy, impossible to get thé midi messages fromage the teensy.
Have you a solution to solve it?

This project is fantastic. I followed the instructions, and all worked beautifully right away! I know nothing about code, but what you provided was great.

I built a single button version with the toggle switch. I’m using this to control a Leslie speaker effect in my music software.

To expand upon this project, can one use a 3-way blade switch instead of the arcade push button? This type of switch simply connects different circuits together, I think. These are found on electric guitars to switch between the various pickups. Just wondering...

Thanks again.

Bill Congdon
Liam Lacey
Hi Bill,

Glad to hear the tutorial was useful to you!

It would be possible to replace the arcade button with a 3-way switch, however the type of switch you use will affect how you need to change the circuit and code. The most common method would be to instead use an analogue input/pin (instead of a digital one) on the Teensy where each switch position creates a different analogue value - do an online search for '3-way switch and Arduino' to see how this can be done with Teensy.

I hope this helps!
Thanks loads for this article. I'm going to attempt to make a simple two button version, with a view to creating a box that I can plug a couple of 1/4 jack foot switches into, for example keyboard sustain pedals in the organ style, the idea is then to trigger simple bass drones/tones with my feet while I play instrumental guitar. Let me know if you have any tips for this setup! Thanks
I found this article while searching for Teensy LC examples for MIDI projects. I keep hearing that the Teensy is better suited to MIDI than the Arduino. However, at the end of Step 3 you say that the Teensy has an advantage of internal pull-up resistors compared to the Arduino. I believe many if not most microcontrollers have internal pull-up resistors and the Arduino is no exception.
Hi Liam..
Thanx for your good work..
I really need your help,
i’m using Teensy LC for Midi Controller, i uploaded the Sketch, and do = Tool USB > MIDI
And when I’m using MIDI Monitor, looks good, work well,
But when I’m hooking it to a Device (USB or MIDI pin), it’s not working, i mean I think the device doesn’t recognize the Teensy as a Midi controller

What did i do wrong, and what should i do?

Is it possible to add a midi connector, in order to control external devices via midi?
And if yes, how?
Hi Liam. Great article. I'm new to the arduino world and this was very helpful. I was able to convert my, 5 pedal, korg ec5 to midi! My question is, can I send CCS on both modes? It would turn my 5 pedal into 10 with a use of a switch. Thanks!
Is it possible to send MSC message instead of send note message ?
David M
I'm quite new at this. Building a virtual pipe organ and have wired a could of boards for certain functions. I successfully completed this project and it worked. Then when I disconnected it and plugged it back in it wouldn't work. Do I have to run the Arduino software are upload the software every time I want to use it? And does the Arduino software and all the compiled code have to be on another computer to use it there?

I'm obviously missing some basics here....
Hi Liam,
Many thanks for a great tutorial - you've given me the confidence to try something similar!
Is it possible to use the toggle switch to change the set of MIDI CC messages rather than switching between CC & note messages? How would I alter your code to achieve this please?
Many thanks!
Marvelous, so simple. I've just adapted this project to make "The world's smallest 8 octave MIDI keyboard" - 70x30x15mm! My use is to ease developing VST synth patches when I'm out and about - without a physical MIDI keyboard you're usually forced to use software keyboards, which are often SUCH a pain: Stealing focus, disabling keyboard shortcuts etc. One octave keyboard layout, 7 octave-shift buttons (+ a button to output CC codes). The Teensy really is easy to use for things like this, thanks for showing us all how.

Want to join the discussion?

Create an account or login to get started!