Arduino Controlled USB Trackpad

About: Enjoying the projects? Support this page on Patreon:

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.



    • Beauty Tips Contest

      Beauty Tips Contest
    • Sew Tough Challenge

      Sew Tough Challenge
    • Paint Challenge

      Paint Challenge

    17 Discussions


    23 days ago

    Hi Collie147with my arduno pro mikro the exakt wiring and your code its dont work have your a idea why??? thank you


    Question 5 weeks ago on Step 6

    Thank you for the idea. I transformed an unused touchpad to use as a mouse with my android phone via otg cable. The "problem" is that it only registers a left click. In your video you show right click and scroll. Is there any documentation on this? I've searched everywhere I can think of and noone mentions right clicks or two finger detection. Any help would be appreciated. Thanks


    Question 1 year ago

    Thank you for this great instructable!
    I was wondering if I could add a bluetooth interface to the track pad? Could the leonardo handle that as well?

    1 answer

    Answer 6 weeks ago

    me too I am looking for the same, from what I learned so far, the bluetooth module should support HIDs (human interface devices) and also be Bluetooth Low Energy (BLE) for the battery of the project to last.
    Did you find something, can you share what you got please?

    1 year ago

    I used a different library, got it to work much more like a track pad rather that a directional scroller. Exactly the same hardware setup.


    * PSMouse Library -

    * Script adapted by Collie147 from example - added Mouse.h and press/release functions


    #include "PS2Mouse.h"

    #include "Mouse.h"

    PS2Mouse PS2mouse(9,10)

    void setup(){




    void loop(){

    uint8_t stat;

    int x,y;


    Mouse.move(x, -y, 0);

    if (bitRead(stat, 0) == 1){;






    5 replies

    Reply 4 months ago

    The cursor movement is much smoother and faster response.
    Great coding Collie147. Thank You.

    Can you also guide me for MOUSE_RIGHT click. touch twice for right click or two finger touch for right click.

    Also appreciate electronics for everyone (author) for the great concept and working on savaged touchpad.


    Reply 2 months ago

    There seems to be a semi colon missing from the line above it

    PS2Mouse PS2mouse(9,10);

    give that a try.


    Reply 2 months ago

    Hey, sorry to bother but I really need help on this. I have had no other experience with Arduino but my soldering is pretty good. I can’t get this code to run even with both libraries installed and the board manager set up correctly. When using your code i get an error message saying that right after the word “void” the program expects some other symbol. I assume your code is correct based on the positive feedback you have gotten so I’m not sure what’s happening.

    P.S when I put a semicolon after the word void it says everything working and will upload to the board. However the trackpad just won’t work. I’ll be sure to check my wiring, but other than that I can’t do much. So any help would really be appreciated. Thank you for your time, again sorry for bothering you all.


    1 year ago

    Nice, thanks for sharing. Just a note, library links are swapped.


    1 year ago


    my Arduino crashes because of a small error in your code.

    You define the array msval with a length of 2 but you store 3 values in it.

    int msval[3]; // edited

    After that it worked flawlessly. Thank you so much!


    2 years ago


    thanks for sharing.

    could you explain these lines :


    msval[0] = (((mstat2 & 0x10) << 8) | ((mxy & 0x0F) << 8) | mx );
    msval[1] = (((mstat2 & 0x20) << 7) | ((mxy & 0xF0) << 4) | my );
    msval[2] = int(mz);



    if (msval[0] > 0 and msval[2] > 10)
    { repeatCnt++; }
    { repeatCnt = 0; }

    if (repeatCnt > 2)
    msval[0] = map(msval[0], 580, 5164, -1023, 1023);
    msval[1] = map(msval[1], 1120, 5967, 1023, -1023);


    2 years ago

    Great idea! I haven't got arduino yet but is it a good kit?



    3 replies

    The Arduino Starter kit R3. Want a link so you know what i'm talking about?