Introduction: Carrot Piano (A MaKey MaKey Project)

Have you ever thought that a carrot can create such a good sound? With the help of a MaKey MaKey they can. But just having a few keys isn't good enough, we are going to build one that can have 18 keys and 2 full octave's.

Step 1: Materials

-MaKey MaKey
-Carrots (or you could use another form of fruit or vegetable)
-A Laptop (or computer, but i prefer a laptop as it is more portable)
-VMPK (Virtual Midi Piano Keyboard, a free piece of software available from here- http://sourceforge.net/projects/vmpk/ )
-Arduino Software (available from here- http://arduino.cc/en/Main/Software )
-Arduino Plugin
-alligator cables (comes with the MaKey MaKey)
-Single core wire (for the input on the back of the MaKey MaKey)
-Some way to connect you to the MaKey MaKey (i used an antistatic wrist strap)

Step 2: Reprogramming the MaKey MaKey

This is a fairly long process but when you get used to it, it is extremely easy.

Before you can program the MaKey MaKey using Arduino, you need to download the Arduino environment from here- http://arduino.cc/en/Main/Software . Download the latest version that suits your operating systems (Windows, Mac, Linux). The download comes in the form of a zip file, which needs to be unzipped to a directory you'll remember. From there you can access the Arduino application by double-clicking the Arduino application.

You will also need to download the driver and addon for the MaKey MaKey, you can get those here- https://www.sparkfun.com/products/11511 .

A detailed set of instructions on programming your MaKey MaKey is available here- http://www.sparkfun.com/tutorials/388

I am not going to go into details about how to reprogramme your MaKey MaKey but i will show you what you should put.


#include "Arduino.h"

/*
/////////////////////////////////////////////////////////////////////////
// KEY MAPPINGS: WHICH KEY MAPS TO WHICH PIN ON THE MAKEY MAKEY BOARD? //
/////////////////////////////////////////////////////////////////////////

  - edit the keyCodes array below to change the keys sent by the MaKey MaKey for each input
  - the comments tell you which input sends that key (for example, by default 'w' is sent by pin D5)
  - change the keys by replacing them. for example, you can replace 'w' with any other individual letter,
    number, or symbol on your keyboard
  - you can also use codes for other keys such as modifier and function keys (see the
    the list of additional key codes at the bottom of this file)

*/

int keyCodes[NUM_INPUTS] = {
  // top side of the makey makey board

  'c',      // up arrow pad
  'b',    // down arrow pad
  'n',    // left arrow pad
  'v',   // right arrow pad
  'm',               // space button pad
  'q',        // click button pad

  // female header on the back left side

  'w',                // pin D5
  'a',                // pin D4
  's',                // pin D3
  'd',                // pin D2
  'f',                // pin D1
  'g',                // pin D0

  // female header on the back right side

  'h',                // pin A5
  'j',                // pin A4
  'k',                // pin A3
  'l',                // pin A2
  'z',                // pin A1
  'x',                // pin A0
};

///////////////////////////
// NOISE CANCELLATION /////
///////////////////////////
#define SWITCH_THRESHOLD_OFFSET_PERC  5    // number between 1 and 49
                                           // larger value protects better against noise oscillations, but makes it harder to press and release
                                           // recommended values are between 2 and 20
                                           // default value is 5

#define SWITCH_THRESHOLD_CENTER_BIAS 55   // number between 1 and 99
                                          // larger value makes it easier to "release" keys, but harder to "press"
                                          // smaller value makes it easier to "press" keys, but harder to "release"
                                          // recommended values are between 30 and 70
                                          // 50 is "middle" 2.5 volt center
                                          // default value is 55
                                          // 100 = 5V (never use this high)
                                          // 0 = 0 V (never use this low


/////////////////////////
// MOUSE MOTION /////////
/////////////////////////
#define MOUSE_MOTION_UPDATE_INTERVAL  35   // how many loops to wait between
                                           // sending mouse motion updates

#define PIXELS_PER_MOUSE_STEP         4     // a larger number will make the mouse
                                           // move faster

#define MOUSE_RAMP_SCALE              150  // Scaling factor for mouse movement ramping
                                           // Lower = more sensitive mouse movement
                                           // Higher = slower ramping of speed
                                           // 0 = Ramping off

#define MOUSE_MAX_PIXELS              10   // Max pixels per step for mouse movement

/*

///////////////////////////
// ADDITIONAL KEY CODES ///
///////////////////////////

- you can use these codes in the keyCodes array above
- to get modifier keys, function keys, etc

KEY_LEFT_CTRL
KEY_LEFT_SHIFT 
KEY_LEFT_ALT 
KEY_LEFT_GUI 
KEY_RIGHT_CTRL 
KEY_RIGHT_SHIFT 
KEY_RIGHT_ALT
KEY_RIGHT_GUI 

KEY_BACKSPACE 
KEY_TAB   
KEY_RETURN  
KEY_ESC   
KEY_INSERT  
KEY_DELETE  
KEY_PAGE_UP  
KEY_PAGE_DOWN 
KEY_HOME
KEY_END   
KEY_CAPS_LOCK

KEY_F1   
KEY_F2   
KEY_F3   
KEY_F4   
KEY_F5   
KEY_F6   
KEY_F7   
KEY_F8   
KEY_F9   
KEY_F10
KEY_F11   
KEY_F12  

*/

Step 3: VMPK

Now you need to open VMPK. Once it is open, you will need to go to edit and then keyboard map. then you need to set the following key numbers to letters.

24-w
26-a
28-s
29-d
31-f
33-g
35-h
36-j
38-k
40-l
41-z
43-x
45-c
47-v
48-b
50-n
52-m
53-q

This will make it so that your MaKey MaKey will work with your VMPK. You can then save this by pressing save and then press OK.

Step 4: Wiring It Up

Now you want to wire up your MaKey MaKey. First, lay out your 18 carrots in a row spaced out so they are not touching. Then you want to connect your MaKey MaKey scokets (Numbered in the image above) to the carrots in order

Carrot No. | Socket
1 | 6
2 | 7
3 | 8
4 | 9
5 | 10
6 | 11
7 | 12
8 | 13
9 | 14
10 | 15
11 | 16
12 | 17
13 | 0
14 | 3
15 | 1
16 | 2
17 | 4
18 | 5

After  this, connect  your Antistatic wrist strap to your earth and to your wrist.

Step 5: Testing

Now open up VMPK and run your finger along all of the keys (carrots) to see if they make the correct notes. If they don't make a note at all, check your connections to the carrots and to the wrist band. If the carrots age making the wrong notes, have a look at the key mapping and make sure everything is Ok. If any of your carrots are all mixed up, just put them in the correct order.

Now go off and have a Play with your piano, if you find that you are having problems with your piano, don't hesitate to leave a comment . thank you for reading my first of hopefully many Instructables.

DIY Audio

Participated in the
DIY Audio