Good old PS/2 mouse

A project log for USB Crank-Stick

wheel based game controller

PixJuanPixJuan 12/14/2019 at 02:320 Comments

As I don't have a good oscilloscope, debugging the misbehaviour of my quadratic encoder code is quite a pain.   So I thought about using a PS/2 mouse because it is a serial-like protocol which is easy to implement, there are examples on the Arduino playground.
 First, even if I keep a lot of stuff, I struggled a bit to find a PS/2 wheel-mouse in my attic but I finally found one!
It was quite fast to get something working on my Arduino UNO. The basic script doesn't support the wheel, but I found another one which does.

  So I just plugged the PS/2 mouse on my Teensy 3.1 and... it failed!
  The Teensy is 5V tolerant, but my PS/2 mouse isn't, so I fixed the problem by adding a 3.3v<->5.5v level shifter between the PS/2 mouse and my Teensy.
  It is working great so far, it's not missing pulses anymore.
  Later on, I had my "facepalm moment" when I realised the Teensy3.1 support can act as a usb host  if you plug a USB OTG converter into it, so I could have used a USB mouse instead of a vintage PS/2 one! But then I realised that in this configuration I would have needed another board to act as a USB HID, so my struggle to find a PS/2 mouse was not vain.

This PS/2 mouse solution is working really well, but I ordered a Teensy4 to be able to use a USB mouse in a future version.