Hi,
I am hoping to use an old usb mouse to do some cool stuff.
some of the ideas i have is a tachometer/speedometer for my bike.
or some kind of data logger for a little motorized car i am building, the type of robot that senses an object and then turns. using the mouse sensor to keep track of its movements can then later be used to map a room, or objects in a room...
anyhoo.....
what i have done so far is taken the mouse apart and gotten the board out and figured what the pin outs are.
applied 5 volts/ground to the correct pins and confirmed that the button, for example, has 5 volts getting to it when open. 0 volts when pressed.
i then try to see what voltage was at the data pins and i got none. but this may be because i was measuring voltage between -D and +D and i am not sure if that is correct. according the wikipedia page (http://en.wikipedia.org/wiki/Universal_Serial_Bus) it seems that i should be getting between 0 and .3 volts for low and 2.8 and 3.6 for Hi but i am not seeing anything on my meter regardless if i push the button or not.
so, my questions are:
1) should i see voltage at the Data pins?
2) can i connect them to a analog pin on my UNO and then read what the mouse is spitting out on the serial port?
3) any other advice or knowledge to get me started?
thanks,
jon
using an arduino to reverse engineer a usb mouse
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- berko
- Posts: 67
- Joined: Sat Aug 04, 2012 6:44 pm
- westfw
- Posts: 2008
- Joined: Fri Apr 27, 2007 1:01 pm
Re: using an arduino to reverse engineer a usb mouse
USB is a complicated protocol that sends messages consisting of number of bytes of data, sent one bit at a time at substantial datarates (1.5 Mb/s for "low speed" USB.)
Reading a USB "device" like a mouse using an Arduino is essentially hopeless; you need a special hardware peripheral to support talking to USB devices, and the Arduino doesn't have it (in fact, very few microchips have it.) (The Arduino ADK can do this, at least in theory.)
Now, if you have one of the MANY mice that can "talk" either USB or PS/2 protocols, depending on what kind of port it's actually plugged in to (typically using a physical adaptor that looks like this: , you could be MUCH more successful talking to it with PS/2 protocols. But you'll have to research how to spoof it into talking PS/2 if you no longer have the adapter.
Reading a USB "device" like a mouse using an Arduino is essentially hopeless; you need a special hardware peripheral to support talking to USB devices, and the Arduino doesn't have it (in fact, very few microchips have it.) (The Arduino ADK can do this, at least in theory.)
Now, if you have one of the MANY mice that can "talk" either USB or PS/2 protocols, depending on what kind of port it's actually plugged in to (typically using a physical adaptor that looks like this: , you could be MUCH more successful talking to it with PS/2 protocols. But you'll have to research how to spoof it into talking PS/2 if you no longer have the adapter.
- berko
- Posts: 67
- Joined: Sat Aug 04, 2012 6:44 pm
Re: using an arduino to reverse engineer a usb mouse
thanks westfw,
i do have an adapter like that, so i will plug it in and see if i can get it to work.
best,
jon
i do have an adapter like that, so i will plug it in and see if i can get it to work.
best,
jon
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: using an arduino to reverse engineer a usb mouse
The Adafruit ATmega32U4 Breakout Board, the Teesny 2.0, the Arduino Leonardo, and the Arduino Micro all have the ability to directly host USB devices like mice, keyboards, flash-drives, etc. This is because they are based on the ATmega32u4 processor, which has built-in USB support, instead of the ATmega328, which does not.
- berko
- Posts: 67
- Joined: Sat Aug 04, 2012 6:44 pm
Re: using an arduino to reverse engineer a usb mouse
Thanks driverblock. Very helpful
- westfw
- Posts: 2008
- Joined: Fri Apr 27, 2007 1:01 pm
Re: using an arduino to reverse engineer a usb mouse
the 32u4 contains only USB device support, which enables it to BE a mouse, keyboard, etc. To connect to a usb device like a mouse, the chip would have to have USB host support, which is much less common.
The Teensy 2, leonardo, and Arduino Micro will NOT talk to a USB mouse.
I think Teensy 3 is capable of USB host mode and has a USB OTG connector, but I don't know if there is any SW support for this yet.
The Teensy 2, leonardo, and Arduino Micro will NOT talk to a USB mouse.
I think Teensy 3 is capable of USB host mode and has a USB OTG connector, but I don't know if there is any SW support for this yet.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: using an arduino to reverse engineer a usb mouse
D'Oh!! You're right. Mea culpa.westfw wrote:the 32u4 contains only USB device support, which enables it to BE a mouse, keyboard, etc. To connect to a usb device like a mouse, the chip would have to have USB host support, which is much less common.
Never mind...
- berko
- Posts: 67
- Joined: Sat Aug 04, 2012 6:44 pm
Re: using an arduino to reverse engineer a usb mouse
Hey Guys,
I found this one the web....
interfacing-an-optical-mouse-sensor-to-your-arduino
thanks Matt Richardson
thought i would share for those of you also interested.
Once i get it all figured out (different chip then in the article and he says the library needs updating) i will post more info.
Feel free to do the same if you get it figured out first.
-jon
I found this one the web....
interfacing-an-optical-mouse-sensor-to-your-arduino
thanks Matt Richardson
thought i would share for those of you also interested.
Once i get it all figured out (different chip then in the article and he says the library needs updating) i will post more info.
Feel free to do the same if you get it figured out first.
-jon
Please be positive and constructive with your questions and comments.