Convert a Toy Piano to Work As a Midi Device and Use It With Synthesia




Introduction: Convert a Toy Piano to Work As a Midi Device and Use It With Synthesia

Goal of this project:
Convert a cheap toy piano to work as a midi device and use it with Synthesia (
Other programs that use midi inputs can also be used.

The pushbuttons of the piano are used to make a simple pull-down circuit for the arduino mega. The arduino interprets the keystrokes and sends serial midi data to the pc. Then this data is send to a virtual midi port with "serial-midi converter". This midi port is connected to Synthesia via "MIDI Yoke". MIDI Yoke is a driver that creates virtual ports. Each port has an input and an output which are connected. With MIDI Yoke you can couple different midi programs without any physical hardware.

Step 1: Parts and Tools

List of the parts needed for this project:

- Toy piano
- Arduino mega (This project van also be done with an arduino uno but you should use an line decoder to expand your arduinos inputs.)
- Flat ribbon cable (from old pc)
- Connectors (1 for piano and 1 for arduino)

List of tools needed:

- Soldering iron
- Desoldering pump or wick
- Ohmmeter
- Hot glue or any other strong glue

Step 2: Hardware

The pushbuttons of the piano keys are used to make simple pull down circuits. The internal pull-up resistors in the atmega IC are used so we don't need extra external pull-up resistors. 

- Open the toy piano and locate the pushbuttons corresponding to the piano keys.
- Check if all the buttons have a common line. This is the ground line.
- Locate and remove the main IC. Solder wires to all leads going to the buttons including the ground wire.
- Check you didn't make any shorts while soldering. (ohmmeter)
- Solder the other ends to the connector for the flat ribbon cable.
- Make a cutout in the housing of the piano for the connector.
- Reassemble the piano.

Step 3: Software

Arduino Code:
The arduino just checks all keys one after another and keeps repeating this. Every time a key changes its state (pressed or released), serial data is send which specifies: the action (pressed or released), the tone corresponding to this key and the velocity. The velocity is set to the maximum since the keyboard is not velocity sensitive.

It should also be possible to change other setting via midi. e.g.: change the pitch, change the instrument, ... This is not implemented in my arduino code and i also didn't check this.

MIDI Yoke: (
Just install MIDI Yoke and restart your pc. If everything went right you should find an icon named "MYokeNT" in the control panel.
You can specify the number of virtual midi port here. For this project you just need 1. 

Serial-Midi Converter: ( by Mark Demers
1) Connect serial device onto computer
2) Launch Serial_MIDI_Converter_V2D
3) Select serial port 
4) Select baud rate (this should be the same as stecified in the arduino code)
4) Select midi input port (MIDI yoke1)
5) Select midi output port (MIDI yoke1)
6) Let the applet run in the background, RX and TX will flash with serial data

If you press a key the RX and TX should flash a green light. If it flashes red the received midi data is invalid.

This program is for debugging only. You can attach MidiOX to the virtual midi port and monitor all data that is send from the Serial-Midi converter. This can be handy for determining the offset and checking your arduino code in case you have to change it.

1 Person Made This Project!


  • Micro:bit Contest

    Micro:bit Contest
  • Metal Contest

    Metal Contest
  • Soup & Stew Speed Challenge

    Soup & Stew Speed Challenge



Reply 6 years ago on Introduction

I still use windows 7 and i hadn't any problems. On the midi OX forums they suggest to install midi yoke with "Windows User Account Control" turned off.;action=display;num=1374889053

P.S. Don't forget to turn "Windows User Account Control" back on after the installation has completed.

The forum contains a lot of other helpful information concerning Midi yoke installation.

I hope this is useful.


Reply 6 years ago on Introduction

I havent seen your reply :D but i ran it with troubleshoot compatibility, used Test program, and installed it smoothly.. Tnx.
But i still have some trouble. I use Arduino Uno, (0-13 + GND) and an piano keyboard with 47 keys, and 15 pins input/output. I did every step, but SM's TX and RX flashes just once red, and nothing happens even when i press keys.. Maybe i should change the code in arduino? any hints? :D


Reply 6 years ago on Introduction

My arduino code is used on an arduino mega so it won't work on arduino uno. But the general structure is there. You should make a for loop over all digital input pins, read every pin and compare it to its previous state (stored in prevPinState). if there is a change: send a midi command. You also have to choose another "offset". this is used to convert the pin index to the corresponding midi key note number. (see

Also make sure the indexes of "prevPinState" are correct.


7 years ago on Introduction



8 years ago on Introduction

So,as I understand,i can use this not only for toy piano,but for whatever buttons I want,right?The red wire whitch isn't connected to the flat ribbon cable is the +9V Lead?
Thank You.


Reply 8 years ago on Introduction

You can use this for whatever buttons you want. I've seen a simular project where they used pieze sensors to monitor the strokes on a xylophone and convert these to midi.
The red wire is connected to ground. This is because i used the internal pull up resistors of the arduino. If you press a button, you will pull the voltage to ground. (Inverse logic: button pressed is LOW, button released is HIGH).


8 years ago on Introduction

You can do this also with a Standard Arduino (UNO, Diecimila, etc) and a bunch of shift registers.