Introduction: Arduino Controlled USB Trackpad
Every time a new raspberry pi comes out I take a look at the specs and think to myself "I really want to make a laptop out of that" but one issue always arises and that is that I can never find a stand alone USB trackpad for the laptop. So in this project, we will be salvaging a trackpad from an old broken laptop and converting it to USB device using an Arduino pro micro.
Step 1: Parts
The parts needed for this project are really simple, we will need a trackpad from an old laptop, an Arduino micro and some wire. Unfortunately, there are only a few flavors of Arduino that we can use, these are the Arduino micro, pro micro and Leonardo as these can be programmed to show up as HIDs (human interface devices) meaning they can show up on the computer as a mouse or keyboard. This is something the Arduino Uno can't do.
You can get the Arduino pro micro here: Here
As for the trackpad if you would rather buy one it can be found here: Here
Step 2: Why Does This Work
So the reason we can interface a trackpad with an Arduino is because most older laptops trackpads communicated with the computer through a PS/2 interface meaning the trackpad circuit has PS/2 outputs which are data and clock, this data is then read by the Arduino and converted into data that can be sent to the computer through the USB interface. Now I have to note that not all laptop trackpads are the same, pretty much all of the older laptops use a PS/2 interface but some newer ones use USB interface instead of the PS/2 interface. If you manage to find one of these USB trackpads instead of the PS/2 one you could just google the name of the trackpad and find the USB pinout and plug it into a USB computer and it will work. However, for this project we will be using the more common PS/2 trackpad and using an Arduino to make it into a USB mouse.
Step 3: Wiring
The wiring for this project is pretty easy all we need to do is find 4 solder pads on our trackpad. These are pretty easy to find as they are labeled T10 (data), T11 (clock) and T20 and the ground connection is just a large exposed metal plane. We need to carefully solder a wire to each of these pads and then connect them to their corresponding Arduino pins.
- T10 connects to pin 10 on the Arduino micro
- T11 connects to pin 9 on the Arduino micro
- T20 connects to 5v on the Arduino micro
- The ground plane connects to ground on the Arduino micro
After you have soldered wires to the pads on the trackpad it's crucial that you don't put any pressure on these pads, even the slightest pressure on the pads can completely pull them off and make your trackpad useless. Its best to cover your connection with hot glue after you've soldered it.
Step 4: Installing Some Libraries
For this project we will need to install two libraries into the Arduino IDE, these libraries are:
Download them, open your Arduino IDE's library file and drop them in. The PS/2 library is used to get the data from the trackpad and the Mouse library allows us to take that data and turn it into mouse commands that the computer can read through the USB port.
Step 5: The Code
Now that we have the libraries installed we can upload our code to the Arduino, the code can be found below however I must note that the code will not upload or compile unless the board selected under tools is the Arduino micro or Leonardo so keep that in mind if you get an error while compiling the code. Once the code is uploaded the Arduino should reboot as a HID device and show up on the computer as a mouse.
Step 6: Finish and Troubleshooting
So now when you touch the touchpad you should get some movement on your screen and since the Arduino is acting as a USB device you can plug it into any computer and it will instantly boot up as a USB mouse regardless of the operating system or computer type. Now if you don't want to go through the process of programming and wiring the Arduino you could just buy a PS/2 to USB converter, but I wouldn't recommend this as I've read that this messes with the data coming from the trackpad and can make it unusable plus by using an Arduino we can completely customise everything about the mouse to our preference like the speed of the mouse and what actions like double tapping and scrolling does, information on how you can completely customise yours can be found on the Arduino mouse page Here.
If your trackpad isn't sending data back it may be an easy fix, take a look at the back of trackpad and try to locate a part number you can then google this part number with the word pinout and it should show you where the data, clock and 5-volt pins are.
Thanks so much for reading as always if you have any questions please leave them in the comments and I'll try my best to get back to you.