Go Down

Topic: Ardunio as HID (Read 1 time) previous topic - next topic


Apr 25, 2012, 07:55 pm Last Edit: Apr 26, 2012, 12:59 am by Sathhin Reason: 1
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 :) 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!



HID, as in Human Interface Device?


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


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.


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


Apr 26, 2012, 12:48 am Last Edit: Apr 26, 2012, 12:50 am by Sathhin Reason: 1
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 :D 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 :) 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 :). 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 :)

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?


EDIT: Cleared up some bad grammar


Apr 26, 2012, 12:53 am Last Edit: Apr 26, 2012, 12:55 am by Grumpy_Mike Reason: 1
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.

EDIT: Cleared up some bad grammar

But not the title. The word is AS not has.


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


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.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131