I'm a huge fan of technology and music, but when I decided to start making my own electronic music, I was discouraged by the high price of MIDI keyboards and controllers. After a lot of tinkering, I saw the opportunity to create my own MIDI keyboard using an Arduino Uno and electric paint, for a fraction of the price compared to existing MIDI devices!
In this tutorial, I will explain and show you how to create your own cheap MIDI controller using an Arduino and electric paint. I will show you step-by-step instructions on how to make the prototype board, how to flash your Arduino with the right software and how to connect and use it with electric paint. In the end, you will have build your own MIDI controller with 12 keys, which has the ability to change octaves and has a Control Change Parameter which responds to the height of your hand above the controller. Let's get started!
Step 1: Gathering Materials
Apart from the electric paint and the actual Arduino Uno board, I was able to get all the electronic parts at a local shop in the Netherlands for €3,50. I did my best to link the parts I used in the Amazon store, but by searching for the parts in your own local electronic (internet) shop, you can lower the price significantly.
Also, If you can't find the exact components I used, you should be able to make reasonable substitutions and the MIDI controller should still work (e.g. you could use a slightly different resistor values or leave certain sensors out).
For the electronics, you will need the following:
- 1 Arduino Uno with an usb cable
- 1 jar of Electric Paint
- 1 5x7cm prototype PCB board
- 3 pushbuttons with matching 2.2K ohm resistors
- 1 LED with a matching 10K ohm resistor
- 1 LDR sensor with a matching 4.7K ohm resistor
- 1 mini jumper connector
- 12 2.7M ohm resistors (2.700.000 ohm)
- 30 straight male pin headers
- 12 bended male pin headers
- 12 male-to-female jumper wires
- 12 uncoated paperclips
Besides the nessecary electronics, the following tools may also come in handy:
- Soldering iron and solder
- A wire stripper
- A side cutter
- A third hand soldering stand
- A multimeter
- Some extra wires and/ or thin iron wire
In the following 7 steps, we are going to make a prototype board which can be placed on the Arduino Uno. This will be used as a simple interface to connect the electric paint and to modify certain MIDI settings.
NOTE: During the remainder of this Instructable, I will refer to the prototype board as PCB.
Step 2: Soldering the Headers
The first step of creating the PCB begins with soldering the headers in the right place. Start by placing the 90° bended headers in the center of the first row on the PCB board, as seen in the first image. These pins will later act as touch sensitive pins to which you can connect the electric paint.
After inserting the headers in to the PCB slots, you might notice that the pins stick out on the bottom of the PCB. To solve this, push them back a little, while firmly pressing the black plastic guiders to the PCB. This ensures the pins are flush with the PCB. Now solder the pins from the bottom of the PCB and make sure no connections touch each other.
NOTE: Do not apply too much heat for too long on the pins, otherwise they get very hot and melt the plastic.
For the second step, place all the straight headers into the slots on your Arduino, like in the second image. Now for the tricky part, place the PCB on the headers inserted in to the Arduino. You might notice that this action requires a little bit of force and that the pins do not align perfectly in the slots of the PCB, as seen in the third image. Unfortunately, Arduinos are not designed with the use of PCBs in mind, but there is nothing we can do about it ;)
After you succeeded putting the PCB on the headers, make sure the pins are flush with the top of the PCB and solder them from above. Now you should have a nice prototype board which can be placed on and be taken of the Arduino Uno.
Step 3: Soldering the Pads/ Traces
Now remove the PCB from your Arduino and flip it on its back, like in the first image. In this step we are going to make pads/ traces to which we can later add components. There are two ways of doing this:
- Fill in all the needed holes with solder to form a trace and connect them to each other
- Make use of thin (iron) wire
I advise using the second method, since it is easier and quicker to do. If you choose this method, follow the layout of the wires on the PCB in the second image. A red dot means you should solder the wire on that spot. A yellow dot means that you should connect the thin wire to the headers on the other side of the PCB, like in the third image. (As you can see, I messed up a little on the lower left corner of the PCB when applying to much solder, be careful with that!)
TIP: If you don not have any thin wire, cut the legs of some used resistors to use them as traces!
Step 4: Soldering the Capacitive Touch Resistors
It is time to install the components which will give this project its main functionality, namely the 2.7M ohm resistors which will provide the touch capacitive functionality.
NOTE: If you want to learn more about the theory and applications of capacitive touch sensors, I advise you to read the following tutorials:
Place one 2.7M ohm resistor underneath the most right 90° bended header pin and push the legs through the holes, like in the first image. Now flip the PCB and push the one leg of the resistor back in the next hole, as can been seen in the second image. Solder the lower leg of the resistor to the PCB hole and the upper leg of the resistor to its assigned header pin and attach a 7cm wire to the header pin, as can been seen in the third image.
Repeat this process until all resistors and wires are soldered in place. The lower legs of the resistors should form one long connection.
TIP: Choose an alternating colour scheme for your wires, this will make them easier to connect in the following steps.
Step 5: Soldering the Pushbuttons
Now for the tricky part, soldering the pushbuttons, LDR and LED.
Start by placing the pushbuttons and resistors on the PCB like in the first and second image. In my example I am using 2.2k resistors, but any resistor with a value between 2k and 10k ohm will work.
Flip the PCB and solder everything in place. Image 3 explains the various connections you should make: a blue dot represents a leg of a pushbutton that you should solder to the PCB, a pink dot represents a leg of a resistor that you should solder to the PCB, a red trace means you should solder the two points it is connected to. And a black trace represents a wire that goes from one leg of the pushbutton through a hole on the PCB, which then connects to a header pin on the other side.
If all soldered correctly, the two most left buttons allow you to change the octave of your MIDI messages, while the most right button allows you to activate the LDR sensor.
Step 6: Soldering the LDR and LED
If the pushbuttons are in place, continue with installing the LDR and LED and the matching resistors.
Before doing this, it is wise to experiment with the resistors value that goes with the LED. In this example, I have chosen for a 10k ohm resistor, so the LED will not be too bright during the night. It might be possible that a 10k ohm resistor is too high for your specific LED to be switched on. Experiment a bit in order to find the right resistor value which provides a brightness you like.
TIP: Anywhere between 330 ohm and 5k ohm should be good resistor value for a 5mm LED.
Now, place the LED, LDR and resistors (4.7K for the LDR, some experimenting required) in the right place. Flip the PCB and solder everything in place. Image 3 explains the various connections you should make: the brown dots represent the legs of the LDR that should be soldered to the PCB, a pink dot represents a resistor leg that should be soldered to the PCB, orange dots represents the legs of the LED that should be soldered to the PCB, a red trace means you should solder the two points it is connected to. And a black trace represents a wire that goes from the resistor leg through a hole on the PCB, which then connects to a header pin.
NOTE: Before soldering the LED, please make sure you get the polarity of the LED right. The positive lead of the LED should connect to the resistor and the negative lead to the ground trace/ pad.
Step 7: Testing All the Connections
Now it is a good time to test whether you successfully soldered the connections of the buttons, LDR and LED. Since this is the final opportunity fix problems, I advise you to upload the test fixture code to your Arduino and let the code run. Like every other file for this project, the code can be found on the GitHub page for this project. Clone/ download the project and upload Arduino_Test_Fixture_Code to your Arduino.
After uploading the code, open the Serial Monitor and follow the steps. If you successfully completed the test fixture, you can move on to the next step. If not, double check the previously soldered connections on the PCB for proper connection or short circuits. A multimeter may come in handy if you experience any troubles.
Step 8: Finalising the PCB
Yeah! This is the final step in creating the PCB for the Arduino. This step is simple, but does require some focus and attention.
Start by inserting the white and green wires into its holes, as seen in the first image (note how we skip the first two holes). This is where the use of two different colours of wires comes in handy.
Now, flip around the PCB and cut the first wire to the right length, as seen on the second image. Then solder it to the header pin which goes into the slots on the Arduino. Repeat the steps for the following wires until you end up with the result as can been seen in the third image.
Your own-made prototypeboard is done! But, before you start using it as your new keyboard and MIDI controller, we first need to test the connections with the provided test sketch. It can be found on the GitHub page for this project. The name is Arduino_Test_Fixture_Code_2. Upload the sketch, open the Serial Monitor and touch the 'touch pins' on the PCB. If you see the text 'Note x is active' for each of the pins when touched, all touch pins are working correctly.
Step 9: Transforming the Arduino in a MIDI Device
Now that your prototype board is done, it is time to transform your Arduino into a real MIDI device which can be detected by music programs, such as Ableton and Fl Studio or even other hardware MIDI devices. This is a two step process:
- Change the current firmware on the Arduino Uno to MIDI compatible firmware
- Upload the MIDI sketch on the Arduino
We start with step one. By default, the Arduino is loaded with usb-to-serial firmware, which allows your Arduino to communicate with your pc and the Arduino IDE. With the new firmware, called DualMoco, we are adding a second mode, which allows your Arduino to act as a native MIDI device.
Let's start with step 1. If you are using MacBook or iMac I advise you to look up the following Instructable on how to change firmware when you're using a Mac and download the right firmware file, which can be GitHub page for this project, in the Firmware folder. Search for the DualMoco.hex file.
For Windows users, you will be using a program called FLIP and follow this tutorial on how to change the firmware on your Arduino. The right hex file can be found on the GitHub page for this project, in the Firmware folder. Search for the DualMoco.hex file.
After uploading the new firmware, reconnect the Arduino to your pc. If everything went successful, your Arduino should not be detected in the Arduino IDE, because of the new software and its current mode (MIDI mode). Open up a music program which is capable of receiving MIDI messages (such as Fl Studio, Ableton Live, Reason, etc. ) to check if the Arduino with the name MIDI/MOCO for LUFA shows up under the MIDI settings, as seen as in image 1.
Step 10: Making Final Preparations
The great thing about the DualMoco is that it has a second usb-to-serial mode, which allows you to upload sketches from the Arduino IDE, just like with the normal firmware! To get your Arduino in this second mode, connect the two of the ISCP pins together, as shown in image 1 and 2. You could either use a simple wire or a small jumper as shown in the images. Now disconnect the USB-cable for a few seconds from your Arduino and reconnect it, your Arduino should show up in the Arduino IDE as usual.
NOTE: When you want to switch to from usb-to-serial modo to MIDI mode, remove the jumper from the ISCP pins as shown in image 3, and reconnect the Arduino to your PC.
Now it is time to upload the actual sketch to your Arduino, called Arduino_Final_Code. As always, the sketch can be found on the GitHub page for this project. Download it, put your Arduino into usb-to-serial mode and upload the code. Verify if everything works by running the Serial Monitor and messing around with various inputs and buttons on the prototype shield. If necessary, fine tune the threshold settings by experimenting with the THRESHOLD and RES values. After everything works as expected, change the following code on line 17, from:
boolean midiMode = false; // if midiMode = false, the Arduino will act as a usb-to-serial device
boolean midiMode = true; // if midiMode = true, the Arduino will act as a native MIDI device.
Now that the final changes are made to the code, it is time to test it with Ableton, Fl Studio or any other music program capable of handling MIDI devices. First we have to switch the Arduino into MIDI mode, to this this:
- Upload the final code to your Arduino.
- Remove the USB cable from the Arduino so it is not receiving any power.
- Switch the Arduino into MIDI mode by removing the jumper on the ISCP pins.
- Plug in the USB cable in the Arduino.
If everything went correctly, open up your music program and start touching some of the pins. Magic sounds should start playing!
Step 11: Soldering the Paperclips to the Jumper Cables
Now that the PCB interface on the Arduino is completely finished, it is time to focus on the electric paint and how it is connected to the interface. There are millions ways of doing this, but I have chosen to use paperclips which slide on the painted paper, since they are easy to get and can be reused.
The proces of soldering a paperclip to the wire is pretty simple:
- Cut off the wire on one side of the cable
- Strip the wire 5mm
- Solder the stripped wire to the paperclip
- repeat till all 12 paperclips are soldered!
NOTE: Make sure the paperclips you use, are made from iron and are not coated with any kind of paint or plastic layer, this will lower the conductivity and makes them useless for the next step.
Step 12: Painting Some Templates
Although it is possible to play the Arduino MIDI keyboard solely by touching the paperclips, it is more fun to paint your own stencils and use them. Since this is a Instructable on how to make a MIDI device on budget, I hand painted a printed stencil, instead of using screen printing methods. The template, as shown in the image above, can be found on the Github page for this project.
Painting the template is pretty straight forward, just make sure you stay between the lines and are using Electric Paint, otherwise it will not work! After the paint has dried, connect the paperclips to each of the notes and you are ready to make awesome music!
NOTE: if you made a nice template (e.g. a drum computer) and you contribute to this project, send it to me so I can add it to the Github page!
Step 13: What's Next?
What's next? Well, start gathering some materials and go make yourself one of these, if you have not done already! Please share your results (video/ pictures/ text) in the comment section, since I am looking forward to see what you are able to create! May you encounter any other problems during the process, do not hesitate to ask for help in the comment section. I will do my best to help you!