Introduction: Easy DIY Arduino Touch Sensor Piano

About: I love tinkering with Arduinos and other electronics. I am the owner of A2D Electronics, an online store based in Ottawa, ON that is committed to providing Arduinos, Raspberry Pis, accessories, and other elect…

This mini piano requires no soldering and is very easy to make.

It's a great starter project to get into Arduinos. I had tons of fun making it and playing it once finished!

This project can be completed by anyone, from children to seniors!

I got the inspiration for this project from Julian Ilett's first penny organ video. If you like electronics, and have not seen his amazing YouTube channel, check it out here:

I remade and simplified it so that anyone can build it!

This has gone through several iterations (each looking better than the last) and this is the best one so far!

Step 1: Materials and Tools

First off, gather all your materials and tools!

If you're like me and love Arduinos and electronics, then you might have some of this stuff on hand already.


Arduino Nano

MPR121 12-channel capacitive touch sensor

Passive Buzzer

400 Point Solderless Breadboard

4 10cm Male-Male jumper wires

1.5m 22AWG Solid core wire

12 M3 screws (6mm) and bolts

Laser cut, Hand Cut, or 3D Printed base plate

All the parts and files can be found in a complete kit here for only $19:

A2D Electronics only ships to Canada.

Wire Stripper

Wire Cutters

Needle Nose Pliers (Optional)

Step 2: Explaining the Components

Arduino Nano (blue board):

Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board. To do so you use the Arduino programming language (based on Wiring), and the Arduino Software (IDE), based on Processing.

The Arduino Nano is the brains of this project. It communicates with the touch sensor to see which key is pressed, and sends the corresponding note to the speaker.

MPR121 Touch Sensor (black board):

This will detect which screws (keys) are touched. It is a capacitive touch sensor - the same type that is found in phones, tablets, and trackpads. When a conductive object (fingers included) touches the keys, it detects the change in the capacitance.

Breadboard (white board with lots of holes):

All the pins on a breadboard are connected together in rows of 5. Anything you connect to a row will be connected to everything else in that row. It makes connections between the devices much easier. The connection diagram shows which pins are connected.

Jumper Wires:

Simple connecting wires. These will connect the Arduino and the touch sensor so that they can pass signals to each other.

Piezo Buzzer (speaker):

A small speaker. The Arduino can send it different frequencies, and it will play different notes.

You will notice that one side is marked with a +.

Step 3: Add Components to Breadboard

Arduino Nano

Push the Arduino Nano into the left side of the breadboard.

There should be 3 holes above it and 2 holes below it. This is to allow room for the buzzer later.

Make sure that it is as far to the side as it can go, so that you will be able to plug it in.

MPR121 Touch Sensor

Put the MPR121 touch sensor into the other side of the breadboard so that there are 2 holes above and below the module.

Make sure it is as far to the right as possible. The side with pins marked 0-11 (the electrodes / touch points) should be closest to the bottom of the board.

Passive Buzzer

Put the passive buzzer in to the breadboard above the Arduino.

The side of the buzzer marked with a '+' should connect in line with pin D3 of the Arduino, and the other side to the GND pin 2 slots to the right D3. You will need to bend the legs of the speaker in a little bit to make it fit.

Step 4: Arduino - Touch Sensor Connections

The MPR121 uses the I2C protocol to communicate, so we only need 2 wires for communication and 2 wires for power.

Connect each pair of pins below with a jumper wire.

Arduino -> Touch Sensor

3V3 -> 3.3V Power

A4 -> SDA Data

A5 -> SCL Clock

GND -> GND Ground

The MPR121 is a 3.3V device, while the Arduino is a 5V device. Any signal coming from the Arduino (Clock and Data lines) is too much (5V) for the 3.3V MPR121. Ideally, we should be using a level shifter, or at least some resistors to connect these modules, but it is not strictly necessary. The worst that could happen is you destroy the MPR121 and you need to buy another (very rare). It will simply shorten the lifespan of the module a little bit. I have been using it for months, and have had no problems with just directly connecting them.

Step 5: Prepare Wires for Screws

Cut the Wires

Cut the 22AWG solid core wire into 12 lengths that are the length of the breadboard. Line up the wire along the long side of the breadboard, and cut it slightly longer than that! No ruler needed.

Strip the Ends

Strip ~6mm off one end, and ~15mm off the other end of each length of wire with the wire strippers.

Make the Loops

Now, we want to make a loop at the end of the wire that was stripped to ~15mm.

This can be done by wrapping it around the screws. Place the screw in the middle of the stripped part, then bend both ends of the wire up. Now, take the shorter end, and push it to bend it around the screw, then take the long end of the wire and finish wrapping it around.

I find that the easiest way to make these loops is to grip the end in a pair of needle-nose pliers, then wrap it around of side of those. The loop should fit over the screw threads, but not over the head - roughly 4mm diameter. I might also design a 3D printable jig to get it just the right size, and perfectly circular every time.

Make sure there is a screw in each loop of wire.

Do this for all 12 wires. These will connect the screws to the touch sensor.

Step 6: Making the Baseplate

The baseplate is not a necessary component to make sound from your piano, but it allows you to easily spread out the keys, and hold everything together.

There are a few ways to make this:

3D Printed Baseplate

Download the STL attached to this step, and print it out. That's it!

I used 0.2mm layers, 20% infill, but use whatever settings work for your printer!

Laser Cut Baseplate

3mm (1/8") Home Depot hardboard, or MDF is the best material to make this piano with.

Download the SVG attached, and use inkscape (or another SVG graphics program) to modify it to be used with your specific laser cutter.

This one will cut out in 2 parts. The board with a hole for the breadboard will get glued on top of the other. Make sure to line up the screw holes and the bolt holes. For the rest of the assembly, the process is the same as the 3D printed version described.

Hand Cut Baseplate

If you don't have access to a 3D Printer or a laser cutter, you can always do this with hand tools as well.

You can use either some 3mm (1/8") Home Depot hardboard, MDF, or just simply use some cardboard of similar thickness.

Download the PDF attached, then glue it to your chosen material. Start by drilling the holes with a 3mm (1/8") drill bit, then cut out the rest of the frame.

For assembly, when you go to attach the screws to the baseplate, just stick the screws through the holes that you drilled, then attach them with a bolt on the bottom.

Step 7: Adding Baseplate and Screws

Flip the baseplate to the backside, and put a bolt in each hexagonal hole.

Then, take each of the wires with screws, and screw it in to the bolt from the front side.

If using a hand-cut baseplate, put the screws in first, then attach the bolts from the other side.

The screws only need to be tightened finger-tight.

Now place the breadboard on the baseplate. You might need to push fairly hard to get it in.

Don't peel the sticky backing off if you want to be able to re-use the breadboard.

Make sure that the pins of the touch sensor labeled 0-11 are facing the screws and wires in the baseplate.

Then bend the wires from the screws and connect them in front of the touch sensor's pins 0-11. Now each screw is electrically connected to the touch sensor, so touching the screws will trigger the sensor.

Step 8: Code!

Now to add the code!

If you bought a kit from the link given, the code is already on the Arduino, but go through this to know what to do!

Arduino IDE

To program the Arduino, you will need to download and install the Arduino IDE. You can find it here.


If you are using a Chinese Arduino clone that uses the CH340 USB to serial chip (most of them do), you will also need to download and install additional drivers from here. Yes, if you get a Chinese Arduino, get Chinese drivers.


A library is a collection of code that makes it easier to use sensors and other components with the Arduino.

You will need Adafruit's MPR121 library for this project. Go into the Arduino IDE, go to Sketch -> Include Library -> Manage Libraries, and type MPR121 in the search box. You want the first one, by Adafruit. Click on it, then click Install.

We will also use the Tone and Wire libraries that are already included by default.

Example Sketch

We only need to add 3 lines to the example sketch that comes with Adafruit's MPR121 library. All the changes you need to do are highlighted in the images.

Open the example by going to File -> Examples -> Adafruit MPR121-> MPR121test

See the pictures for details.

Add this line just before void setup():

int Freq[12] = {1047, 1109, 1175, 1245, 1319, 1397, 1480, 1568, 1661, 1760, 1865, 1976};

This in an array that defines the frequencies for all 12 different notes.

Add this line at the end of the first if statement in void loop():


This will start playing a note through the speaker on pin 3 whenever a key (screw) is pressed.

Add this line at the end of the second if statement in void loop():


When the key is released, this will stop playing the tone.

You can also download a copy of the code that is attached.

Now, you can upload the code to your Arduino.

Make sure you have the right board and port selected, then hit the upload button that looks like an arrow in the top left corner.

Congratulations, your piano is now fully functional!

Power it up, and you should be able to play some tunes.

Step 9: Make It Look Better! (Optional)

To make it look nicer, we can cut all the wires to the exact length needed.

For the wires attached to the screws, remove them from the breadboard, and lay them flat along the breadboard. Then, using your wire cutters, make a mark were they will attach to the breadboard, and cut the wire roughly 5-6mm further.

Strip the wire starting from the mark that you made.

Bend the wire 90 degrees downwards, and put it back in to the breadboard.

To make the jumper wires look nicer, we will need to replace them.

Take the rest of the solid core wire, and strip about 5mm off the end, then bend it 90 degrees downwards.

Take out one end of one jumper wire, and put the solid core wire end you just bent in to the same spot you removed the jumper from. Keep the wire flat against the breadboard, and run it between the touch sensor and the Arduino, and to the other end of the jumper wire. Then make a mark in the solid core wire, and cut it off 5mm further. Strip the end, starting from the mark, then bend it down 90 degrees. Take out the other end of the jumper wire, and put the solid core wire into it's hole.

Repeat for the rest of the wires between the Arduino and the touch sensor.

Now all your wires look amazing!

Thanks for taking the time to read through this project!

If you want to buy a kit to make it, see here:

This is my first Instructable, so if you think this deserves it, vote for me in the first time author's contest!

First Time Author Contest

Participated in the
First Time Author Contest

Invention Challenge 2017

Participated in the
Invention Challenge 2017