Introduction: Reuse Old Laptop's Touchpad to Control a Stepper Motor

I made this project a few months ago. A few days back, I posted a video of the project on r/Arduino on Reddit. Seeing people getting interested in the project, I decided to make this Instructable where I have made some changes to the Arduino code and added a feature. So, without further ado, let's get started!

Step 1: Watch the Video

Watch the video to get an idea what's going on.

Step 2: Get All the Stuff

For this project, you will need:

  • An Arduino microcontroller board
  • A PS/2 touchpad from a laptop(Try to get one with a Synaptics chip onboard)
  • *A ULN2003 stepper motor driver(For unipolar stepper motors(5-wire))
  • *An L298N stepper motor driver(For bipolar stepper motors(4-wire))
  • 6 male to female jumper wires(2 for power and 4 for digital signals)
  • A stepper motor
  • A 5-12 volt DC power source(Depending on the stepper motor)

Here, the setup is powered from a mobile phone charger that supplies 5-volts to the Arduino board and the stepper driver. Even though the stepper motor is rated for 12-volt, you can use a lower voltage supply if the torque requirements of the motor are not high because using a lower voltage supply will keep the motor as well as the driver cooler.

*Both the stepper motor drivers have the same pin connections with the Arduino board.

Step 3: Get the Ps2 and Accel Stepper Libraries

Download the folder of the ps2 library from here. Move the downloaded folder to the desktop as it will be easier to find. Open the Arduino IDE and click Sketch>Include Library>Add .ZIP Library... and then select the ps2 folder from the desktop. The library will be included and you now be able to use the ps2 library.

For the Accel Stepper library, you can get it by pressing Ctrl+Shift+I and then typing in 'Accel Stepper' and installing the library.

Step 4: Figure Out the Connections of the Touchpad

If you have a Synaptics touchpad like the above one, the pad 'T22' is +5V, 'T10' is 'Clock', 'T11' is 'Data' and 'T23' is 'GND'. You can also solder the 'GND' wire to a large exposed copper as shown above.

Click on the above image to know more.

If you have a different touchpad, try searching for its part number on the internet with 'pinouts' or you can ask the r/Arduino community on Reddit if you get stuck.

Step 5: Test the Touchpad

Make sure the correct connections are made to the touchpad. To test the touchpad, upload the ps2 mouse code on the Arduino microcontroller from Examples>ps2. Connect 'Clock' wire to D6, 'Data' wire to D5, GND to GND, and +5V or VCC to +5V pin of the Arduino board respectively. Reconnect the Arduino board to the computer and open the serial monitor. If you see the numbers changing as you move your finger across the touchpad, the touchpad is working properly and you can proceed.

Step 6: Program the Arduino Microcontroller

The first code, 'PS2_toucpad_with_Stepper' has no acceleration/deceleration feature for the stepper motor but has a homing function.

The second code, 'PS2_toucpad_accel_stepper' has no homing function but has an acceleration/deceleration feature.

You can know more information from the respective Arduino codes.

Step 7: Study the Circuit Schematic

Click on the image to get a better view.

Step 8: Make the Wiring Connections

Step 9: Connect the Arduino Board to Power and Turn It On

After powering up the setup, slide your finger along the length of the touchpad and see if the motor moves.

Step 10: Troubleshooting

If you encounter some problems, you can do the following:

If the stepper motor steps back and forth instead of moving in a particular direction:

  • Change the sequence of pin declaration. For example: replace Stepper stepper(200, 8, 10, 9, 11) with Stepper stepper(200, 8, 9, 10, 11).
  • Check all the signal wires connecting the motor driver to the Arduino board as well the wires of the stepper motor are properly connected where they should be and are not loose and faulty.

If the motor does not move at all:

  • Check if the touchpad is working correctly, go back to Step 5.
  • Check if the motor driver and the touchpad are getting power.
  • Check if the motor or the motor driver is faulty.

Step 11: Tinker With It

Now that you have got it running, why not share it with the community. Click on 'I Made It!' and share your creation. Try modifying the code to add more features, run multiple stepper motors and so on.

Also, if possible, try to help those who are stuck, I would be very thankful to you.

All the best!