Pages: [1] 2   Go Down
Author Topic: Arduino as USB mouse  (Read 2326 times)
0 Members and 1 Guest are viewing this topic.
Gergia
Offline Offline
Jr. Member
**
Karma: 0
Posts: 78
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 .
Logged

Here was my old signature !!!

0
Offline Offline
Shannon Member
****
Karma: 162
Posts: 10523
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 19
Posts: 3114
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Gergia
Offline Offline
Jr. Member
**
Karma: 0
Posts: 78
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 .
Logged

Here was my old signature !!!

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 58
Posts: 4036
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Logged

Examples can be found in your IDE.

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 515
Posts: 31567
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Gergia
Offline Offline
Jr. Member
**
Karma: 0
Posts: 78
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

how with arduino Leonardo ? what its advantages and how use as virtual mouse ?
thank you GoForSmoke i'll try , that one .
Logged

Here was my old signature !!!

France
Offline Offline
God Member
*****
Karma: 4
Posts: 962
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Mouse library for Leonardo described here :
http://arduino.cc/en/Reference/MouseKeyboard

Mouse code for Leonardo here :
http://arduino.cc/en/Tutorial/ButtonMouseControl
« Last Edit: May 27, 2012, 02:32:22 am by al1fch » Logged

Gergia
Offline Offline
Jr. Member
**
Karma: 0
Posts: 78
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

does this libraries would work with Arduino UNO ?
Logged

Here was my old signature !!!

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 58
Posts: 4036
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Examples can be found in your IDE.

Gergia
Offline Offline
Jr. Member
**
Karma: 0
Posts: 78
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 .
Logged

Here was my old signature !!!

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 19
Posts: 3114
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Delray Beach, FL USA
Offline Offline
Full Member
***
Karma: 0
Posts: 113
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Lookup project LUFA on google, and get something like a teensy that has a built in USB controller on the chip.
Logged


Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 58
Posts: 4036
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Examples can be found in your IDE.

Gergia
Offline Offline
Jr. Member
**
Karma: 0
Posts: 78
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Here was my old signature !!!

Pages: [1] 2   Go Up
Jump to: