Arduino ps2 mouse

arduino mouse and anoying encoder
I have been tinkering a bit with the arduino the last couple of days. Mostly small experiments with some of the junk had around, after some frustrations with a circuit for a rotary encoder, i “gave up” and tried hooking up a ps2 mouse. There are a nice tutorial at the arduino playground. It seemed complicated to interface with a mouse this way. But it proved to be so much easier than trying to build a circuit. The software coding is so much easier than the electrical circuits.

It was a matter of connecting 4 wires and uploading the code to get it running. But then i found out that there wasn’t support for the mouse-wheel, so i googled the datasheet for the IC, and started hacking. I ended up getting the mousewheel to function and getting output for the buttons. Along the way I refactored some of code, in order to better understand what was happening.

I still haven’t figured out what I should use the mouse for, but it was a fun hack.

Here is the sourcecode, if you want to try something with it : ps2mouse for arduino

I tried to make nice comments so it should be very straightforward to work with. As mentioned a haven’t made most of the code, just some additions and refactoring.

The mouse and the annoying encoder i couldn’t build a circuit for. It can be attached to a motor where there are a slotted wheel.

(21 nov updated code)

3 Comments

  1. seb says:

    Hey,

    why have you taken offline your modified code?

    http://rotand.dk/wp-content/ps2mouse.pde returns 404 :(

    Greetings

  2. admin says:

    hmm i recently moved to a new server, something didn’t make it all the way. But im am uploading it now, so it should be back.
    By the way the “sound sequencing mouse” also uses this ps2 code, in a slightly different version, and better version as i recall..

  3. […] Based on code from The Arduino Playground which also shows the pinouts (where the black and white drawing is the female connector’s pintout, the pins on the mouse itself are a mirror image, like in the blurry photo below) and more code from A world in dk(decay/denmark). […]

Leave a Reply