יום שני, 21 באפריל 2014

Learning Creative Learning - Week 5 - Tinkering with Keyboards

Goal: a home-made MaKey-MaKey

This week's assignment was to tinker with something I hadn't done before. The videos of this week showed "MaKey MaKey" - a small controller that attaches to the computer via USB and allows you to connect conductive stuff to various keyboard keys and activate them creatively. I decided to try and build one myself.

The initial thought was to hack a keyboard into a MaKey-MaKey, so I started out by looking for a keyboard no one needed. My neighbor Keren had one, which was partially working after a little coffee spilling accident a while ago. Some keys functioned, others didn't.

Taking the keyboard apart

I started by taking the keyboard apart. The keyboard is made of a tray that holds all the parts, an upper frame that includes all the keys, a rubber or silicon dome sheet, three plastic sheets with printed circuits, a printed circuit board (PCB) that holds the controller and some other functions and a USB cable.













The plastic keys have a moving range of a couple of millimeters. When the key is pressed down, it presses the rubber/silicon dome down, and a hard tip in the rubber/silicon dome is pressing a conductive material printed on the top plastic sheet down, to make contact with the conductive material on the lower sheet, and by that closing a circuit - see diagram below.












My initial thought was to hack the keyboard there, meaning, attach wires to the exact points where the keys press against the conductive material. But, this was not working out, as I did not have a good way to attach the wires to those particular spots. I had to find a better way.

Exploring the keyboard matrix

If each key was attached directly to the computer, keyboard cables had to be pretty thick, having to hold one wire per key + one wire for ground (to close the circuit). But keyboards work differently. They use a matrix of wires, so that each key belongs to a row (common to other keys, and to a column, also common to other keys. A micro controller constantly scans the columns, and determines which row is active in each column, and by so it can calculate which keys are pressed. There is a clear explanation here: http://www.dribin.org/dave/keyboard/one_html

In the keyboard I have there are 17 columns and rows, which sum up to 289 combinations.















I took out the PCB from the keyboard, connected it to my computer's USB port, opened a notepad program and started exploring the keyboard matrix by connecting different rows and columns and observing what happens on screen. For example, when I connected the first row with the fifth column, I got the letter "e" printed on screen. I collected a few of these combinations.

Building the home-made MaKey-MaKey

So now I had what I needed for building the prototype. The design was to use the PCB as-is, including its USB connector, solder wires row #1 and a few wires to specific columns, for which I had already knew the combinations and the output they produce (e.g. "e", "l", etc.).

Soldering was not easy - the solder did not stick well to the rows and columns connectors. What I eventually did was to drill tiny holes through the connectors and soldered the wires into these holes.









Using Scratch to do stuff

Seeing letters printed on screen is nice, but I wanted the hack to do something more exciting. So I added a Scratch program to respond to the various letters received from the hack by playing sounds and doing stuff.








Trying out the home-made MaKey-MaKey

I invited my son and his friend to try out the hack. They liked it and started to experiment. Here are a couple of videos we shoot: