Author Topic: PS/2 Touchpad to USB mouse  (Read 325 times)

Noir_CZ

  • Newbie
  • *
  • Posts: 1
PS/2 Touchpad to USB mouse
« on: May 23, 2019, 06:33:41 am »
Hello;

TL;DR: Having problems with communication of old PS/2 touchpad with digispark.

Whole:
I salvaged an old touchpad from broken laptop and becuase of the age it was no brainer that the interface was PS/2. I managed to figure out which pins are which.
I managed to find that someone already did this with arduino.

Link to their project: https://playground.arduino.cc/ComponentLib/Ps2mouse/
Link to the code: https://playground.arduino.cc/uploads/ComponentLib/mouse/index.txt

Their code is barebones, in fact it doesn't even use the few PS/2 libraries for arduino that are around. Or rather if I udnerstood it right it butchers one to make it minimalistic. Poitn is, it work on my Chinese knockoff of arduino nano. It collects the data from the PS/2 touchpad and sends it onto serial monitor. I even stitched together a java program that monitors the serial line and via robot class turns it to mouse movement and button click.
I thought that it would be nicer to have it without the external java program, so I decided to buy digispark. Then again, even if it is... was, since I already bricked it, bought in good old brick'n'mortar shop it may have been a clone, sicne the pin 5 worked as reset.

Anyway, drivers and all that I managed fine, uploading a custom sketch to make the onboard LED blink a SOS signal to verify I can upload codes alright.

I then deleted the Serial communication from the program, since digispark can't do it natively and thought I would replace it with DigiMouse.move() command to make the mouse move.  And of course change the pins from 5 and 6 to 0 and 2, since 5 did reset and 1 is the LED.

Problem is it never worked. Well 5% worked. It always felt like the digispark just stopped communicating with the touchpad after cycle or two. Because when I uploaded the program (about 50% of the memory used) and started moving finger over the touchpad in circles sometimes the mouse cursor would jerk or make half circle and then stop.

I even managed to find someone else's project about PS/2 on digispark: https://github.com/uggima/ps2-mouse-to-usb But the result was sadly the same.

I may have second touchpad available to try, in case it is HW problem, but then again, it worked perfectly fine with the arduino nano clone. Maybe it is question of timing, and the digispark can't keep the relatively strict times needed for the communication. Or maybe somehow there is I dunno, memory overflow?
I tried to moving the definitions of variables out of the loop() in case that was the culprit.
I tried shortening and lengthening the delay at the end of the loop().
I tried changing the delay() to DigiMouse.delay(), not sure if I can somehow change the others too sicne those are in micros.
I tired changing the pins... I think that is what killed the spark, since in one case I put one of the CLK or DATA from the touchpad to the USB data line on digispark and it made it report to my OS as unrecognized device, stopped accepting new programs and then stopped reporting completely - going to buy new one today.

Does anyone have any ideas why would such thing happen?

Thanks for your respone.