Let's Make Robots!

PC Ball Mouse = Rotary Position Sensor

Vendor's Description: 

Computer mice with balls contain two (or sometimes three, if the have a scroll wheel) rotary position sensors. These are not mechanical switches, but optical ones. (Just to confuse you, this is why "ball mice" are "optical mice".) A pair of receivers is placed on the opposite side of a slotted wheel from a transmitter. As the ball rotates, it spins the wheel and the sensors detect the direction and speed. Two such arrangements are placed perpendicual to one another.

If anyone wants to try (I'd love to do this, if I could find the time) PS/2 or serial port mice have a little chip in them which does all the speed/position decoding for you AND outputs a serial data stream containing the information. I know this because in a past life I hooked a serial mouse to a PIC with sucess.

If anyone has the time, and an old mouse, please take it apart, attach the slotted wheels to your robot's wheels, hook the chip to your PICaxe and decode the data stream.

The data stream is documented here.

These would make an ideal (and virtually free) position sensor.

Tell us how you get on.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Dunno about code, but the protocol from the mouse (it's one-way RS-232 at 9600 baud, 8n1) is widely documented on the net.

would it be possible to get a bit more info on this? like how to connect it to a picaxe and what code to use?

I kept all the innards when I took apart the mouse that I built my first robot in.  Hopefully I'll find a use for them in the near future.  :)

That's great information, I didn't know how to decode the mouse data so I just used the sensors connected directly to the processor.  BoozeBot uses these sensors to monitor speed and direction of each drive wheel.

Word of warning though, the sensors have a limited response time, since a mouse doesn't normally move that fast across the desk it's not a problem but if the motion your trying to sense is too fast then they loose accuracy.

Any idea what the response time is? Perhaps your mouse uses different sensors to mine, but I have them working happily on a robot doing about 7kph. How fast do you need your beer? Maybe your software could use a tune-up? You might retry with the original hardware and using the data stream. It's really very well documented here.

Another beer can never arrive too quickly!!


I've been meaning to try this...too bad I got rid of most of my old spare mice....  :(
oh snaps!
nothing, it just means I think it's really cool.