Posts tagged ‘ps2 mouse’

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)