Go Down

Topic: Arduino as USB mouse (Read 3072 times) previous topic - next topic

giorgi111-111

hi , I'm interested in how replace USB mouse with arduino and inherit all mouse abilities .
like right and left clicks and it's coordination on X and Y axis .
I would like to send all information from arduino to PC and work properly .
For ex : I have analog inputs as X and Y axises , and 2 buttons for right and left buttons .
Here was my old signature !!!

MarkT

I think to do that you would have to program the 4U2 or 8U2 USB chip on the Arduino board to mimic a USB mouse, as standard the firmware for the Uno has it as a standard serial device.  Be warned USB protocol is not nice and simple.
[ I won't respond to messages, use the forum please ]

dxw00d

Alternatively, get a USB host shield, and use the HID libraries that are available.

giorgi111-111

is there any library which will mimic as USB mouse , or better idea is PS/2 mouse , since I don't want to spend money .
also , please if PS/2 would be easier and cheaper please inform me .
Here was my old signature !!!

GoForSmoke

Not Arduino but stand-alone AVR's you can program with Arduino:

http://www.obdev.at/products/vusb/index.html

check out the project examples.

There are also the 'Arduino compatible' Teensy and Teensy++ with USB/HID libraries. They use USB capable AVR's and come fully assembled. If you spend the extra to get 'with pins' then it will plug directly into a solderless breadboard.

http://www.pjrc.com/teensy/index.html


Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

Grumpy_Mike

You can do all this easily if you get one of the new arduino Leonardo boards
http://arduino.cc/en/Main/ArduinoBoardLeonardo

giorgi111-111

how with arduino Leonardo ? what its advantages and how use as virtual mouse ?
thank you GoForSmoke i'll try , that one .
Here was my old signature !!!

al1fch

#7
May 27, 2012, 09:29 am Last Edit: May 27, 2012, 09:32 am by al1fch Reason: 1
Mouse library for Leonardo described here :
http://arduino.cc/en/Reference/MouseKeyboard

Mouse code for Leonardo here :
http://arduino.cc/en/Tutorial/ButtonMouseControl

giorgi111-111

does this libraries would work with Arduino UNO ?
Here was my old signature !!!

GoForSmoke

They don't.

UNO has a USB chip but it's for connecting to a PC and not easy to change. The chip you program on the UNO is an ATMega328P and won't use those libraries made for a USB-capable chip.

You can use V-USB with non-USB ATTiny and ATMega chips but you must assemble parts and program the chip, learn how to use a programmer and build to do it. The V-USB site has the information and library to do that, but it's not falling-down simple.

With the Teensy's and the Leonardo all the assembly work is done. They cost more but the path is shorter and smoother.

If you only want to make one or a few then the buy-assembled route is cool. If you want to make many or just want to make saving easier then the V-USB route is cheaper in the long run.
Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

giorgi111-111

all right , as I guess B-USB is more practical , so , please give me some detailed information , like web links and so on , I would be very thankful .
Here was my old signature !!!

dxw00d

A link to v-usb has already been posted by GoForSmoke. Google will have more.

Claghorn

Lookup project LUFA on google, and get something like a teensy that has a built in USB controller on the chip.
http://home.comcast.net/~tomhorsley/hardware/arduino/arduino.html

GoForSmoke

Giorgi, V-USB site is at http://www.obdev.at/products/vusb/index.html
Didn't you look already? Be sure to check out the example projects, each has a link as well.

As to V-USB being more practical, it depends on how many of the same thing you want to make or if you want the least-parts-cost way. But if practical means quickest, easiest and still less than $30 then a Leonardo or Teensy will be better. Practical is what is practical for your means and needs.

Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

giorgi111-111

practical is least-parts-cost , so thank you i'll do my best , if I have some questions let me ask you? thanks .
Here was my old signature !!!

Go Up