Introduction: Arduino Easy Midi Keyboard

I´m a huge music nerd and absolutely love making my own instruments and gadgets but I don´t have much skill or resources to complete complex projects so when I came across PretEnGineerings tutorial I was thrilled and wanted to give it a shot.One of the things that most attracted me to try this project is that it can be made from really basic electronic components and household items which is of extreme importance during the quarantine. I wrote this instructable to walk you through the issues and problems that I encountered to make it easy to follow along to as well as my little tweaks and improvements to adapt the project to my needs. As I previously mentioned I have very little knowledge of coding and am relatively new to the maker movement so please bear with me if I make some mistakes and be sure to leave any possible improvements in the comments :)

Features of the keyboard

  • Polyphonic
  • Midi over USB
  • Made from things at home

(This project can be accomplished with just the components inside one of the arduin0 basic starter kits)



  • Arduino
  • Jumper Wires
  • 12 buttons for testing
  • 2 10k po
  • Cardboard


  • Soldering iron (optional)

Software: (Links lead to download page)

Step 1: Wiring

The wiring for this project is extremely simple every button is grounded and connected to a pin starting from 12 to 1 which correspond to notes C to B (1 Octave). The potentiometers are connected to A0 and A1 and both grounded and hooked up to power (5v) if you decide to include them though I didn´t here for the sake of simplicity with the same code they could be implemented.

Step 2: Uploading the Code

The first thing I changed was the code to accommodate more buttons. I kept the overall structure so the same explanations he gave in the video apply to what each bit of code does just copy and pasting some parts for more buttons and changing their notes. After installing and including the MIDI library the code above should be downloaded and compiled with all of the serial lines present (the // have to be deleted of all the lines that include "Serial.") in order to test the code and wiring and for me everything there worked fine. (Check for the appropriate messages in the serial when pressing the test button hooked up to different pins. If everything is good just comment out the Serial. lines (re-write the //) and upload it again to the arduino.Open up Flip and connect with the arduino via USB by selecting the apropriate board (Atmega16u2 for arduino) and press ctrl+ U. I encountered 2 errors doing this (if you don´t have the same problems you can move on to the next step).

Step 3: Re-flashing the Arduino

ERROR 1: "AtLibUsbDfu.dll not found" or " libusb0.dll"
If this comes or any other .dll file missing they can be downloaded by clicking on the first link that comes up when searching for the name of the file and inserting it into the system32 folder without an external folder (if you still have trouble follow this tutorial)

ERROR 2: "could not connect to USB device"

This happens because there arent any propper drivers installed (at leat in my case) or because the shorting didn´t work. To test the shorting simply enter arduino IDE and check if the board shows up in any port. If this isn´t the case you can visit this page to solve the issue.

We want the arduino to act as if it were a midi device to send signals to our computer. To do this we have to give it new instructions. We will just load the Hiduino.hex file in Flip and after checking all the boxes click run to upload it. The .hex files folder is inside the hiduino master and also includes the files needed to turn the arduino back in order to accept new code.

Step 4: Case

The case is going to be made out of cardboard mainly because its all I have access to from my house :p. Simply glue down a chain of grounded switches (with all the legs bent up to allow it to lay flat) around the bottom of where the keys would be and made a "bridge" where the top of the keys would sit to raise them, the piece should be just a little bit taller than a tactile switch. Then cut out the shape of the keys either from cardboard or wood. Next run jumper cables from each of the buttons through the bridge to the arduino pins and glue the keys to the top of the bridge created at the top so that when each key pressed the appropriate switch is activated. To finish off the case the arduino and all the messy wiring are covered with the remainder of the box.

If its of your liking don´t hesitate to paint it which ever colour you like:

Step 5: Improvements

Now you are ready to connect it to your favourite DAW (digital audio workspace) through the USB cable and it should show up like any other midi device, I recommend Soundtrap as it is great for beginners, free and is run online so go and try it out for yourself. There are many ways to change up and improve this design I´ll leave some below though they will be based mainly on the resources you have at home.

  • 3d printed case: A good alternative to the cardboard box is to transfer the electronics to a different case like the OKAY keyboard design HERE.
  • Capacitive touch: Instead of buttons what if the keys could be triggered by the human touch. (see this

    for inspiration)

  • Drums: Change the keys for pads for an easy drum machine.
  • More octaves: And clearly the feature that would really turn this into a true midi controller en-par with all others is at least a second octave.

I hope you enjoyed this guide and can now make your own midi instruments, I would love to see your version if you do so please share it and vote for this instructable.

See you next time (:

Arduino Contest 2020

Participated in the
Arduino Contest 2020