Search This Blog

Tuesday 8 January 2013

PS/2 Mouse Hack Blinkenlights 1

One of the first things I did when I got my first Arduino was to create a little project which used an old PS/2 optical mouse I had in my computer junk box (stuff which "might be useful" and sits in the box for five years until "it can't possibly be useful"). The plan for this project was to have three red LEDs, controlled by mouse buttons, and two green LEDs, controlled by the scroll wheel. Completely useless, but hey, look at the blinking lights!

The junk

PS/2 refers to the connector type for the mouse. Other than this the mouse is a decent optical mouse much like modern USB connected mice. The PS/2 connector was a PC standard throughout the 1990s that was fairly quickly replaced by USB since 2000. USB has the advantage of being able to use any USB port available, rather than one mouse port, and is hot-pluggable.

To go with the mouse I also have a PS/2 socket (together with a serial port socket) from an old PC. These were wired to plugs that would have connected to a riser on a motherboard with the socket plate being exposed at the back of the PC (in a slot with the PCI cards). The socket is useful because I would not need to cut the mouse cable to experiment with it.

Green PS/2 plug in the PS/2 socket. The grey wire goes to a couple of black 4 socket plugs, into which jumper wires are inserted to connect to the breadboard and Arduino.
The PS/2 socket has a grey cable that leads to two four pin header plugs on the motherboard end, the four wires going into these are of different colours (why didn't they just use one four pin header for the four wires?). My research (on the internet) lead me to conclude that there was no standard for colours inside a PS/2 cable or for the pins on a motherboard connector, so the only standard thing was the socket itself.

The relation between the pins and the coloured wires had to be discovered by experiment with continuity testing. At this time I did not have a multimeter so I inserted jumper wires in the  header socket holes which would be connected to +5V one at a time to discover which pin the colour belonged to. I then made a simple circuit on the breadboard with an LED with a flying jumper wire from the anode of the LED. Plugging the flying lead into each of the holes in the socket, if it lit the LED then that indicated a match, this was noted and the jumper wire was disconnected at the header end and move to the next wire.

There is a good article about the PS/2 Connector on wikipedia.

PS/2 Socket (looking into socket)
PinSignalDescriptionColour
1+DATADataOrange
2NCNot connected
3GNDGroundRed
4Vcc+5 V DC at 275mAYellow
5+CLKClockGreen
6NCNot connected

Note there is no standard for the colours, this is what I discovered in my case, other cables may be different.

The Circuit



No comments:

Post a Comment