• Site: Main page | Recipes | Workshops |
  • soundpad


    We are building a 4-pad Sound Toy. In this recipe you are going to open a common USB keyboard, remove the small circuit inside and solder your own switches to this circuit. We are working with a USB keyboard because these can be used on both Macintosh and Windows computers. If you are using a Windows computer that has a PS/2 plug, you can use a PS/2 keyboard instead. They are usually cheaper than the USB ones.

    Concepts and techniques in this recipe:

    Tinkering with a keyboard
    Basic soldering
    Controlling software with physical world input
    BEFORE YOU START, make sure to have all the parts and tools you need for this example

    Parts and Tools

    USB keyboard
    Screwdriver
    Pliers
    Solder
    Soldering Iron
    Multimeter
    Sandpaper
    Wire (2 colors)
    4 pushbuttons


    This is what you are about to build:

    Sound Pad


    1.a Keyboards

    How do keyboards work?
    In simple terms, a keyboard allows you to press a key, which closes a circuit associated with a particular keystroke. That closed circuit is detected by a mini-computer inside the keyboard called a keyboard encoder, which recognizes which key has been pressed. The keyboard encoder takes that information, encodes it in a digital form the main computer can understand, and passes it to the computer via the keyboard port.
    The actual physical makeup of a keyboard can vary quite a bit. A typical design includes either a circuit board or a flimsy material (hereafter simply ‘flimsy’) that lies underneath the buttons on the keyboard. Laid out on the flimsy is a maze of circuits. Directly beneath each keyboard button on the flimsy are two halves of a circuit. The underside of the button has a conductive material of some kind. When the button is pressed, the conductive material comes into contact with the two halves of the circuit below, completing the circuit. Variations on this design exist, but almost all are similar. In this recipe we are going to extract an ingredient from a USB keyboard. Take a moment to examine the front and back of the keyboard and understand how the casing is made.


    1.b Search for a way to open the keyboard

    Keyboard hacking 2

    Most keyboards can be opened by unscrewing the little screws in the back cover of the keyboard.


    1.c Unscrew the back cover of the keyboard

    Keyboard hacking 3

    There is usually a simple and easy way to open electronic objects which does not require force. Try to find screws and open all of them; if you still can’t open the cover, check again – you might have missed a screw.


    1.d Remove the back cover

    Keyboard hacking 4

    Always gently remove the cover, without destroying the casing or the electronic parts inside.


    2.a Locate the keyboard circuit

    Encoder 001

    As you open the keyboard you will notice that inside there is a small printed circuit. Usually it is green. This circuit is connected to some wires that end up being the cable with the USB connector.


    2.b Extract the keyboard circuit

    Encoder 002

    Free the keyboard circuit from the flimsy transparent sheet and unscrew it from the keyboard frame.


    3.a Understanding the circuit

    Hacking 001

    At the bottom of the circuit there is an area of metal contacts (the two orange-brown rows of stripes in the picture on the right) . These transfer the keystroke data to the USB port, via the encoder circuit. If you count the contacts you will see that they are not enough to map all the keys of a typical keyboard (more than a 100 keys). If the design of a keyboard was configured to have a single discrete contact for each key we would need more than a 100 contacts.
    To save money and space, keyboards use a design technique called a matrix -
    Note that the metal contacts are divided into two groups – each group with 13 connectors. This means that by combining two inputs the keyboard is able to map 13×13=169 keys: more than enough to map all our keys.


    4. Exposing the contacts

    Hacking 002

    We will soon solder wires to the metal contacts.
    Gently sweep fine sandpaper over the two contact rows to remove the protective coating paint and to prepare it for soldering.


    5. Exploring the contacts

    Hacking 003

    We are ready to explore the mapping of our keyboard circuit and identify the four characters we will associate with our push-buttons. We can use any character as long as they are not special characters but common ones.
    Many kinds of software enable you to see which keys are being pressed on a keyboard. You can use Keypress, a small flash utility found on the FlashKit site, or simply use any text editor and take note of what characters are being entered. The only downside of using a text editor is that if you activate special characters like ‘Page Down’ or F1 these functions will actually be performed.
    Connect the USB connector to your computer. Take a short piece of wire. Touch one end of the wire to a contact in the left group and the other end to a contact in the right group. See what happens in the software.
    There is no standard way in which matrices are configured, each manufacturer has its own. So you need to find four keys by yourself.
    On our keyboard we discovered that connecting the second contact of the right group with the first, second, third and fourth contacts of the left group maps to the keys ‘z’, ‘x’, ‘c’ and ‘v’ respectively. To have the same layout as ours, choose one contact on one side and find four contacts on the other side that map to simple characters.


    6.a Preparing wire tips for soldering

    solder 001

    Cut a length of blue wire. Expose each end of the wire,
    twist it and cover it with a small amount of solder.
    The tip should look pretty much like the one in this picture.


    6.b Preparing contacts for soldering

    solder 001

    Always remove the USB connector from the computer before you start soldering.
    To prepare a contact for soldering we put a very small drop of solder on it. Careful! if you drop too much solder on the contact you might connect two adjacent contacts and this is not good at all.
    If that happens, try to disconnect the contacts by moving a very hot solder iron in-between the contacts; this should cause the solder to melt and retract to a single contact.
    Another way to do so is to use a tool called a ‘Solder Sucker’.
    Now that you know how to prepare a contact, prepare one on one of the contact groups located on the keyboard circuit, as shown in the picture.


    6.c Soldering the wire to the keyboard encoder

    solder 001

    Now solder the wire tip to the metal contact. In order to create the layout of keys described above, this wire is going to be shared by the four pushbuttons. It should be long enough to reach the first button.


    6.d Soldering the other side of the matrix

    solder 004

    Connect four orange wires to four contacts on the other contact group, using the same technique as before. These should be long enough to reach to the four buttons.


    7.a Pushbuttons

    Keys 001

    And here is a pushbutton switch.
    This kind of switch works as follows: pressing the button creates a connection between two of its pins. But our pushbutton has four pins. We need only two and we need to know which two before we solder.
    Learn more about PushButtons And switchs here


    7.b Multimeters

    Keys 002

    Time to use a multimeter! This handy tool is used to perform diverse measurements in electronics. Here we use it in its simplest function: the beeper.
    Rotate the dial until it points to the sound icon. This beeper setting allows us to check if the two multi-meter probes are connected by a conductive material. Touch the two probes to each other – if everything is set as it should you will hear a beep.


    7.c Beep!

    Keys 003

    You need to discover which is the right pair of pins. Touch the multi-meter probes to different pin pairs: if you hear a ‘beep’ while you press the button, and no beep when you depress it, you have found the right pair.


    8.a Solder the first button

    Keys 004

    Take a button and find a pair of pins. Solder an orange wire from the keyboard circuit to one of the pair’s pins (it doesn’t matter to which pin).
    Now solder the blue wire from the keyboard circuit to the second pin. The button should look like the one in the picture.


    8.b Add another blue wire

    Keys 005

    Cut another length of blue wire and connect it to the same pin to which the first blue wire is connected. You now have two wires coming out of the same pin. Amazing!


    8.c Solder the other buttons

    Flip Side


    The diagram below represents in visual language the electronic circuit of this project. It represents the layout you are creating.
    Now do the remaining soldering to complete this layout. Solder the other three orange wires to the other three buttons, each wire to one pin in a pair, which is the same pair as the one you found before, respectively. Then use blue wires to connect the other pins of all buttons to each other. To clarify the picture on the right, go back and check out the project schematics at the beginning of this page.
    Done! You are now ready to test your buttons. Plug the USB connector to your computer and open the text editor or software you used to test character input. Press each of the buttons: you should get a different character for each.
    Does it work?
    You are now ready to add sounds to your buttons…


    Sound pad Diagram

    GO TO TASK 3: SET UP AND EXPORT THE WIRING CODE TO THE MICROCONTROLLER