How to Make a USB Laptop Keyboard Controller




Introduction: How to Make a USB Laptop Keyboard Controller

This Instructable will provide a step by step procedure for building a USB laptop keyboard and touchpad controller. I created this guide and video to hopefully make it easier for people to re-purpose an old laptop. A typical laptop keyboard relies on the motherboard for the keyboard scanning and touchpad interface. I use a Teensy microcontroller mounted on a connector board to take over this function. Teensies are often used by the mechanical keyboard enthusiasts at Geekhack and Deskthority and the TMK software is the most popular controller code. The TMK code is a bit of an overkill if you just want a simple USB keyboard but it will certainly provide all the features you could ever need. If you would rather write your own keyboard software using Arduino, the Teensyduino functions give you total USB control. Whatever software you decide to use, it will require a key matrix that maps out how your keyboard is wired. One approach, (that I never want to do again) is to exhaustively check every connector pin combination with an ohm meter while holding down each key. I did this when I converted a Sony Vaio into a Raspberry Pi laptop. An Instructable from alpinedelta disassembles the keyboard in order for the connections to each switch to be visually traced back to the connector. Instead of taking the keyboard apart or using an ohm meter, this Instructable will load the Teensy with an automated continuity tester. The Teensy will report over USB, the two pin numbers that are connected when you press a key. After every key has been pressed, the results can be transferred to a row-column matrix and used by the TMK keyboard controller software or a home-brew Teensyduino routine. The touchpad code described in step 22 can be added to the keyboard routine to create a composite USB device.

I will include download buttons for the relevant files in the Instructable but you can also go to my GitHub repository to view and download all files.

Step 1: Keyboard Cable Specifications

Laptop keyboards use a flexible printed circuit (FPC) that connects all the key switches in an array of rows and columns. The two bins of laptop keyboards shown above are from Re-PC, a local recycling store. About 75% of the keyboards have FPC cables that end with exposed metal traces on one side and a plastic backing on the other side. The plastic backing plus the FPC material typically measures about 0.30 mm thick. A typical keyboard without a number pad has 24 or 25 signal traces with a 1 mm pitch. If there is a number pad, then it’s common to have 26 traces with a 1 mm pitch. It can be difficult to measure the pitch between traces so another method is to measure the width of the entire FPC cable and use this formula:

Pitch = Total width / (N + 1) where N is the number of pins

A few of the keyboards at Re-PC had 30 to 34 traces and some had a 0.8mm or 0.5mm pitch. Connectors for 24 to 34 pin keyboard cables are readily available from companies like Aliexpress or Digikey. The number of signal traces and the pitch are the parameters you will need when ordering. There were some old keyboards in the bins with rigid printed circuit board connectors and some other keyboards with specialized connectors soldered to the end of the FPC cable. These keyboards will not be the focus of this Instructable.


I have added support for keyboards with up to 36 pins, 0.5mm pitch contacts, and dual FPC cables. See step 6 for details.

Step 2: Modify Your FPC Cable As Needed

Some FPC cables need to be modified to fit in a generic connector. Locking nubs on the side of the cable are easy to remove with scissors. If the FPC traces don't line up with the connector pins, use an X-ACTO knife to trim along the side of the cable. The Dell Latitude D630 keyboard needed the most modifications. It had a solder-less connector on the end of the FPC cable that was easily removed. Then I pulled off the extra thick plastic backing that was glued on the end of the cable and cut a notch on the side to align the contacts. To bring the thickness back to normal, I glued 2 pieces of paper to the end of the cable.

Step 3: Teensy LC FPC Connector Assembly - Surface Mount or Thru-Hole

I designed a circuit board using Eagle for the Teensy LC that routes its 26 I/O pins to 26 surface mount pads for an FPC connector with a 1mm pitch or a 0.8mm pitch. I created a second circuit board for keyboards that have a 0.5mm pitch. For those that don't want to solder surface mount connectors, I created the board shown on the right for thru-hole FPC connectors. A 24, 25, or 26 pin FPC connector can be soldered to these boards based on your needs. I avoided using the 27th Teensy LC output because it’s connected to an LED and 27 pin FPC connectors are rare.

After soldering the FPC connector to the board, I soldered 4 header posts to the board to support the corners of the Teensy and then I soldered the Teensy to the header posts. The last step was to connect the rest of the Teensy I/O signals to the board with 30 gauge wire. I used wire instead of header posts to make it easy to reroute I/O pins or cut the Teensy off the board. If you buy a Teensy LC with pins, it will not have pins on I/O's 24, 25, and 26 so you'll need to add them.

Step 4: Teensy 3.2 or 4.0 FPC Connector Assembly

I designed the back side of the board for a Teensy 3.2 with 34 I/O signals and an FPC connector with a 1 mm or 0.8 mm pitch. A different 3.2 circuit board is available if you have a 0.5mm pitch.

Whichever side of the board you mount the Teensy on, you must solder the FPC connector on the same side.

*****Update for the Teensy 4.0********

PJRC is now selling the Teensy 4.0 so I created a new circuit board for it that routes 34 I/O signals to pads for an FPC connector with a 1 mm or 0.8 mm pitch (see pictures above).

If your keyboard uses FPC pin 34, you must unsolder the LED near I/O 13 on the Teensy 3.2 or 4.0. If you don't unsolder the LED, it will interfere with the keyboard scan.

Solder the FPC connector to the 3.2/4.0 side of the board and then proceed to the next step.

Step 5: Teensy 3.2 and 4.0 Surface Mount Pads

The Teensy 3.2 and 4.0 use surface mount pads for I/O signals 24 thru 33 so it’s a little more work to solder them to the board. Solder “flying leads” to the surface mount pads on the Teensy 3.2 or 4.0 and then pass each wire thru the corresponding pad on the board for soldering. Finish the assembly by soldering wires to the remaining I/O signals.

For those that dislike flying leads, I redesigned the Teensy 3.2 board and Teensy 4.0 boards so that header pins can be used for the surface mount pads. The pictures above show how to modify a 2 x 7 right angle header. Note that you can still use flying leads with these boards.

For the Teensy 3.2, cut the header down to 2 x 6, then partially pull and cut the two pins on one end so they are straight as shown above. These 2 pins will help align the header. A small perf board with holes can also be used to hold the header in alignment while soldering the surface mount pads. You will need a long soldering iron tip in order to reach the pads.

For the Teensy 4.0, pull out the 4 right angle leads at the ends and replace them with 4 straight pins that will hold the header in the correct position. The remaining right angle header pins are a touch too long so I recommend they be trimmed in order to not overhang the surface mount pads of the Teensy 4.0.

Step 6: Order the Board and Components

You will need header pins, wire, solder, flux, and a USB cable for this project in addition to the board, connector, and Teensy described below:

  • Pick the Teensy that you want to use based on the number of signals on your keyboard cable. The LC is the lowest cost Teensy but is limited to 26 I/O's. The 4.0 is the newest and fastest Teensy. The 3.2 is my favorite because it is 5 volt tolerant. The ++2.0 is the oldest Teensy in this group and it has the most I/O's. The Teensy LC is $15.48, the 3.2 is $23.63, the 4.0 is $23.78 and the ++2.0 is $27.83 from PJRC.
  • The surface mount FPC connectors from AliExpress are about $5 for a lot of 5. An example search on their website would be “laptop keyboard connector 1.0 spacing 24 pin”. Digikey is another source and you can specify whether the connector contacts are on the bottom or top. They also offer right angle or vertical orientation for the cable insertion. Here are examples for 3 different Molex 30 pin 1mm pitch connectors: CONN FPC BOTTOM 30POS 1.00MM R/A, CONN FPC TOP 30POS 1.00MM R/A, and CONN FPC VERT 30POS 1.00MM SMD. You should check the thickness at the end of your FPC cable with a micrometer. A common thickness is 0.30mm but sometimes the thickness is less so measure and order the appropriate connector.

The following paragraphs describe the various circuit boards that you can use for this project. The Eagle circuit board files have a .brd extension and can be downloaded from my repo. The Eagle file can be sent directly to OSH Park and many other board houses for fabrication. Three boards from OSH Park will cost $18 to $30 depending on the size. This includes a USPS mailer for the U.S. postage. I translated the Eagle files to Gerber which is accepted by nearly all board houses. The zipped Gerber files for all boards are available at my repo. JLCPCB in China costs about $10 to produce 5 boards and deliver them to the U.S. They use a HASL surface finish which is cheaper but not as good as the ENIG finish used by OSH Park. I have had no trouble with the HASL finish. The different PCB surface finishes are explained in this Optimum Design Associates post.

  • To use a Teensy LC or 3.2 with a surface mount 1mm or 0.8mm pitch FPC connector, use the Keyboard_Scanner_LT2.brd or zip file. This board has pads for a 2 bit level translator in case you want your Teensy LC to talk to a 5 volt PS/2 touchpad. If you don't want the level translator, leave these pads empty. The Teensy 3.2 is 5 volt tolerant so it doesn't need a translator. The hole spacing for the Teensy 3.2 backside I/O signals are spaced for right angle header pins or you can use flying leads.
  • To use a Teensy 4.0 with a surface mount 1mm or 0.8mm pitch FPC connector, use the Keyboard_Scanner_4p0.brd or zip file. The hole spacing for the Teensy 4.0 backside I/O signals are spaced for right angle header pins or you can use flying leads. The Teensy 4.0 is not 5 volt tolerant so use the 2 bit level translator on the Teensy LC side of the board if you want to control a 5 volt PS/2 touchpad.
  • If your keyboard needs a 0.5mm pitch FPC connector, use the Keyboard_Scanner_LT_0p5.brd or zip file. This board will work with a Teensy LC on one side or a Teensy 3.2 on the other side with flying leads.
  • If you don't want to solder a surface mount FPC connector, I designed a board for a thru hole FPC connector. This board uses a Teensy LC and can take an FPC cable with up to 26 pins on a 1mm pitch. Use Eagle file Keyboard_Scanner_LC_thruhole.brd or the zip file for this board. The connector hole pattern on the board is designed for this AliExpress connector.
  • The Teensy ++2.0 may be easier to purchase in some parts of the world so I designed a board that will connect it to an FPC connector with either a 1mm, 0.8mm, or 0.5mm pitch and up to 36 pins. You must un-solder the LED located on the Teensy ++2.0 so that it does not interfere with the keyboard software. The Eagle board file Keyboard_Scanner_2pp.brd and the gerber zip file are at my repo.

Step 7: Low Profile Connector Board

A Teensy with header pins that is mounted on an FPC connector board may be too tall to fit in a thin laptop case so I designed the board shown above. The Eagle board file, "Teensy3p2Cutout.brd" can be downloaded from my repo. A Teensy 3.2 will fit in the cutout and U shaped header pins on each side will hold the Teensy in place. These pins will tie Teensy I/O numbers 0 thru 23 to the connector board. Teensy I/O numbers 24 thru 33 are on backside SMD pads and must be connected with jumper wires. I used U shaped header pins from Ali Express that have a width of 6mm (even though their documentation shows a 5mm width). The board will work with 1mm, 0.8mm, or 0.5mm pitch FPC connectors with up to 34 pins. The I/O signals are routed exactly the same as the Keyboard_Scanner_LT2 connector board and will use the same software.

Step 8: Load the Continuity Tester Into the Teensy

  • Follow the PJRC link for installing Arduino and Teensyduino on your computer.
  • Download the Matrix_Decoder Arduino code. Use file Matrix_Decoder_LC.ino for a Teensy LC, Matrix_Decoder_3p2.ino for a Teensy 3.2, Matrix_Decoder_4p0.ino for a Teensy 4.0 or Matrix_Decoder_2pp.ino for a Teensy ++2.0.
  • Load the Matrix_Decoder code into the Arduino integrated development environment (IDE).
  • Connect a USB cable from the Teensy to the computer. Your computer should automatically load the necessary USB drivers.
  • In the Arduino IDE, under “tools”, select board: Teensy LC, 3.2, 4.0, or ++2.0 depending on what you’re using. Also under “tools”, select USB type: Keyboard. If you forget to do this step, you will get an error message that says "Keyboard was not declared in this scope".
  • Compile and load the Matrix_Decoder code into the Teensy. If it’s your very first time loading the Teensy, you’ll have to push the button on the Teensy to enable the loader.
  • Disconnect the USB cable from the Teensy.
  • If you are using a Teensy ++2.0, you must unsolder the LED on the Teensy so it does not interfere with the scan.

Step 9: Load the Key-List File in the Editor

Open a text editor on your computer. I like to use Notepad++ on Windows or Geany on the Pi because they have column editing.

Original Method:

There are two “key-list” text files you can download, named Keyboard_without_number_pad and Keyboard_with_number_pad. The “key-list” file should have every key that you will push followed by tabs to make the results more readable and easy to copy into a spreadsheet.

New Method:

Marcel Hillesheim has written a Python program that takes much of the manual labor out of my original process. The latest version of his program includes a menu which selects the Teensy LC, 3.2, or 4.0 (but not the Teensy ++2.0). The Python program is at his GitHub repo along with two blank key-list files that use the PJRC key codes. If you're comfortable running Python, download the key list text file (with or without number pad) and the matrixgenerator Python program. It will save you a lot of time.

Modify as needed:

You may need to modify the key list file slightly to match your keyboard’s keys. A non-US keyboard can still use this routine, just make a list of your keys and the Teensy will report pin connections. The GUI key is either the "windows key" from a PC or the "clover key" from a Mac. Place the cursor to the right of the very first key in the list as shown above. This will determine where the Teensy begins to display the pin numbers as you push each key.

French computers require the shift key to be pushed in order to display the numbers 0 thru 9. I have made French matrix decoder code for the Teensy LC, 3.2, and 4.0 that takes care of the shift key so that numbers are displayed instead of @ " ' ( - _ etc. You can find this code at my Github repo.

Step 10: Connect the FPC Cable

Inspect your FPC connector to determine the correct orientation for the cable.

If your FPC connector has contacts on the bottom like the picture on the left, use your finger nail to gently lift the connector locking bar to the open position. Slide the FPC cable into the connector with the bare metal contacts pointed down (closest to the board) and the plastic backing strip pointed up. Lock the cable to the connector by gently pushing the bar down. The locking bar mashes the bare metal of the FPC cable down against pins on the bottom of the connector.

If your FPC connector has contacts on the top like the picture on the right, use your finger nail to slide the locking bar to the right. Insert the cable into the connector with the bare metal contacts pointed up and the plastic backing strip pointed down. The orientation is opposite from the first picture because when the locking bar is slid to the left, it pushes the cable up against pins on the top of the connector.

Connect a USB cable from the Teensy to the computer and wait 20 seconds for the Teensy to be recognized as a USB keyboard. This delay is in the code to make sure your computer is ready to receive numbers from the Teensy. If numbers are reported on the screen before any keys are pressed, these pins are shorted together and must be fixed. It may be a solder short on the connector which you can check by retrying without the keyboard connected. If it is still shorted without the keyboard, use flux and solder wick on the shorted connector pads. If the short goes away when the keyboard is removed, these pins are most likely ground pins that are tied together in the keyboard and must be excluded from the routine. Adjust the max_pin or min_pin values in the code to allow the routine to skip over these pins.

If your keyboard has shorted pins that are in the middle, adjusting max_pin or min_pin will not fix the problem. In that case load the Matrix_Decoder_LC_alternate, Matrix_Decoder_3p2_alternate, or Matrix_Decoder_4p0_alternate routine. These routines allow you to exclude any pins necessary to avoid shorts.

If you are using a Teensy ++2.0 and you get the numbers 1 and 15 reported on your screen, you forgot to unsolder the LED located on the Teensy. The Teensy 3.2 and 4.0 will report 1 and 34 as shorted if you are scanning a 34 pin keyboard cable and the LED has not been removed from the Teensy.

If certain keyboard keys do not give a response when pressed, it is usually caused by a bad solder connection, tarnished cable, or misaligned contacts. To prove the code will report all possible pin connections, use a small flat screwdriver to momentarily short pads 1 and 2 at the FPC connector, right on top of your solder joint. Move on to pads 2 and 3, 3 and 4....., proceeding up to the last two pads, taking note of any pad numbers that don't work. For the pads that don't give a response, reheat the solder joint on the FPC connector pad and if necessary, at the header pin on the Teensy. For the Teensy LC, don't forget to add header pins on I/O's 24, 25, and 26. Use the pin translation table in step 14 to map the FPC pin number to the I/O number on the Teensy. Keep fixing your solder joints until you get a response for every pin when you short them with a screw driver. If some keyboard keys are still not working, there may be a bad connection to the FPC cable. Gently clean the FPC cable with an eraser if the metal traces look tarnished. Use a magnifying glass to inspect inside the FPC connector to see if the contact points are in alignment with the cable traces. You may need to trim the side of the FPC cable to get the proper alignment. If alignment looks good, push down on the FPC connector or lift up on the cable while trying the bad keys to see if you can sometimes make them work. You may need to add a thin piece of paper to the plastic backing on the FPC cable to get a tighter fit. Erratic keys can sometimes be fixed by popping off the key cap and cleaning with isopropyl alcohol. Sometimes the keyboard has a bad key switch that will not give a reliable response, no matter what you do. The only solution is to replace the keyboard.

Step 11: Test the Keyboard

Press each key, one by one on the test keyboard as listed on the editor screen. The Teensy will send two pin numbers over USB that were connected when the key was pressed. The Teensy will then send a down arrow to position the cursor for the next key. If you make a mistake, just use your PC keyboard and mouse to erase the error and re-position the cursor. After pressing every key on the keyboard and confirming that pin numbers were given for all, save the finished file for analysis. At this point you've created a very thorough keyboard tester.

The original key list on the left gives every key and the results are in columns for transfer to a spreadsheet. Marcel's key list on the right uses the PJRC key names to make it easier for his Python program to build the matrix. If a key is listed that is not on your keyboard, use your mouse or arrow keys on your PC to move the cursor to the next key. The Python program jumps over the unused keys so there's no need to edit them out manually. If you want to assign Media keys (a key event associated with the FN-key), push the media key (do not push the FN key). The letters "FN" are between the media keyname and the pin numbers to let the Python program know this belongs in the media matrix.

Step 12: Determine Input and Output Pins

If you are using Marcel's Python program, it will automatically determine the input and output pins. The completed pin list file should be in the same directory as the Python program so the start up menu (shown above) will list it. To load and run his Python 3 program on a Raspberry Pi 4, use the Thonny IDE under the programming tab. The results will list the FPC connector pins that are inputs (columns) and the pins that are outputs (rows) plus it does the translation to the selected Teensy I/O numbers. The key codes are automatically placed into arrays for easy cut and paste into a USB keyboard routine (see matrix examples above).

If you still want to use the manual procedure to generate the key matrix, the following instructions will determine the keyboard pins based around the Modifier keys; Control, Alt, Shift, GUI, and Fn. As a general rule, 8 of the keyboard pins will be inputs to the Teensy and the remainder will be outputs. The Modifier keys usually have an output row all to themselves which allows these keys to be held down while other keys are pressed. This avoids a sneak path which would cause ghosting. These “rules” are not always followed (especially by the Fn key) so you may need to do some trial and error as you build the matrix. I have lots of keyboard examples at my Github repo to help you out.

Control-Left and Control-Right will have a common pin between them. Example:

Cntrl-L 19 20

Cntrl-R 20 22

The common pin, Pin 20 in this example, will be a Teensy output, and 19 & 22 will be inputs.

Similarly Alt-Left and Alt-Right will have a common pin between them, just as Shift-Left and Shift-Right will also have a common pin. Example:

Alt-L 7 24

Alt-R 7 15

Shift-L 21 23

Shift-R 23 25

The Alt common pin will be a Teensy output, and 15 & 24 will be inputs.

The Shift common pin will be a Teensy output, and 21 & 25 will be inputs.

The GUI key is usually a single key as in this example;

GUI 9 26

Search all the other pins in the list to see if 9 or 26 are used on other keys. In this example, pin 9 was not used for any other key which means it will be a Teensy output and 26 will be an input. Sometimes both pins are used for other keys but one of the pins is used for common keys like letters and numbers and the other pin is used for less-common keys like page-up. In this case the pin used for common keys will be a Teensy input and the other pin will be an output. Note that the GUI key will still work if you swap the pins.

The Fn key is also a single key as in this example;

Fn 12 18

Using the same approach as the GUI key, search all the other pins to see if 12 or 18 are used on other keys. In this example, pin 12 was not used for any other key therefore it will be an output and 18 will be an input. If both pins are used on other keys, follow the same rules as the GUI example. Sometimes both of the Fn pins are used by common keys which means you can pick either pin as an input and the other as an output.

The eight input pins for the HP DV9000 example keyboard have been identified as; 15, 18, 19, 21, 22, 24, 25, and 26. All other pins will be Teensy outputs. Make a keyboard matrix table like the one shown above with the 8 input pins across the top in ascending order and all the other pins as outputs on the side, also in ascending order.

The orientation of the keyboard matrix is just my personal preference. You can swap the rows/columns and inputs/outputs if you want. Swapping pins may be necessary if you have a rare laptop keyboard that has diodes for each switch. With diodes, you need to make sure the cathode (first pin listed) is designated an output from the Teensy and the anode (second pin listed) is designated an input to the Teensy.

Sometimes only 7 pins can be identified as inputs because two modifier keys share the same input pin (usually the Shift-R and Control-R). If this happens, you’ll have to make an educated guess for the 8th input. I've even seen keyboards that had the same two input pins for the Shift, Alt, and Control keys so after determining the GUI and Fn input pins, only 4 inputs were identified. For some keyboards, the input pins are grouped together (i.e., 17 thru 24) which makes it easy to fill in the missing pins. Other keyboards have no grouping of pins which means you’ll have to begin filling out the matrix with some inputs missing. The remaining input pins will be revealed when some of the keys can’t be placed in the matrix. Keyboards with dual FPC cables have the input pins on one cable and the output pins on the other cable.

Step 13: Fill the Matrix With Keys

To manually fill the matrix, place each key name at the row/column intersection of the pins as shown in the HP DV9000 keyboard example given above. The modifier keys are in bold to make it easy to see that they have a row all to themselves. This keyboard followed the “rules” exactly.

You don't need to fill out the matrix if you're using Marcel's Python 3 program.

Step 14: Translate FPC Pin Numbers to Teensy I/O Numbers

Marcel's Python program automatically translates the FPC pins to the Teensy I/O's. If you are using the manual method, you will need to use the Teensy LC, 3.2, or 4.0 tables shown above. The Teensy ++2.0 uses the manual method. Notice that there is an LED on the Teensy 3.2, 4.0, and ++2.0 that must be removed if you are using that I/O pin.

Step 15: Load a USB Keyboard Routine Into the Teensy

A Deskthority post from "flabbergast" describes using the ChibiOS development environment to configure TMK for ARM based processors like those used on the Teensy. A toolchain such as the GNU ARM Embedded Toolchain is used to compile the Teensy code. You will need to install the ChibiOS development environment per these instructions. The teensy_lc_onekey example details the steps to create a working TMK build. The QMK keyboard routine is based on TMK and it also has ChibiOS support for the Teensy LC and 3.2. There is a Complete Newbs Guide for QMK.

Jay Thompson has created a QMK fork that gives all the information for his Teensy 3.2/Lenovo T420 keyboard project. Jay provides his build environment setup and the make instructions so you have an example to modify for your keyboard.

Gordon has made a Hackaday.IO project called "QMK Powered Laptop Keyboard" which details the "gymnastics" of using QMK.

The TMK/QMK keyboard software is very powerful with tons of features but it can be confusing, (at least to me). As an alternative, I wrote an Arduino USB keyboard routine using the Teensyduino “Micro-Manager” functions. There's just 1 file to load using the Arduino IDE and it's only about 385 lines with lots of comments. I'm a hardware guy so expect ugly code but it provides a basic keyboard controller with 6 key rollover that you can modify to suite your needs. The files named "Instructions for modifying the Teensyduino LC code, Teensyduino 3p2 code, Teensyduino 4p0 code, and Teensyduino pp2p0 code" describe the changes you need to make for your matrix. The instructions also detail how to use the results from Marcel's Python program.

Every keyboard listed below has a folder at my repo containing a Teensyduino USB keyboard routine giving you lots of examples to follow. Use the links to my repo to view and download these files. The 1525, 2100, and DV9000 folders also have Marcel's completed key list file and the results from his Python program. The D630 folders include a Teensy 4.0 keyboard controller routine in addition to a Teensy 3.2 routine. The Sony Vaio PCG-K25 folder includes a Teensy ++2.0 keyboard controller routine in addition to a Teensy LC routine.

IBM380ED - Brian Chan and I teamed up to convert an IBM 380ED keyboard and trackpoint to USB as shown in this video. The code, Eagle files, and project description are in a folder at my repo. This project was documented at Hackaday.IO and Stephen designed a stand alone case for the 380 that you can 3D print with his files at thingverse. Brian has converted his IBM 380ED into a KVM, documented at Hackaday.IO.

Commodore 64 - Olga modified my code for a Commodore 64 keyboard. The Teensy LC code, key list files and project description are in a folder at my repo.

Compaq 286 - Olga also modified my code with an old Compaq 286 keyboard but he did much more. Now the program will take the pin number results from running the keylist text file so you don't need to create a key matrix. The code and PDF description are in a folder at my repo.

Blackberry Q10 & HP Jornada & Atari Porfolio - T Caschy has modified my Teensy code to work with these keyboards. The code is in a folder at my repo.

Lenovo Y480 - Luigi Caradonna has modified my Teensy LC code to work with a Lenovo Y480 with an Italian layout. The code is in a folder at my repo. Luigi also made a stunning marble base for this keyboard. Pictures are in the "I made it" section at the end of this Instructable.

Apple eMate 300 - Billy the Kid has modified my Teensy code to work with an Apple eMate 300 keyboard. The code is in a folder at my repo. Pictures are in the "I made it" section at the end of this Instructable. Check out his very thorough video plus reviews from Cult of Mac and The Register to see how he made a Raspberry Pi laptop from an Apple eMate 300.

Apple Powerbook models 100 and 140 through 180 - Billy the Kid used a Teensy 3.2 to talk to these Apple keyboard and trackball units. Pictures are in the "I made it" section at the end of this Instructable. The trackball uses an Apple Desktop Bus (ADB) interface that is controlled by the Teensy after it scans the keyboard matrix. The Teensy code for the Powerbook 100 and for the Powerbook 140 thru 180 are at my repo.

GriD 1550 - SimonT192 has modified my Teensy LC code to work with a GRiD 1550 keyboard with a UK layout. This laptop has a rotary encoded "IsoPoint" mouse which has been converted to USB using a Teensy LC. The code for the keyboard and mouse are in a folder at my repo along with a PDF describing the operation. Watch Simon's YouTube video for a very detailed description of his "Aliens Sentry Gun" GRiD laptop build. Hackaday featured his project as well.

Thinkpad T43 - Nat has modified my Teensy code to work with a Thinkpad T43 keyboard and he has created a new Teensy 3.2 connector board using KiCad. The code, layout, and PDF description are in a folder at my repo.

Step 16: Non-Standard FPC Cable Connectors

If your keyboard has a non-standard FPC cable like the Thinkpad connectors shown above, the task becomes more challenging. If you can't find a mating connector at Aliexpress or any other site, your only alternative is to remove the connector on the laptop motherboard. A common method is to put flux and low melt solder such as ChipQuik SMD removal alloy on all the joints, then use a hot air rework station and tweezers as shown in this video. You will need to make a board layout that routes the Teensy I/O signals to your keyboard connector. I like to do a preliminary layout on paper first in order to place the parts and route the signals with the fewest via's. It's easy to assign the Teensy I/O pins in software based on whatever pin order makes the layout work best. It's tempting to make the layout next, but do the schematic first so your layout will have air-wires showing you how to route each trace. I didn't make a schematic for the keyboard scanner board because of the confusing front side LC/back side 3.2 routing. The downside of not having a schematic was the lack of any verification that the layout was electrically correct. I had to triple check everything before sending the file out for fab.

Eagle, KiCad, PCBWeb Designer, EasyEDA, and DesignSpark PCB are some of the free layout tools that are available. Sparkfun has excellent tutorials for Eagle schematic and layout. Also look at the Adafruit tutorial on creating parts in Eagle because you'll need to make a package and symbol for your connector. After you get your layout fabricated, you'll need to change the Matrix_Decoder software to work with the new I/O pin-out.

Step 17: Teensy 3.2 Controller for a Lenovo Thinkpad T61 Keyboard

A perfect example of a non-standard FPC cable is the 44 pin connector used on the Lenovo Thinkpad T61 laptop. There are at least three web sites that detail how to make a USB controller for a Lenovo keyboard. An Instructable from rampadc uses a connector board with some glue logic and wires to an Arduino. A later Instructable from rampadc uses a single board with an MSP430 microcontroller. Mark Furland from Tome uses a connector board with wires to an Arduino. Mark's web site states that a Digikey WM6787CT-ND connector will work with the keyboard FPC cable. This saved me from having to unsolder the connector from the motherboard. It was pretty easy to search online and find a schematic for this laptop due to its popularity. Without the schematic or the info from rampadc, I would have been doing a lot of probing with an ohm meter to determine the ground pins and narrow down which pins needed to be scanned for the key matrix. I really like the feel of this keyboard which made it worth the effort to design the Teensy 3.2 circuit board shown above. I modified the Matrix_Decoder scanning software to only scan the 8 input pins and 16 output pins from the matrix. The scanning software produced a connection list that was turned into a key matrix table using the same steps described earlier in this Instructable. The Fn switch has its own two pins on the connector that are scanned separately from the key matrix. The Trackpoint on the keyboard needs PS/2 clock and data signals from the Teensy plus a reset signal when power is applied. The Teensy 3.2 is 5 volt tolerant so it can directly drive these signals. All of the T61 3.2 files are at my repo or can be downloaded with the buttons below. My repo also has a zip'ed gerber file for fabrication at JLCPCP.

Nathaniel has modified my board design for an IBM T43 keyboard which has a larger 40 pin connector. Pictures of his board are at the end of this Instructable in the "I made it" section. All of his design files can be found in a folder at my Github site.

Step 18: Teensy LC Controller for a Lenovo Thinkpad T61 Keyboard

I wanted to build a standalone T61 Keyboard on a block of wood but the 3.2 circuit board from the previous step needed the connector and Teensy re-positioned so the circuit board would be hidden underneath the keyboard. I figured while I'm at it, I should change over to the LC and save some money. The Teensy LC has fewer I/O signals and they are not 5 volt tolerant so I needed to make some design changes. I added a TLV810 to generate a reset for the trackpoint plus a couple BSS138 FETs as level translators for the trackpoint clock and data. To save an I/O pin, I wired the Fn switch into an empty cell in the matrix so it can be scanned with all the other keys. There was one Teensy I/O pin left to drive the Caps Lock LED. All of the T61 LC files can be downloaded from my repo or use the download buttons below. My repo also has a zip'ed gerber file for fabrication at JLCPCP. For an even smaller Teensy LC T61 controller board, check out Martin Refseth's Github repository. He has taken my board design and shrunk it down to be the same size as the Teensy. A picture of his board is at the end of this Instructable in the "I made it" section.

Step 19: Keyboards With Two FPC Cables

If your keyboard has two FPC cables, you may be able to insert them side by side in one FPC connector. If this won't work, there are other options:

I designed the Keyboard_Scanner_Dual board shown above with a Teensy LC on one side for keyboards like the Panasonic Toughbook CF-48 which has 2 separate 1mm pitch FPC cables that are on top of each other (not side by side). The other side of this board is for a Teensy 3.2 with 1mm and 0.8mm pads for FPC connectors placed side by side. This Eagle file can be downloaded below or from my repo. To order the board from JLCPCB, use the gerber zip file at my repo.

If you don't mind soldering a lot of wires, you can use the FPC breakout board shown above for one of the keyboard FPC connectors and put the other keyboard FPC connector and a Teensy on the regular board. The front side of the breakout board will accept an FPC connector with up to 18 pins and either a 1mm or 0.8mm pitch. The back side of the board is for a 0.5mm pitch FPC connector. This approach will allow you to place the breakout board in whatever location is needed by the keyboard cables. The FPC_18pin1mm.brd Eagle board file can be downloaded below or from my repo. It only costs $3.75 to order 3 boards from OSH Park. The gerber zip at my repo can be used to order from JLCPCB.

Your final option is to make a new layout like I did for the Lenovo 380 Keyboard shown above. A complete design description and Eagle board/schematic are at my repo. This could serve as a starting point for a new board layout and you can add other circuitry like a trackpoint interface or backlight connector.

Step 20: Building a Keyboard Base

If you're not going to use the original laptop case to mount your USB keyboard, you can build a custom base like the ones shown above. Luigi Caradonna has made a stunning marble base using the CNC milling machine from his work. If you are lucky enough to have a 3D printer, you can make a custom case like TheGreenMamba's beautiful X61 Thinkpad keyboard. His 3D print files are at thingiverse. tcaschy has made a few 3D printed cases including the one shown above for a Blackberry keyboard with a Raspberry Pi Zero and LCD. Harjoc used acrylic to make a cool see-thru base. The Thinkpad T43 keyboard shown above has been mounted on a wood base by "Than the FIT man". All of these projects are documented further in the "I made it" section at the end of this Instructable. I made a Thinkpad T61 keyboard base using 3 sheets of 1/4" plywood. I've also built wood bases for the Toshiba 2415 keyboards shown above and documented at my repo. Warren has chiseled a wood base for a Dell Inspiron 1420 that is pictured on the PJRC forum with code at his Github repo.

Step 21: Keyboard Backlight

If your keyboard has a backlight, it can be controlled by the Teensy, as long as you have a spare I/O pin left over. The backlight brightness will be controlled using a pulse width modulated (PWM) signal that drives the gate of an N-FET (see schematic above). The N-FET will handle the high current needed by the backlight LED. Only certain Teensy I/O pins are PWM capable so you may need to swap an I/O from the keyboard. Swapping I/O's is easy if you use wires instead of header pins to mount the Teensy to the board. The backlight signals from the keyboard usually come out on a small FPC cable that is separate from the row/column keyboard cable. You can glue a small connector on a blank board and solder wires to it but the fine pitch makes it difficult. I have designed two small connector breakout boards that make it easier to hook up the backlight cable. The Eagle board files can be downloaded below or from my repo and cost less than $3 to fabricate at OSH Park. One board will take an FPC connector with up to 10 pins and a 0.5mm pitch like this Molex connector. The other board will take an FPC connector with up to 8 pins and a 1mm pitch like this Molex connector. On the backside of each board are pads for a 1206 style current limit resistor and an MMBF170 N-FET. I’ve used a ½ watt, 22 ohm resistor but you should experiment to find a value that gives good brightness without excessive current. Set your ohm meter to diode mode so you can determine which pins are the anode and cathode. There are usually multiple pins for each in order to handle the current. Wire the anode pins to 5 volts and the cathode pins to the pad labeled “Drain” (which goes thru the 1206 resistor). The N-FET source is tied to the pad labeled “Ground” and should be jumpered to Teensy Ground. The pad labeled “Gate” should be jumpered to the Teensy I/O pin that will drive the PWM signal. Your code will need to set the PWM frequency. Don’t make it too low or it will flicker. To set the PWM on pin 23 to 400Hz, use the following:


The PWM duty cycle can range from 0 (fully off), to 255 (fully on). To set the PWM on pin 23 to 80%, use the following:

analogWrite(23,205); // 205/255 = 80%

Use a variable for the PWM duty cycle so it can be modified with an Fn-Function key press.

Step 22: Touchpad and Trackpoint

The touchpad or trackpoint PS/2 signals can be converted to USB with an off-the-shelf converter as shown in numerous videos. If you also want to convert a laptop keyboard to USB, then it makes sense to combine these tasks with a Teensy and only use 1 USB port. PJRC has created mouse functions in Teensyduino so the USB coding is easy. I wrote code for the Teensy that bit-bangs two I/O pins to make the clock and data for the touchpad PS/2 bus. You can download my touchpad code below or from my repo. In the Arduino IDE, under "Tools", set the code to the Teensy model you are using and to "Keyboard+Mouse+Joystick". Compile and load the code into the Teensy. The code sets the touchpad up to be polled at a regular rate to see if any movement or button presses have occurred. This makes it easy to merge in with the keyboard scanning code, which also repeats at a regular rate. The Thinkpad T61 shown earlier uses this method to merge the keyboard and PS/2 trackpoint code. The Dell Latitude D630 keyboard code below or at my repo has also been merged with the touchpad code. It can be difficult to figure out the touchpad's clock, data, power, and ground pins if you don't have a schematic so I wrote a step by step procedure to identify the pins. This guide also describes how to use a level translator for the clock and data signals when using a Teensy LC or 4.0. These Teensy microcontrollers are not 5 volt tolerant like the Teensy 3.2 and require a voltage translation to control a 5 volt touchpad. You can use a translator like the Adafruit 757 or build your own by soldering BSS138 FETs and 10K resistors on the surface mount pads I put on the Teensy LC side of the keyboard scanner board. For a quick and dirty cable solution, the clock, data, power, and ground wires from the Teensy can be soldered directly to pads on the touchpad. If the touchpad has an FPC connector and cable, you can use one of the breakout boards from the previous step to provide access to the 4 signals that go to the Teensy. An example of a breakout board for a Toshiba 2415 touchpad is shown above. The composite keyboard and touchpad code for the Toshiba 2415 is at my repo.

For you "real" coders, the interrupt driven trackpoint routine at Martin Prochnow's Github repo is more efficient than polling. Martin's interrupt trackpoint code has been merged with the keyboard scanner for a Thinkpad T420. Check it out at Ben's Github repo. Ben's repo also has Altium circuit board files for the T420 which has a few more keys and more connections than the T61.

A trackball, touchpad, or mouse that uses the Apple Data Bus can be converted to USB using the Teensy code at my repo. This code was merged with the keyboard scanning circuitry for a Mackintosh Powerbook 140 shown in the "I made it" section at the end of this Instructable.

I2C touchpads are becoming more popular in modern laptops. This 2 wire clock and data bus can be directly driven by the I2C pins of a Teensy so no bit-banging is needed. My Hackster.IO touchpad tutorial describes how to determine the touchpad's I2C address and registers. Example I2C code can be downloaded from my repo and merged into a keyboard scanning routine.

Before touchpads, trackpoints, and trackballs became popular, the GRiD 1550 laptop of the 1980's used a shaft below the space bar called an IsoPoint. The shaft can be spun clockwise or counterclockwise for the Y cursor movement. This spinning rod is rotary incremental encoded with 2 signals (A and B). The shaft will also slide left or right for the X cursor movement which also has two rotary incremental encoded signals. The Teensy code at my repo translates these 4 signals into USB. A complete description of this project is at my repo.

If your trackpoint/pointing stick does not output a serial bus, it may only provide the 4 signals from its strain gauge resistors. The Dell D630 pointing stick has four 4K ohm strain gauge resistors that change resistance enough that the ADC in the Teensy can see the voltage changes above the noise. The Dell D630 pointing stick code and PDF are at my repo. Old Thinkpad trackpoints like the one on the 380 can also be converted to USB but its strain gauge resistors need to be amplified as documented in my Hackaday.IO project.

Step 23: Conclusion

The next step after getting the original keyboard and touchpad working is to add a video converter card to drive the LCD and make a keyboard, video, mouse (KVM). A KVM is often used to troubleshoot servers and the one shown above is from a Dell D630 laptop. I also added a Raspberry Pi inside the case to make a stand alone laptop. This build is described in my KVM Instructable. The Toshiba 2415 laptop shown above was converted into a KVM in order to display the HDMI video from a desktop PC as well as send the keyboard & touchpad data over USB. The documentation and code for this build is at my repo.

If you really want a challenge, check out my Instructable to make a "Battery Powered Raspberry Pi in a Repurposed Laptop". In addition to describing the Lithium battery charger shown above, there is Pi software to read the battery status registers over an SMBus and display a fuel gauge.

I hope you find this Instructable useful for re-purposing your old laptop. Leave a comment below if you have any questions, comments, or corrections.

Good Luck

Frank Adams

First Time Author

Participated in the
First Time Author

26 People Made This Project!


  • Lamps and Lighting Contest

    Lamps and Lighting Contest
  • Micro:bit Contest

    Micro:bit Contest
  • 3D Printed Student Design Challenge

    3D Printed Student Design Challenge



Question 23 days ago

Hi this might be a stupid question, but why did you use teensy instead of buying the microcontroller(saw some atmega stuff for a lot cheaper in other guides) on its own and other components? Teensy seems to cost quite some bit(bc of shipping too lmao). Also I cant believe you still reply after 3 years, what a helpful guy.


Answer 23 days ago

I chose the Teensy because I had past experience with them. You can certainly use other less expensive controllers if you want.


Reply 22 days ago

I see, thank you for replying!


Question 24 days ago on Step 23

Hi Frank, hello from Australia,

Thank you for the guide, I am going to try and drive a keyboard and touch pad through the Teensy 4.0.

I'm going to be building a desktop PC inside an old military laptop (20 year old solid magnesium brick) and wanted the laptop components; screen, speakers, touchpad, mouse buttons and keyboard to work as if it is a laptop.

I have read the guide and placed an order with JLCPCB for the revision of the board with the contacts for the 2 bit level translator. I was wondering if there was a particular model you had in mind with the pad spacings on the PCB, I found a Texas Instruments TXB0102 might work but the pin spacing is a little different.

I'm a mechanical engineer so electronics for me is more of a hobby. Ordering a PCB to be made was a first for me, so thank you for creating the board, makes me think I should have been doing that in the past instead of etching PCBs when I've wanted to make boards myself. What software did you use to design the board?

The laptop I am modifying is an OPENTEC Openfire Warrior I've attached some images of the Laptop, Keyboard, the keyboards FPC ribbon cable (24pin 1mm pitch). There may be an additional 2 pins on a micro connector separate from the FPC but I'm not 100% sure these are from the keyboard, I'll need to pull it apart again to figure that out.

The touch pad I cannot find much info about, it is a Synaptics LR104622-1. The laptop which I can boot from DSL linux from a CD identifies it as a PS2 input device so I think as long as I can identify the Ground, Clock Data and Power without frying it I should be able to get it to work. Not sure why it has 8 pin outs since the left and right mouse buttons are on the motherboard. I expect given the age though it will operate with 5V.

Thanks again for the guide.



Answer 23 days ago

Hello Ben, that looks like a cool laptop to work on. I assume you ordered the Teensy 4.0 board from JLCPCB called The FPC connector and Teensy will be soldered on the board, then on the other side of the board are some pads for two BSS138 FETs like these
and 4 resistors like these
that make a level translator per the schematic below. You will have to solder wires to it from the Teensy to 5 volts, 3.3 volts, and Teensy I/O's for clock (C3) and data (D3) that are 3.3 volt levels. The other side of the translator will need wires for clock (C5) and data (D5) to the touchpad that are 5 volt levels. The surface mount BSS138 FETs and resistors can be hard to solder so it might be easier to buy the Adafruit 757 level converter
Use my touchpad guide at
to find the clock and data signals on the touchpad. The touchpad 8 pin connector probably has extra signals you won't need. Usually the left and right mouse buttons from the touchpad are included in the PS/2 data packet so you won't need to read them separately.
It's best to get the keyboard working by itself, then the touchpad by itself. Once you've finished debugging all the connections, you can merge the software together.
I used Eagle to design my board. They have a free version and there are guides that show how to make schematics, layouts, and part footprints. See the links at the bottom of step 16.
Let me know how it goes and if you have any more questions.


Question 7 weeks ago

Hi Frank,

Great guide! I have a X220/T420 keyboard lying around that I ultimately want to repurpose into a battery powered bluetooth keyboard which I know shouldn't be too tricky using nRF52 HID libraries; I'm not sure if this approach will be as good as your approach which uses ChibiOS.

I wanted to ask about cross compatibility since your guide discusses the T61, I looked at Hamish's X220 pinout documentation here:

and compared it against your documentation here:

I saw the following discrepancies:

pin x220/T420

34 gnd //is PWR SW RTN on T61
38 VCC5B // TP_5V
23 LEDPWR_CONN //is NC on T61
31 gnd //is KBDID RTN on T61
33 -LED_MUTE //is NC on T61
35 VCC3M //is NC on T61

(sorry the formatting didn't come out very well here).

Could you tell me if the signalling on the X220 keyboard (FRU 45N2100) is compatible with your T61 code / signals? The bits that concern me are GNDs on the x220, which are 'RTNs' on the T61 (hopefully they mean the same thing).

What do you think?



Answer 7 weeks ago

Wow, you're doing some good research. I'm no expert on all the different Lenovo keyboards that use this 40 pin connector but I think the row and column signals are always the same so the basic keyboard scanning signals will work. It looks like the T420 keyboard has some extra features that use the no-connect pins of the T61. Assuming you want the extra features of the T420 keyboard, you should modify the layout to route traces to the signals that you've noted are different. You are correct that Grounds and Returns mean the same thing.


Reply 7 weeks ago

I have both a teensy 3.2 and a 4.0, will the 4.0 provide noticable improvements or do you recommend sticking with the 3.2?


Reply 7 weeks ago

The Teensy 4.0 has a lot more processing capabilities but it's not needed for simple keyboard and trackpoint control. I prefer using the Teensy 3.2 because it is 5 volt tolerant so I never have to add level translators.


Reply 4 weeks ago

I've soldered my slightly modified board and hooked it up to the T420, strangely, when I hit a key after flashing your KBandTP firmware, it only outputs the (correct) key after a few presses and always issues the key press about 17 successive times (after a delayed output) . Any Idea? Also the matrix scanner code outputs different pin outputs on the t420 which i used with the python script, adding the generated matrices to the KBandTP code issues wrong key presses everywhere which i found really strange; i.e. why are my matrix output pins not the same as yours, yet your default code issues the correct key presses ? (but too many times). Please let me know if you have any ideas, the matrix scanner does output a unique tuple for each keypress without delay or duplicate presses. It's worth mentionoing, i can't get the trackpad to work, and the heartbeat is slow in the order of around 25 seconds per pulse.

I seem to be getting 'trackpoint_error' set high after attempting to send reset the trackpoint (error set high when verifying ack byte)

EDIT: Commenting out the 'trackpoint routine' and 'trackpoint_init_ removed the key press error along with the heartbeat issue, keyboard now works fine. Trying to figure out the trackpoint is tricky since i barely understand what's going on in the code, so many magic numbers

EDIT 2: I was being an idiot and using a decoder from the python script repo which used the wrong FPC IO numbers.. now that problem is solved, last thing is that damn PS/2 code. I even got out my oscilloscope but was unable to figure out what's going on - it seems there is nothing happening that associates with trackpoint user input.


Reply 4 weeks ago

Glad you got the keyboard working by itself. As you found out, if the trackpoint is unresponsive, it eventually times out which makes the keyboard act slow and glitchy. To debug the trackpoint, I suggest you load the trackpoint only code from my Github repo and modify the I/O pins that you used.
I'm assuming you used a Teensy 3.2 that is 5 volt tolerant. With your scope, check for 5 volts at the touchpad and that the reset signal goes to 3.3 volts for a second on power up, then remains low forever. The scope should show the clock sitting low and the data sitting at 3.3 volts, then every 24msec is a burst of activity as shown in the attached scope picture. If both signals are never high, check your pull up resistors. If your data trace doesn't look the same, it's probably not being driven low by the trackpoint (because it never received a command). Your problem is most likely that the trackpoint power, ground, and reset/clock/data signals are on different pins. The second picture shows where all the signals go inside the T61 trackpoint. You may have to take it apart and use your ohm meter to figure out where they go on the T420 connector. Let me know what you find out and if you have any more questions. Good Luck!


Reply 4 weeks ago

Thank you for taking the time to respond along with the photos, it's very helpful and kind.

I do use the T32. I checked the reset line which does behave correctly.

I will respond in two parts (matrix decoder and trackpoint).

A ) It seems I can't use marcel's script to output the same matrices as that in the t61 t32 code despite the matrix decoder outputting the same codes as the ones you added in the directory. I.e. I get the same codes as you when I use the matrix decoder (but additionally want to add a few keys in the UK keyboard/the GUI key is different), but the output of marcel's script makes the keyboard behave entirely wrong. I had a feeling it's to do with the variable 'con_pin_v3_2' in the python script since they didn't seem to associate correctly to the FPC pins, however i was unable to add or change that without getting array out of bounds errors. Any ideas? Rather i should ask, are the FPC to teensy IO's different on the t61 board vs the other boards you made (that might work fine with the script). Lastly, were you able to use marcel's script with the t61 board?

B ) I've spent about five full days on this trackpoint and I'm losing my mind :p

I found this link

which uses the exact module that my keyboard uses.

It links to this repo:

this code seemed to work and offers some insight into changing the trackpoint sensitivity (I had some problems running your trackpoint code and decided to try other code before digging)

but the page also points here:

which utilises a much neater codebase in my opinion which I'm now testing with:

I've measured the resistance between the data and clock pins on the module to the associated pins on the t61 board (which i edited by only pulling out the NA pins):

data on module --> data on t61 board = 0 ohms
clk on module --> clk on t61 board = 0 ohms
data on module --> 5v on t61 board = my pull up value
clk on module --> 5v on t61 board = my pull up value
data on module --> 5v on module = > M ohms
clk on module --> 5v on module = > M ohms

this seems to assert that the module and the board are playing nice, which makes sense because..

.. I spent hours eventually wiring a 12 turn pot and eventually finding that I could get the same / correct pulses as in your image of the scope when my two pull ups were between 600r and 800r each. Making both even 1K outputs nothing on the scope and the trackpoint stops working. The caveat is that when the pull ups are in the working range, the trackpoint has around 2 cm per second inertia in one direction.

I *think* this is because there's quite a bit of noise on the bus; I made a video for my PhD friend which shows this well, please excuse the nasal depressed sounding voice:

I tried adding a tantalum capacitor in series to try and remove the noise but it zeroed the entire signal. I also tried adding the tant in parallel to ground but it made no difference.

I got some shots from my scope showing some data too for you, i noticed the clock is idle'y high which is probably a problem.

Please tell me you might know what's going on? I am Padme, you are Ben Kenobi, you're my last hope.

EDIT: I've added three more scope shots after trying your trackpoint software again, all three buttons work but unlike the other code, the trackpoint doesn't move the cursor at all (and the cursor has inertia).


Reply 4 weeks ago

You asked;
"are the FPC to teensy IO's different on the t61 board vs the other boards you made?" The answer is yes the I/O's are wired differently.
You asked;
"were you able to use marcel's script with the t61 board?" The answer is no, I decoded the T61 the manual way.
If you want me to add the additional UK keys into your matrix, send me the results from your key list file plus any other connection info I'll need. My email address is
As for the touchpad, I'll keep looking at your scope pictures but I don't understand why yours is acting so different than mine.
I'll let you know if I come up with something.


Reply 4 weeks ago


Above is my new repo forked from yours, I changed the keyboard and mouse software which now also need the new trackpoint cpp and .h files, i removed the loop delay which breaks the interrupt driven routine (trackpoint functionality is really smooth and fast now), I replaced the way mouse clicks are handled now, all three buttons work great. I removed the blink routine. I like the new TP handler because it sends three chunks of data instead of 5, only when there is data to be sent. I've also added the new altium files with the missing 5V connection fixed. Will email you now. Thank you so much for your help!


Reply 4 weeks ago

It's my own fault for having spent so long on this - i was an idiot and missed the 5V rail on pin 38... your code works great now and the bus looks as it should! no longer need those silly 600r pull ups, i 10k works just fine.

I will email you the new keys i want to add, thank you.

I do recommend having a look at

It is fast and interrupt driven. I might have a go at porting it to your KBandTP ino file.


Reply 7 weeks ago

Thanks for replying! My research is nothing against what you've published, i also watched your pi / dell laptop KVM video, very impressive.

I imported your pcb to altium and made a few changes, also adding breakouts for the four remaining pins that the x220 kb uses.

I wanted to use either my esp32 feather or nrf52 breakout for this project because they both have great wrappers for BLE HID devices, but both would require shift registers to deal with the relatively low pin count. I might modify the design later if I find that i used the kb enough, if i do, i'll be sure to share it with you. If you have any BLE ideas, let me know. Cheers!

Screenshot 2021-07-29 15.40.12.png

Reply 2 months ago

Yes you can use two of these boards with hookup wires to the Teensy. One board would have a 20pin connector and the other would have a 12 pin connector. I see some of the traces on the FPC cable are "dead ends" and don't go to the keyboard so you don't need to wire them to the Teensy. Likewise, I see two adjacent traces that are tied together so you will only need to wire one of them to the Teensy. First guess looks like you will need 22 wires so a Teensy LC would work.
I'm not sure from the picture but it looks like the 20 pin FPC cable has contacts on the top and the 12 pin FPC has contacts on the bottom and both are 1mm pitch (check to be sure). Depending on how you fold the cables when inserted, you will end up with one connector that has top contacts and the other with bottom contacts. Remember to not wire up to Teensy I/O #13 because it has an LED onboard. You can use that LED for Caps Lock indication. If you wire the Teensy I/O's in lowest to highest order, then you will need to modify the translation Python code. If you don't want to deal with that then I suggest you wire the I/O's per the Teensy LC translation table on step 14. Start at one end of the 1st connector and wire each (usable) pin to Teensy I/O's as listed in the table (23,0,21,1,24,2,etc.) Continue wiring to the last pin of the 2nd connector. Doing this will allow you to use the Python code without modification. Let me know if you have any more questions. Good Luck!


3 months ago

Hello Mr Adams

I've just managed to get an Apple eMate 300 Keyboard up and going thanks to your instruct able:) Do I just email you the information? I was a bit bummed at first because I thought you had left me hanging when you started talking about Tmk and Qmk, I spent several hours researching those, THEN I read the rest of your directions, and yep, my keyboard worked on the first try:) I modified your Dell Inspiron 1525 ino. Thank you again, after reading through your directions again, I just realized how really easy and universal it is:)


Reply 3 months ago

Hello Billy67, I'm glad you got your keyboard working. Please send in a picture to the "I made it" link above and send your finished code to my email at I'll upload it to my repo for others to use.
I never have figured out how to use TMK/QMK but the software weenies swear by it so I had to describe it first before showing my crude Arduino code.