I want to read data from a mouse with the help of Arduino. I want to calculate relative motion between two objects. My questions are
1) Is it possible?
2) How is mouse interfaced with Arduino?
I want to read data from a mouse with the help of Arduino. I want to calculate relative motion between two objects. My questions are
1) Is it possible?
2) How is mouse interfaced with Arduino?
For a USB mouse, the data transfer is very complicated. First of all the host (computer) must discover the presence of the mouse (it may have been hot-plugged). Then, the host must find a device driver, and in the case of a mouse, this will be a HID (Human Interface Device) generic driver. Finally, the host will open USB endpoints and actually transfer mouse motion data in the form of X,Y co-ordinates and button up/down bits.
This is something that's hard to do with an Arduino. You'd need to get a USB host interface shield, and then write a sketch (program) to drive it. If you really want to interface a mouse with an Arduino, you may find it easier to get a PS/2 mouse (an obsolete PC-compatible standard) or a serial mouse (another obsolete standard, seen on all types of computers), or a quadrature mouse (very raw interface going directly to button switches and motion sensors).
1). Is it possible?
Yes, of course. If your Arduino has a USB interface (more accurately USB device interface or OTG), it'll be easier.
2). The former PS/2 mouse and the modern USB mouse, or Bluetooth wireless mouse (also use USB interface). The former two are easier to implement on MCU.
The PS/2 is easy to implement, but it's a bit outdated. So, may you want to try USB. Then you need known USB protocol, particularly HID class protocol.
Update:
As you choose to use PS/2, then you can go here: http://www.computer-engineering.org/ps2protocol/, it's really easy, you can implement it using only two pins, a clock and a data pin.