Pages: [1]   Go Down
Author Topic: Ardunio as HID  (Read 702 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey all,
I'm new to these forums. I only happened to stumble on Ardunio after looking for PICs that can be programmed into HID modes. I wanted to know if this is possible with an Ardunio? My project basically consists of two Arduinos with wireless shields(?). One will be attached to my computer to send/receive data to/from the second Arduino. I know they are programmed via USB but I would like to write my own PC software to communicate with the Arduino. The end result being something on the lines of a remote RF controlled bot. Probably a long the lines of four simple motors to start with but slowly developing.

I hope all that made sense and I apologise for any confusion smiley The main thing I wanted to ask is if I can use the Ardunio as an HID so I can write my own program to control and gather data from the I/Os?
Cheers for any responses!

-Sathhin
« Last Edit: April 25, 2012, 05:59:40 pm by Sathhin » Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

HID, as in Human Interface Device?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, I gather from reading that it's easiest to interact with. Plus drivers for HID are supported as standard
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can turn an Arduino into a class-compliant HID device, but its much easier to simply use serial communication between the PC and Arduino.
Logged

Anchorage, AK
Offline Offline
Edison Member
*
Karma: 42
Posts: 1176
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can either hack together something that will technically speak USB-like enough to work (I have an ATmega8A running four S/NES controllers as HID joysticks), or use one of the native USB-speaking chips, like the 8/16/32u4, or the AT90 series.

I don't think the Arduino environment really covers USB devices, so you may have to go strictly AVR C.  But, if you were looking at PICs anyway, that's probably not a deal breaker.  You can develop your device-side code on an Arduino, though.  Just to get your feet wet.  Then, you can cut your ties on the Arduino libs and replace those parts with pure AVR code when you're ready to integrate USB.  (Arduino code is just C/C++ after all.)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the fast replies. I'd like to use USB instead of serial communication to the Arduino simply because of the compatibility across computers, and none of mine have serial ports smiley-grin Hacking the Arduino to be HID compliant sounds like an interesting route... Again I've only looked at PICs so far and they seemed very daunting since the need for programming in assembly. Then I found the Ardunio series and fell in love with it's many features smiley That being said, if you think using the Ardunio isn't really feasible then I'll look at other options.

Can you suggest any reading material for hacking the Arduino to be HID compliant? I don't have any knowledge of programming AVRs and that's why I wanted to stick pretty close to Ardunio and it's support smiley. From what I gather I can use the Ardunio IDE and replace the libs I need with my own code if I do go down that route? That's what I got from what your post anyway, It's late here and I'm about to head to bed so I apologise if I've made any glaring errors in my understanding smiley

All being said, I haven't even purchased an Ardunio yet, maybe more will become clear once I get down and dirty with some simple test circuits?

-Sathhin

EDIT: Cleared up some bad grammar
« Last Edit: April 25, 2012, 05:50:47 pm by Sathhin » Logged

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

Your computers might not have actual serial ports but they all support serial ports through USB. This is much simpler and easer to interface than a USB HID.
If you insist, wrongly, on using HID then perhaps this is the wrong processor platform for you.

Quote
EDIT: Cleared up some bad grammar
But not the title. The word is AS not has.
« Last Edit: April 25, 2012, 05:55:43 pm by Grumpy_Mike » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ah I see, I'm sorry for the misunderstanding there. Well, that sounds idea for me really and I'll look into it smiley Thanks for the advice and help. (Also didn't know I could edit the Thread Title, typo is corrected now).
Logged

Anchorage, AK
Offline Offline
Edison Member
*
Karma: 42
Posts: 1176
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You have two options for using AVRs with direct USB:

1)  You can use an AVR chip with native USB.  These aren't supported Arduino platforms, so you'll need AVR Studio, and you'll need to write your code without the help of the Arduino libs.

2)  You can use an AVR chip without native USB by hacking a low-speed USB interface (bit-banging digital I/O.)  The timing is super-critical, so this necessitates using assembly code at least for the USB stack.  There's a virtual USB stack library out there for AVR.  Not first-project material, though.

If all you want is to exchange data with your circuit, you can use a chip made for USB-to-serial conversion.  This is what the USB port on the Uno does.  USB connects to your computer and looks like a hardware serial port to your software.  The other end connects to the UART on the Arduino (Arduino pins 0,1 -- IC pins 1,2).  A quick way and painless way to accomplish this is to get the FTDI cable (see Adafruit or Sparkfun).  This does USB to TTL-level serial for you.  You have six pins -- DTR, CTS, TX, RX, +5, Gnd.  See any Arduino-on-a-breadboard tutorial for usage.
Logged

Pages: [1]   Go Up
Jump to: