arduino as a HID keyboard

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

         I am beginner in arduino i am trying to make arduino as a hid keyboard i have tried flip 2.4.6 by installing in my pc and trying to connect with usb but it is showing as can't open the port . Please help in finding which flip version is suitable . I will be very much grateful to you .

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Surely, FLIP is just a tool for getting your code into a chip?

 

https://www.microchip.com/developmenttools/productdetails.aspx?partno=flip

 

Arduino has that capability already built in, doesn't it?

 

 

EDIT

 

typo

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The USB link on an Arduino is a dedicated CDC-ACM converter. As far as I know there's no way to make that operate as any other class of USB device such as HID. Now some later Arduini actually use an atxmega32U4 I believe and while it's programmed by default to be CDC-ACM there is a remote possibility that might be reprogrammed to act as HID. But if you did that you would likely break the reprogramming route CDC_ACM->bootloader->flash so you might need an external programmer.

 

To be honest it might be easiest to do V-USB and just bit-bang HID on a couple of IO pins - but you would probably need to "turn off" the rest of the Arduino infrastructure so it's timers didn't "get in the way" of the tight timing constraints that V-USB has.

EDIT: this list is quite interesting...

 

https://en.wikipedia.org/wiki/Li...

 

if you look at the second column of "host interface" it tells you what chip is being used for the "UART bridge" - any that mention 8U2, 16U2 or 32U4 in that column *may* be reprogrammable to change the UART bridge (CDC-ACM) to be HID instead. But, like I say, if you start messing with the programming of the bridge you will probably break its bridge operation (though "dual class" might be possible). if you break the bridge the main Arduino processor may not be reprogrammable via the usual route. So you probably need an ISP programmer. In fact you will likely need one to change the 8U2/16U2/32U4 anyway.

Last Edited: Wed. May 30, 2018 - 10:26 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

chandrakanth hasn't said which particular "Arduino" (s)he is using.

 

I think some do have a separate USB connection available for the user's application; eg, DUE, Zero ?

 

chandrakanth wrote:
I am beginner in arduino
 

So have you mastered the basics first?  eg, writing and downloading a simple LED blink? Doing a "Hello, World".

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
I am beginner in arduino
Given that then what I am suggesting would be a VERY complicated approach. Perhaps V-USB on IO is the "simple" solution here?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Ah now this is interesting:

 

https://arduino.stackexchange.co...

 

Esp. the last answer there. So it seems the 16U2 on some Arduino's contains DFU and is therefore "Flip" reprogrammable. That presumably explains OP's mention of Flip in #1 ?

 

I think we need to hear which model of Arduino it is that is being talked about here. Is it one with 8U2/16U2 or 32U4 based?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Some of the Teensy's have native USB, and I believe they are also compatible with "arduino".

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you're using a micro that has native USB functionality, like the ATMEGA32u4 (Leonardo, Pro Micro...ect) , Arduino has included libraries. See below.

 

This isn't the case for Arduinos like the UNO that use another chip to translate the main microcontrollers UART into USB, because the HID function makes the board not work like a normal Arduino bootloader works. You would have to reprogram the 16u2 chip on the UNO to be HID compliant, and then no boot loady. I've seen some work arounds like having the code for the 16u2 on the Uno look for a jumper/switch and if the switch is there, go into HID or MIDI mode, and if it's not there switch to the bootloader mode. If you have a stand alone programmer then having a bootloader isn't that big of an issue. Sparkfun sells a USBISP based AVR programmer for cheap. 

 

Arduino HID Library

 

Many of this HID/MIDI stuff can be attributed to the work ABCMiniUser's LUFA project. THANK YOU DEAN! We owe you many collective beers. 

Last Edited: Mon. Jul 9, 2018 - 11:51 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Hello,  You didn't say what Arduino that you have, but you need a Leonardo, Pro Micro, or Due for USB keyboard or mouse applications.   These three models have the ATmega32u4 AVR that has USB functionality in its hardware.  Then try the examples in the Arduino Keyboard and Mouse control section.  https://www.arduino.cc/en/Tutori... Then read and study the library source code for keyboard.h and mouse.h.   And download all the tutorials that you can find on the web using Google concerning USB.  Save the advanced ones: read twice the simple and beginning ones.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Excuse me for nit picking :"The Arduino Due is a microcontroller board based on the Atmel SAM3X8E" according to https://store.arduino.cc/arduino...

In small french  province town, they are arm based, too (and rather expensive,  4 times more expensive than a keybeard or a mouse, making emulating such devices an economical crime). (else your post seems perfect to me

edited : with a slight nuance, you advise to read all the tutorials, and you might be overoptimistic as arduino is getting very popular, some tutorials worked once because of mere luck and people will learn, copy and paste the same horrors, with less luck; I once saw a Arduino book, meant for teaching,  -they claimed to have been reread-proofreaders are not perfect- , and sell- with a trivial horror -do not be afraid: it was in French- ; if one has to sort each and every tutorial before reading it, it becomes very difficult)

Last Edited: Wed. Jul 11, 2018 - 08:25 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dbrion0606 wrote:
In small french province town,
If only someone would invent some kind of internationally connected network that would allow anyone on the globe to access sales sites located anywhere else on the globe so location were no longer an issue!....

 

... oh wait a minute...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Perhaps elsewhere in the world, Arduino Due are not 4 times more expensive than mice/keyboards (makes a weird idea to convert them into mice/keyboards, adding an extra cost of buttons...)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I saw that the library code that allows mouse/keyboard manipulation runs on a Leo, ProMicro, or Due; and assumed that the Due had the same CPU as the other two.  My mistake.  Still, this Arduino USB approach is the only way that an embedded-systems beginner is able to develop useful monitor/modify applications for the PC's keyboard or mouse.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What surprised me in your post is the fact that, usually, you have very wise tecnical raguments and you link them with economical arguments . In your post, you were technically right, but using Arduino Due as a mouse/keyboard is an economical crime , as it never was chinese cloned (things can be worse: as Arduino Due is not 5v tolerant, some hardware shields made for avr arduini can kill the expensive Due) .