Kushagra Keshari

MG_2185_.JPG 

A while back, I came across this video on YouTube:

 

 

Then it hit me. Why not use the same thing to control other stuff?!

Since, I didn't have access to any old, broken laptop, I went to a local computer repair shop and got a Synaptics' PS/2 touchpad for about $1.4. I quickly searched the pinout for the part number of the touchpad and soldered wires to the appropriate pads present on the circuit board.

G_2361__.JPG 

I connected it to an Arduino microcontroller and uploaded a test code on the microcontroller including the ps2 library(Which can be found here). After a couple of trial and error, it was up and running.

I proceeded to add a stepper motor and programmed the Arduino microcontroller to make the stepper motor follow the finger being slid on the touchpad and it worked great.

 

 

The touchpad has two axes, 'X' and 'Y' where the finger can be moved. In the above project, the 'X' axis was being used. 

Controlling a Model Railroad 

IMG_2162.JPG 

Controlling the speed and direction of the locomotive was quite easy. The motor shield use in the project can control a DC motor's speed via PWM depending on the number put in the function which ranges from 0 to 255. I programmed the microcontroller with an extra function to accept values ranging from -255 to 255 where the -ve value would make the locomotive go backward and the +ve value would make it go forward. I added a variable (Say 's') for storing that value. Sliding the finger along the 'X'-axis on the touchpad would either add to or subtract some amount from the value stored in the variable, depending on the direction of movement of the finger.

Turnouts

IMG_2160.JPG 

But controlling the turnouts was a bit more challenging. I still had the 'Y' axis free so I mapped one turnout to the 'Y'-axis movement of the finger. But it was not enough.

I further experimented with mapping the two diagonal movements of the finger for two more turnouts and after some testing, changing some numbers and scratching my head, the other two turnouts worked without any problem.

So now we can control three turnouts and a locomotive using a single touchpad. Not bad for a small layout.

Stopping the locomotive

Next, it was time to add a function to stop the locomotive in a simpler way. There was a variable, using which, one could determine whether a finger was slid on the touchpad or tapped on it. Using it, I created a function that would slow down the locomotive moving in either direction and bring it to a halt.

Result

 

 

You can find the complete documentation of this project here. All the best for the project build! 

I hope you enjoyed this project. If you have any doubts, suggestions, or feedback, be sure to let me know in the comments below. 

Reply 0
UglyK5

WOW

Dude... excellent work. Much to think about here!

Jeff

 

—————————————
“Think before you post, try to be positive, and you do not always have to give your opinion.....”
-Bessemer Bob
Reply 0
Kushagra Keshari

Thank you!

Glad to know you liked the project.

Reply 0
gmburzynski

Very impressive, it’s all

Very impressive, it’s all above my head. But still very cool.

GB

Reply 0
ironman63

Great project

Very Nice work! Gave me an idea to set this up on a small layout for kids to play with. Adds tech that they are used to using. I will have to try this and see how it goes over with the Grandkids. Excuse me I have a couple old laptops to tear apart to get a couple touch pads. :D

Later Richard

 

Reply 0
Kushagra Keshari

All the best!

If possible, do share your creation with the community. I would love to see it.

Reply 0
Reply