Close

Where is my mouse?

A project log for Keyboard Mouse

Use an old PS/2 Keyboard as a USB mouse

jared-youngJared Young 01/09/2016 at 18:300 Comments

I cannot find a PS/2 mouse in any of my boxes of junk. I don't know why, but I suspect my wife got to me one day and I threw it out thinking I could never come up with a need for it. I was wrong.

Because I cannot find a PS/2 mouse, I guess I'll just have to use a keyboard.

And that is how I ended up with a device that converts a PS/2 keyboard into a USB mouse.

I wanted the mouse to allow me to create a device that I could click really fast on games that need fast clicking to get ahead, so this is for cheating on simple web games too.

Finally, this goes to show that a lot of good libraries are out there already, and good hardware too. The PS/2 connector is just jumpered directly to power, ground, and two IO lines on a Trinket. No extra hardware there, just an existing library that lets us read keycodes. And to emulate the mouse, there is code for the trinket that uses VUSB to show up as a mouse, we can send any mouse movements or clicks that we want. It takes very little logic to glue the two together.

Arrow keys move the mouse, number keys set the number of pixels per button press to move it. A, S, and D are the mouse buttons, and I have not put in anything for the scroll wheel yet. Pressing Enter toggles rapidly clicking the left mouse button, basically as fast as the hardware can send it.

That's it.

I'm sure this could be usefull, I suspect some accessibility devices could be built on this setup, and other cheates too. You can emulate a keyboard about as easily as a mouse, and most systems allow you to have multiple of either connected.

Finally, this works on Andriod as well, I just connected using a USB OTG adapter to my config and was able to do clicking games on my phone as well.

Discussions