Sending keystroke from an Arduino Uno to Computer

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
Arduino100
 
Posts: 6
Joined: Mon Mar 31, 2014 2:54 pm

Sending keystroke from an Arduino Uno to Computer

Post by Arduino100 »

I am about to start on my first Arduino project and have gone through the Arduino tutorials at learn.adafruit.com The tutorials were excellent and cleared up many of the basic questions I've had, but now I need some specific advice as to whether my Uno board will work or if a more advanced board will be required.

Here is what I want to do:
1. An Arduino with an attached photoreceptor will recognize that an LED (on a completely unrelated piece of equipment) has been turned on.
2. Then when the LED is turned on, the Arduino will communicate with an attached Windows computer to tell it to complete a series of tasks.

I have already automated the tasks that Windows will go through using the program AutoHotKey, which is basically a macro recorder. It lets you automate tasks by sending sending keystrokes and mouse clicks. The macro created by AutoHotKey can be triggered by a key combination such as Ctrl+R.

So, in simple terms, the Arduino only needs to send the Ctrl+R key combination to the Windows machine, at which point the Windows machine will take over using AutoHotKey.

From what I have read, it seems that the easiest way to do this is with an Arduino Due, Leonardo, or Micro using the Mouse and Keyboard libraries...but I have an Uno, and as a novice, I am more or less dependant on online guides and tutorials, most of which are geared to an Arduino Uno. It could get complicated applying such tutorials to an Arduino Due, Leonardo or Micro.

So my question is: Is there a really simple way to send a keystroke combination (such as Ctrl+R) to a Windows machine from an Arduino Uno? If I could accomplish this using my Uno, that would be great.

I have seen information about turning an Uno into a HID by using Device Firmware Update, but this seems way too complicated for a beginner. Another factor that may make the DFU route impractical is that in the next phase of this project, I would like the Arduino to control a step motor (so it won't be used exclusively as an HID device).

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Sending keystroke from an Arduino Uno to Computer

Post by adafruit_support_bill »

Emulating an HID device on the Uno is a fairly advanced technique. If you don't want to move to a device with direct support for it (Leo, Micro etc) another option is an EZ-Key. You can send HID keycodes from the Uno to the EZ-Key via serial, and they will be relayed to the computer via Bluetooth: http://www.adafruit.com/products/1535

Arduino100
 
Posts: 6
Joined: Mon Mar 31, 2014 2:54 pm

Re: Sending keystroke from an Arduino Uno to Computer

Post by Arduino100 »

Bill,

Thanks very much for the link to the Bluefruit EZ-Key--it looks like a simple solution.

Thanks again!

Ju
 
Posts: 2
Joined: Tue Apr 08, 2014 11:32 am

Re: Sending keystroke from an Arduino Uno to Computer

Post by Ju »

After repeated attempts, I could not get these EZ-Key Bluetooth HID Keyboard Controllers to work with any Apple device: iPad v2, v4 iOS7, MacBook Pro, MacBook, Mac Pro, iMac, SnowLepeard/BANNED. Not one pairing was successful, everything was triple checked. Real shame because this device would solve some very interesting problems.

My question is, has anyone managed to get this device to pair with Apple devices? Any suggestions to make them work?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Sending keystroke from an Arduino Uno to Computer

Post by adafruit_support_bill »

I could not get these EZ-Key Bluetooth HID Keyboard Controllers to work with any Apple device:
When you say "Controllers" do you mean more than one? How many EZ-Keys have you tried? Others have paired these successfully with Macs of various types.

Ju
 
Posts: 2
Joined: Tue Apr 08, 2014 11:32 am

Re: Sending keystroke from an Arduino Uno to Computer

Post by Ju »

I tried one and then got a replacement since it did not work. Then I could not get the replacement to pair either.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Sending keystroke from an Arduino Uno to Computer

Post by adafruit_support_rick »

How are you powering the EZ-Key? Does the LED light up and blink? Does anything appear in the pairing window on the Mac?

Please post a picture showing your soldering.

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: Sending keystroke from an Arduino Uno to Computer

Post by adafruit2 »

Its certainly been tested plenty on Mac! post up any photos, screenshots, etc that would help debug

robofrog
 
Posts: 1
Joined: Fri Apr 18, 2014 3:17 pm

Re: Sending keystroke from an Arduino Uno to Computer

Post by robofrog »

RobotShop initiated this forum entry on my behalf, so here I am picking up the replies ...

Attempts to pair were made with two different EZ-KEYs powered by a 6 volt AA 4 pack, 9 volt battery or a 5 volt regulated power supply. I have gone to great lengths to verify that the EZ KEY breakout was correctly soldered, connected and powered. Followed all of the Adafruit site instructions but the EZ-KEY will not pair with iPad ii, iPad iv (iOS 6 or 7), Mac Pro (OSX 10.7.5), iMac (10.6.8) and iMac (10.9). EZ-KEY's indicators light up and then the Pair LED flashes slowly as it should. After pressing the "button" for the stated 5 seconds, the EZ-KEY connects (see attached") to all tested computers but Bluetooth utilities "times-out" with a "The pairing attempt was unsuccessful. This configuration of Mac OS X and Bluetooth software could be invalid or unsupported.". Soon after the EZ-KEY "Paired" LED stays on and does not blink (indicating a failure to pair). More or less the same message appears on all Apple computers/pads tested with the EZ-KEY. Multiple reconnects were attempted with all devices, after a 5 second "button" press on the EZ-KEY. 2 hours later not a single pairing was successful on any device, very frustrating. I did not solder the second EZ-KEY (replacement) as I used micro clips to provide power to pins Vin and G. Again could not get the EZ-KEY to pair with any of my iDevices.

Both of the EZ-KEY boards i have tried behaved exactly the same way (no pairing) and they also seem to have the same identical addresses 00.19.5d.25.3f.5a, posibly rendering the EZ-KEY useless (if it did work) for applications requiring multiple bluetooth devices. But, I still have projects that require only one EZ-KEY so any help would be greatly appreciated.

thnx,

roboFrog
Attachments
Screen Shot 2014-02-22 at 6.45.43 PM.png
Screen Shot 2014-02-22 at 6.45.43 PM.png (60.45 KiB) Viewed 1335 times
IMG_0224.jpeg
IMG_0224.jpeg (313.05 KiB) Viewed 1335 times
IMG_0219.jpeg
IMG_0219.jpeg (280.49 KiB) Viewed 1335 times

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Sending keystroke from an Arduino Uno to Computer

Post by adafruit_support_mike »

The 3f5a address indicates a problem with the device firmware.

Send a note to [email protected] with a link to this thread and the folks there will help you get replacements.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”