Saturday, November 28, 2015

Fun with a Track Pad

For some reason or another, I was tearing into a couple of laptops that didn't need reassembling.  Or maybe they weren't worth reassembling.  But either way, I ended up plucking the track pad out of one of them.  I noticed that the module only connected to the rest of the computer via only a few contacts.  At least have to be power and ground, meaning it's likely a serial interface.  After a little bit of research on the Synaptics chip at the heart of things, turns out it's PS/2.

I had always assumed that PS/2 was more or less obsolesced, only continuing to be supported because so much consumer hardware is out there, and for industrial settings.  If I had to guess, a track pad would have been internally tied into USB.  In any case, it's a serial protocol, I can probably talk to it from a microcontroller.
Leads soldered to flex circuit.
PS/2 is a bit odd, almost like I2C in reverse.  I never actually found a definitive resource on the protocol, just gleaned a few things from various websites and from the Synaptics literature.  There is a data and a clock line, which require pull-ups, but the device controls the clock.  The host must create a start condition to get the device to begin clocking, and have the data available on rising edges.  Unfortunately, I couldn't see a way to use the peripherals of a PIC16F916 to emulate the protocol, so I had to bit bang it in software.  The micro didn't have to do much else though, as I just wanted to output MIDI (I know it seems like all I do, but it's just a fast way to make a device talk to other existing devices and accomplish something).
I definitely learned a lot going thru the Synaptics implementation guide.  For instance, the pad has both a relative and absolute mode, as well as a polling mode.  It was much easier to use absolute positioning, and since I was emulating the protocol in software, the polling mode meant I didn't have to constantly keep track of the clock pin.  I would know when to expect data.  I can choose my own update rate and just grab the track pad data as needed.
Synaptics track pad packet format
Once configured, whenever my host requests data, it receives the packet above.  An interesting piece of information is that "Z pressure."  Maybe I can play with that.  You'll see in the video later in this post where I enable Z interaction while holding down one of the buttons.
Communication between the PIC and track pad
As this is merely an anecdotal post, I won't go into much detail.  I wrote up a small bit of code to setup the track pad and talk to my PC over MIDI and experimented a bit.  I just wanted to know I could.  Perhaps I'll come up with a good use for the track pad, but until then, here's some footage of it in action:

No comments:

Post a Comment