Advanced MaKey MaKey: Remapping Pins

The MaKey MaKey is a popular microcontroller that makes it easy to use any conductive object as an interface for a computer. When you plug a MaKey MaKey into a computer, the computer thinks you plugged in an external keyboard and mouse. So triggering the sensor inputs on the MaKey MaKey just sends keystrokes or mouse commands to your computer. The MaKey MaKey has 18 inputs that it can use to send those keystrokes and mouse commands

“Out-of-the-box,” the device comes pre-programmed to trigger:

keystrokes: w, a, s, d, f, g, up, down, left, right, spacebar

mouse commands: left click, right click, scroll up, scroll down, scroll left, scroll right

Careful readers might note that there are only 17 commands listed above. That is because left click is used twice, once on a female header pin and once on an easier to access mount for alligator clips.

So what can you do with the MaKey MaKey?

You can type. You can move your cursor around and click. You can play video games. You can play digital music instruments. You can navigate the web. You can trigger a webcam. Anything that you might do with a keyboard or mouse, you can do with a MaKey MaKey.

But there are two limitations to keep in mind:

  • You can only trigger the keystrokes or mouse commands that are programmed on the device.

  • You must be touching the earth (or ground) part of the board to trigger these keystrokes or commands. I’m going to address this second limitation in another blog post.

So what if you need the MaKey MaKey to trigger different keystrokes than the ones that are preprogrammed on the device?

Well, I’ll let you in on a secret…the MaKey MaKey is really an Arduino! Actually it’s a special Arduino called an Arduino Leonardo. The Leonardo is a bit different from other Arduinos. It’s processor has built-in USB communication capabilities so it appears to a connected computer as a mouse and keyboard. This means that we can reprogram the MaKey MaKey to trigger any keystrokes or mouse commands that we want. This tutorial will show you how. Please note: if you re-program your MaKeyMaKey, I highly recommend re-programming it back to factory default settings when you are done with it, so that nobody will get confused later on when the device they are using is not behaving the way that they think it should.

You are going to upload a new “sketch” or program into the MaKey MaKey. If you have not worked with Arduino code before, see this tutorial.

  1. Download and install Arduino 1.5 or greater if you don’t have it already.

 

2. Don’t start the Arduino IDE yet. If you do, make sure to Quit the program before you do the following steps.

 

3. Download the hardware Addon file for the MaKey MaKey here: https://cdn.sparkfun.com/assets/learn_tutorials/1/9/1/1.6_32U4_Addon.zip

 

4. Unzip that file. Inside you’ll find a folder called hardware and inside that will be a folder called Sparkfun.

5. Copy the Sparkfun folder highlighted in blue above.

 

6. We need to paste that folder into our Arduino hardware folder.

 

7. On an Apple computer, navigate to Documents – Arduino – hardware. Paste the Sparkfun folder there. If you can’t find the hardware folder, you may have to create one.

a. On Windows you need to go to My Documents – Arduino – hardware. Again, if you can’t find the hardware folder, you may have to create one.

8. Open your Arduino IDE. In the top menu bar, go to Tools – Board – and then choose Sparkfun Makey Makey.

Note: If that board is not in the list of boards, you may have missed a step above. Double check that the Sparkfun folder is in the correct place in the Arduino hardware folder on your computer

9. Plug in your MaKey MaKey device with a USB.

10. In the top menu bar, go to Tools – Port – and then choose the last port listed.

    a. On Apple, the port name will include usbmodem
On Windows, choose the COM port that appears when you plug in your MaKeyMakey
11. Now we have to get the default MaKey MaKey firmware sketch from GitHub.
   b. Click on Download ZIP in the lower right corner
   c. Unzip that file
12. In the MaKeyMaKey-master folder, navigate to firmware – Arduino – makey_makey and then open the makey_makey.ino file.
13. The MaKey MaKey firmware will open on your computer. This is the default firmware for the device, so you should save a copy to your Arduino sketch folder and then when you make edits, make sure to save it with a different filename so that you can always reprogram the device back to factory settings.
    a. From the top menu bar, go to File – Save As, and then save the file in your Documents – Arduino folder.
14. Click on the tab near the top of the IDE that is called “settings.h.” This is where you remap the keystrokes and mouse commands on the device.
15. Read the comments at the top of the settings.h file to see how to change the keystrokes. You change the values listed in the int keyCodes[NUM_INPUTS] array. For instance, if I want my MaKey MaKey to trigger numbers instead of letters and , I could change my array to [EXAMPLE CODE]
16. To upload the new code onto your MaKeyMaKey, just make sure that you have the correct Board and Port chosen from the Tools menu (see steps 7 and 9). Then from the top menu bar, choose Sketch – Upload. Wait a few seconds while the sketch compiles and uploads. You know it it finished when the Arduino IDE says “Done uploading” in the bottom left corner.
Congratulations! You’ve remapped your keys on the MaKey MaKey. When my students re-program a MaKeyMaKey, I ask them to reprogram it back to factory default settings when they are done. Otherwise someone else might have a hard time using it!