Use USB optical Mouse as a sensor

I've seen a few threads recently where it might make sense to interface a mouse to an Arduino as a sensor for position.

Googling for it I find plenty of references to feeding a PC with position data from the arduino, but very little on READING the xy and button data from the mouse.

Can anyone advise on whether & how this can be done?

It is much easier and possible with an older PS/2 mouse, as that is pretty much, uart serial, directly compatible with the RX pin. However, most USB mice require a USB HOST and enumerate as a HID. There are USB HOST to UART adapters out there, mostly using the CH559 and some tutorials and arduino projects based on those adapters.

A mouse is a USB slave device that connects only to a USB master device. Few Arduinos allow to reconfigure the USB port as a master, and USB shields must be configured for the right device class. That's why a PS/2 mouse will be easier and cheaper to connect, as already mentioned. Other projects access the mouse chip directly, bypassing USB, using it e.g. as a low resolution camera.

Thanks for your replies;

@Perehama following up on your comment - and now knowing what to Google for -

I found a few Arduino USB host controller shields etc.

This one looks promising, and the site provides software to configure it

https://www.hobbytronics.co.uk/usb-host

I've also read the Due can be configured as a USB host

@DrDiettrich - thanks, I've looked at some "cheapie" USB host controllers on ebay and it looks as if they are all pre-configured just to take a memory stick.

USB shields must be configured for the right device class.

johnerrington:
Thanks for your replies;

@Perehama following up on your comment - and now knowing what to Google for -

I found a few Arduino USB host controller shields etc.

You will notice that all of the shields and adapters, including all of that page, and all based on the CH559 use another microcontroller, so you really aren't getting rid of the PC, just replacing it with an embedded solution.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.