Author Topic: it is possible to get the rotation information out of a computer mouse?  (Read 803 times)

robss

  • Member
  • ***
  • Posts: 3
I searched the Internet for HID mouse embedded programmers and found this forum, so perhaps someone here knows the answer to my question!

- I'd like to get the rotation from a computer mouse - if you connect an optical computer mouse to your computer over USB, normally if you rotate the mouse in place (don't move it just rotate it, keeping it flat) the cursor doesn't move in any predictable way or even stays put.

I think what happens is that there is a small grid such as 30x30 pixels that a tiny little optical sensor tracks moment to moment.  I think it must correct for rotation before checking lateral displacement or at any rate it only checks for lateral displacement and rotation isn't checked.

Is it possible to get the rotational change (by some matrix operation or similar, or maybe some other math I don't know) from the same sensor, in your opinion? (by applying slightly different transforms to the pixels in the microprocessor.)

Thanks for any thoughts, anyone!

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2924
    • Lakeview Research
What do you mean by, "don't move it just rotate it, keeping it flat"?

bpaddock

  • Member
  • ***
  • Posts: 49
I searched the Internet for HID mouse embedded programmers and found this forum, so perhaps someone here knows the answer to my question!

- I'd like to get the rotation from a computer mouse - if you connect an optical computer mouse to your computer over USB, normally if you rotate the mouse in place (don't move it just rotate it, keeping it flat) the cursor doesn't move in any predictable way or even stays put...

Here is a data sheet for a mouse sensor:

https://cdn.sparkfun.com/datasheets/Components/General%20IC/ADNS2620.pdf

If your goal is rotation detection, you want a Gyro.
Get a Eval board from Boch, or ST for one of their Gyro/Accelerometers to play with.


We here could better help you if your end goal was clearer to us.

robss

  • Member
  • ***
  • Posts: 3
What do you mean by, "don't move it just rotate it, keeping it flat"?

Your mouse usually always points in the same way: away from you (the buttons are farthest from your body and the optical sensor faces down to the mousepad.)

Keeping the optical sensor still pressed to the mousepad, you can rotate the mouse so it's not facing the right way anymore.  The mouse buttons might point toward the right or toward the left instead of straight ahead as they're supposed to, even though you didn't lift the mouse.

I want to measure this rotation you've just done.

robss

  • Member
  • ***
  • Posts: 3
I searched the Internet for HID mouse embedded programmers and found this forum, so perhaps someone here knows the answer to my question!

- I'd like to get the rotation from a computer mouse - if you connect an optical computer mouse to your computer over USB, normally if you rotate the mouse in place (don't move it just rotate it, keeping it flat) the cursor doesn't move in any predictable way or even stays put...

Here is a data sheet for a mouse sensor:

https://cdn.sparkfun.com/datasheets/Components/General%20IC/ADNS2620.pdf

If your goal is rotation detection, you want a Gyro.
Get a Eval board from Boch, or ST for one of their Gyro/Accelerometers to play with.


We here could better help you if your end goal was clearer to us.

The data sheet you mentioned says "The output format is a two wire serial port. The current X and Y information are available in registers accessed via the serial port."

What is not mentioned is any current rotation.

Can the firmware on this or any other mouse be modified so that if you rotate the mouse in place, it reports this rotation?  How would you do this?

In other words: draw a W on a piece of paper and put your mouse on it.  Then rotate it so that the mouse sees ∑ and then rotate it some more so the mouse sees M.  I want to get this rotational information (0, 90, 180).

I believe the pixels in the grid that hits the sensor array rotate, and it is possible to recover this rotational information through mathematical operations of some kind, though I don't know what.  (The data sheet you've linked hides this information: it abstracts it away.  It reports only x, and y, meaning it does not report the rotation.)

but is it possible to do so from the sensor you linked, or from another, similar sensor?  How would I do this?

I want it reporting 0 when it sees M, turning to 90 when it sees  ∑ turning into 180 when it sees the M turn into a W because it's been rotated so what it saw has turned upside down.

I hope my description is pretty clear but if not please let me know and I'll try again! :D

I do not think gyros are necessary.

Bret

  • Frequent Contributor
  • ****
  • Posts: 67
The simple answer is that no, you cannot get rotation information from a standard mouse.  The mouse sensors (whether optical or mechanical) are only designed to detect linear movement, not rotational movement.  If you've ever had some more advanced physics in school, it's like the difference between linear momentum vs. angular momentum or linear acceleration vs. angular acceleration.   Even though they are similar sounding terms, they are fundamentally very different concepts and are not measured the same way.

You do need something like a gyro which is specifically designed to measure rotation.
« Last Edit: June 30, 2020, 11:39:41 am by Bret »