Usb Keyboard With Touchpad For Mac __LINK__
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 or QMK software is the most popular controller code. The TMK/QMK 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/QMK 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.
Usb Keyboard With Touchpad For Mac
Download File: https://www.google.com/url?q=https%3A%2F%2Furluso.com%2F2tO5St&sa=D&sntz=1&usg=AOvVaw1B9byS4lTlQptM8QECgFiv
A few of the keyboards at Re-PC had 28 to 34 traces and some had a 0.8mm or 0.5mm pitch. There were also keyboards with dual FPC cables. I have included support for all of these variations. Connectors for keyboard cables are readily available from companies like Aliexpress, Mouser, or Digikey. The number of signal traces, the pitch, and whether the contacts are on the top or bottom 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 but a few examples will be given.
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.
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.
If your keyboard uses FPC pin 34, you must disconnect the LED near I/O 13 on the Teensy 3.2 or 4.0 in order to avoid interfering with the keyboard scan. I find it easier to unsolder the current limit resistor right next to the LED instead of unsoldering the LED itself.
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.
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. These files are accepted by some board fabricators such as OSH Park in North America and Eurocircuits in Europe. Three boards from OSH Park will cost $18 to $30 depending on the size. Also at my repo are the zipped Gerber files that I translated from the Eagle files. Gerber is accepted by all board houses such as JLCPCB in China. They will produce 5 boards for about $10 with economy shipping to the U.S. They use a HASL (aka HAL) surface finish which is not as good as the ENIG finish used by OSH Park. I have had no trouble with the JLCPCB HASL finish. The different PCB surface finishes are explained by Optimum Design Associates and Eurocircuits.
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 Eagle file "Teensy3p2CutoutFlip.brd" rotates the Teensy 3.2 180 degrees so it can fit in a cutout on the right side instead of the left (see picture above). Use this board if the USB connection is on the right side of the laptop base. The left cutout and right cutout boards route the I/O signals the same as the Keyboard_Scanner_LT2 connector board and will use the same Teensy 3.2 software. If you would rather use a Teensy 4.0, it will also fit in the board cutout. If you wire the backside I/O numbers 24 thru 33 per the silkscreen labeling, you can use the Teensy 3.2 matrix decoder software to get the correct translation. The Teensy LC can also be used in this manner with jumpers for I/O numbers 24 thru 26.
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.
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. Another reason to reduce the max_pin value is because some of the FPC traces may be visibly tied together as shown in the picture above. The original motherboard controller used these shorted pins to identify the language of the keyboard but the Teensy code will report the short and then hang.
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. 350c69d7ab