This touchpad project is a companion to my other Hackster project, titled "Laptop Keyboard Conversion to USB." The Teensy microcontroller is at the heart of these projects and it will help you repurpose your old broken laptop. I will focus on PS/2 touchpads but USB, Serial, ADB (Apple), I2C, or TTL are also used in laptops.
The challenge for making a PS/2 touchpad work is determining the connections for ground, power, clock, and data. Synaptics touchpads often have round test points that are perfect for attaching wires. The typical test point numbers for a Synaptics PS/2 touchpad are:
- Clock = T10. If T10 is not present (or doesn't work), use T12
- Data = T11. If T11 is not present (or doesn't work), use T13 or T9
- Ground = T23 or solder to the Ground Plane
- Power = T22. This test point provides an RC power filter. You can skip the power filter at T20 which feeds the power pins of the Synaptics chip .
This shows a touchpad with numbered test points.
If your Synaptics touchpad has numbered test points but T9 thru T13 are not found, the touchpad may use USB or some other protocol.
Elan touchpads use a different test point numbering system as follows:
Clock = T7
Data = T8
Ground = TG0
Power = TV0
If your touchpad has no numbered test points, use all your Google skills to search for any information about your touchpad or the laptop's schematic. If you can't find any information or you are not sure it's accurate, use the following methods to determine the touchpad connections.Ground:
The picture below shows a typical touchpad. All signals are routed on the top layer and they use any leftover copper to make mini ground islands. The ground islands are all tied together to make a ground plane using resistors labeled 000. These zero ohm resistors are more cost effective to assemble than soldering jumper wires. Use your ohm meter to find the ground pin on the main connector that is tied to the ground plane.
Newer touchpads are powered with 3.3 volts but 5 volts is more common for older laptops. The power from the main connector always goes to a wide trace that connects to a low value resistor. You can see the wide power trace in the previous 2 pictures and the picture below. The other side of the resistor goes to the main touchpad chip and to a capacitor. The resistor and capacitor make an RC filter to clean up the power for the main chip. Use your ohm meter to determine the power pin on the main connector that is tied to the RC filter.
The touchpad shown above only has power, ground, clock, and data pins on the main connector. To find which is clock and which is data, use the trial and error method described below. If there are too many possible signal pins on the connector to use the trial and error method, use the following procedure to weed out the obvious pins that can't be clock or data:
Only look at connector pins that go directly to the main touchpad chip. You are looking for 2 pins with very similar characteristics that behave like logic inputs. Measure and record the resistance for each pin to power and to ground. Next set your ohm meter to diode mode and connect the positive lead from your meter to ground. Use the negative lead to probe each of the possible clock and data pins in order to forward bias the ESD protection diodes. These pins (and any other logic signal pins) will read approximately 0.7 volts when an ESD diode is found. Sometimes the left/right buttons are wired to the connector directly. Switch your meter back to resistance and push the left and right touchpad buttons to see if the resistance changes so you can eliminate this pin. Put 3.3 volts across the touchpad power and ground pins (or 5 volts if you're certain this touchpad is a 5 volt device). Measure and record the voltage on each of the possible pins with a 10K pull down resistor to ground followed by the same resistor pulled up to power. This will show if the signal is being driven by the main touchpad chip and can be eliminated. Remove the resistors and push the left and right touchpad buttons to see if the pin voltage changes. Analyze the results of the resistance and voltage measurements to find the signals that act like logic inputs:
- Eliminate any pin that measures 2KΩ or less to power or to ground.
- Eliminate any pin that has a significant change in resistance or voltage when a button is pushed.
- Eliminate any pin that measures close to power when connected to a 10K pull down resistor.
- Eliminate any pin that measures close to ground when connected to a 10K pull up resistor.
- Group pins together that have similar measurements in order to test with the Teensy.
Hopefully you have reduced the number of possible clock and data signals and can use the trial and error method to find the correct 2 pin combination.Trial and Error Method:
Add a couple 10K pull up resistors to the two Teensy I/O pins that you will connect to the prospective clock and data pins on the touchpad connector. Once you get the touchpad working, try removing the resistors. You may find you don't need them because there are active pull ups in the chip. If you don't know the touchpad supply voltage, try 3.3 volts first. The Teensy 3.2 has 5 volt tolerant I/O and will work with 5 volt or 3.3 volt touchpads. A Teensy LC can also be used but it is not 5 volt tolerant and will need a level translator like the Adafruit 757 when connected to a 5 volt touchpad. My latest circuit board includes pads to add FETs and resistors to make level translators for the clock and data. Connect two of the Teensy I/O pins to the suspected clock and data connector pins. Download the touchpad code below into the Arduino IDE and edit the clock and data pins to match the I/O numbers wired to the touchpad. 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.
My Arduino code bit-bangs two of the Teensy I/O pins to create a PS/2 clock and data bus per the Synaptics touchpad interface protocol given in document 511-000275-01. At power up, the code will try to initiate a self test and then read the result from the touchpad. If the bus is connected correctly, the touchpad will respond with "test passed" and the code will turn off the LED on the Teensy. Every 30msec, the touchpad will be polled for any movement or button pushes and the results will be translated by the Teensy to USB mouse commands that should move your cursor around.
If the clock and data are not correct, the Teensy LED will be turned on. Confirm no operation by swiping your finger across the touchpad. Swap the clock and data pins in the Teensy code, recompile and cycle power. If that doesn't work, move the jumpers to the next possible connector pins. Keep trying until every pin combination has been tested. If no success, increase the touchpad supply voltage to 5 volts and try all possible pin combinations again.Stream Mode vs Remote Mode:
The "Touchpad_3p2.ino" code commands the touchpad to be in remote mode so that it only responds with movement data when polled. This method fits in easily with a Teensy that is also scanning the keyboard matrix at a regular rate. The "Touchpad_Stream_mode.ino" code commands the touchpad to be in stream mode which allows it to send movement data whenever it wants. This code is constantly looping, looking for touchpad data. If the Teensy is also scanning the keyboard, this code would need to be modified to execute when PS/2 bus activity causes an interrupt.Connector Board:
Many touchpads interface to the motherboard with a small FPC cable so I created two simple connector boards shown below that can breakout the signals so you don't have to solder wires directly to the touchpad. One board will take a 0.5mm pitch FPC connector with up to 10 pins and the other will take a 1.0mm pitch FPC connector with up to 8 pins. The Eagle board files can be sent to OSH Park for fabrication. It only costs $3 to get 3 boards fabricated.
Some touchpads have a cloth ground mesh that connects the backside ground to the palmrest (see below). If you do not reattach this ground mesh, the touchpad could give erratic cursor movement. To test a bare touchpad like this, you may need to press on the mesh with your finger.
If you have successfully converted your old laptop's touchpad and keyboard to USB, you could add a Raspberry Pi in the case along with a video converter card. I did this to make a Pi KVM for the server room.