Touchpad Controlled Digital Servo Motor

by KushagraK7 in Circuits > Arduino

2697 Views, 10 Favorites, 0 Comments

Touchpad Controlled Digital Servo Motor

20210830_091053.jpg

Here is a quick and simple project where we control a digital servo motor with the slide of our finger on a PS/2 touchpad with the help of an Arduino microcontroller. So, without further ado, let's get started!

Supplies

For this project, you will need:

  • A PS/2 touchpad
  • An Arduino microcontroller
  • An H-bridge motor driver(Examples: DRV8833, L293D, L298N, etc)
  • A DC motor with an attached rotary encoder
  • A 5-volt supply(For the Arduino microcontroller)
  • A DC power source for the motor(If it is intended to be operated at voltages >5-volts)
  • A few male to male jumper wires

Program the Microcontroller

Arduino code screenshot.png

You can get all the firmware resources, including the Arduino code and the required libraries from here.

Connect the Microcontroller to the Motor Driver

20210830_091822.jpg
20210830_091746.jpg

Connect the motor driver's +ve input to the 5-volt pin or an external supply if you are using a larger motor. Connect the GND of the motor driver to the GND of the microcontroller(And the GND of the external supply, if used). Make the following connections between the microcontroller and the motor driver:

D9 - IN1

D10 - IN2

A lot of motor drivers have an 'enable' pin(EN) that needs to be connected to the +ve of the logic voltage. If yours has such a pin, connect it to the 5-volt pin of the microcontroller.

Connect the Motor to the Motor Driver and the Microcontroller

20210830_091607.jpg
20210830_091638.jpg

Check the underside of the PCB attached to the motor showing the pin labels of the connector.

Connect the pins M1 and M2 to the output pins marked OUT1 and OUT2 of the motor driver.

Connect the GND pin to the GND of the Arduino microcontroller and the VCC pin to the 5-volt pin of the Arduino microcontroller.

Make the following connections between the encoder and the microcontroller:

C1 -> D2

C2 -> D3

If you wish to change the pins of the microcontroller to be connected to the encoder, make sure that the ones you are using are interrupt pins.

Figure Out the Connections of the Touchpad

IMG_2104.JPG

If you have a Synaptics touchpad like the above one, the pad 'T22' is +5V(VCC), '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'.

Connect the Touchpad to the Microcontroller

20210830_091434.jpg
20210830_091530.jpg

Make the following connections between the touchpad and the microcontroller:

VCC -> 5-V

GND -> GND

Clock -> D6

Data -> D5

Mount the Motor on a Stand

20210830_091230.jpg

Though this step is optional, this can help prevent the motor from moving around while rotating.

Add a Position Marker to the Motor

20210830_091204.jpg

You can use something like a wheel, a gear, a shaft attachment, even a piece of tape to see the movement of the motor.

Power Up the Setup and Test the Controls

Touchpad Controlled Digital Servo Motor

Check if your setup is working in the same way as shown in the video.

Start with sliding the finger slowly for a short distance in any direction. If the motor keeps on rotating for a long time then reverse the polarity of the motor's wires.

Try Adding More to the Project

The microcontroller is using only a single axis of movement of the finger to control the motor. Why not try adding another motor and control both of them together, one with the horizontal and the other with the vertical movement of the finger. You can also try and make a touchpad-controlled vehicle with the help of these motors. Whatever you do, all the best!