Introducing Bluefruit EZ-Key

Introducing Bluefruit EZ-Key
Created by lady ada
Last updated on 2014-10-05 05:30:10 PM EDT
Guide Contents
Guide Contents
2
Overview
4
Pinouts
6
Top Row
6
Grounds and Vin
6
Control and LEDs
6
Bottom Row
7
Left Port (6-pins)
7
Pairing to Bluefruit
8
Windows
9
Step 0. Install USB adapter
10
Step 1. Power the Bluefruit EZ-Key and Press the Pair Button
10
Step 2 Pair using Windows Bluetooth services
10
Mac
15
Step 1. Power the Bluefruit EZ-Key and Press the Pair Button
15
Step 2. Pair Using MacOS Bluetooth Service
15
Linux (e.g. Raspberry Pi)
22
Step 0 Plug in BT Adapter
23
Step 1 Update & Install Bluez
23
Step 2. Power the Bluefruit EZ-Key and Press the Pair Button
26
Step 3. Scan & Connect to Bluefruit Module
26
User Manual
29
Dimensions in Inches & mm
30
Sending Keys/Mouse Via Serial
33
Printable character keymap
33
Non-printable Characters
36
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 2 of 58
Raw HID Keyboard Reports
37
Raw HID Mouse Reports
41
Raw HID Consumer Reports
42
Testing Sketch (Arduino)
42
Remapping the Buttons (Serial)
48
Load Processing Sketch
49
Customizing Keys
52
Remapping the Buttons (Wireless)
54
"Text style" over-the-air remapper
55
FAQ
58
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 3 of 58
Overview
Create your own wireless Bluetooth keyboard controller in an hour with the Bluefruit EZ-Key:
it's the fastest, easiest and bestest Bluetooth controller. We spent years learning how to
develop our own custom Bluetooth firmware, and coupled with our own BT module
hardware, we've created the most Maker-friendly wireless you can get!
This breakout acts just like a BT keyboard, and works great with any BT-capable device:
Mac, Windows, Linux, iOS, and Android. Power the module with 3-16VDC, and pair it to the
computer, tablet or phone just as you would any other BT device. Now you can connect
buttons from the 12 input pins, when a button is pressed, it sends a keypress to the
computer. We pre-program the module to send the 4 arrow keys, return, space, 'w', 'a', 's',
'd', '1' and '2' by default. Advanced users can reprogram the module's keys using an FTDI or
other Serial console cable, for any HID key report they desire.
You can pair multiple Bluefruit's to a single device, each one has a unique identifier. These
modules are FCC & CE certified and are RoHS-compliant so they are easy to integrate into
your project.
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 4 of 58
If you want to have better control over the data sent, connect a microcontroller to the RX pin
at 3-5V logic level, 9600 baud, and send ASCII data: it will be 'typed out' character by
character. We also have support for various non-printable characters such as ESC, Shift, F1F12, etc. as well as toggling the virtual keyboard on iOS.
New in v1.1 (shipping as of Oct 22 2013) - We've made Bluefruit EZ-Key even better, you
can now map keys to mouse button clicks and mouse movement (up/down/left/right) as well
as send mouse commands over the UART. We also now have 'over the air' remapping, no
serial cable required to re-map the pins!
New in v1.2 (shipping as of Nov 7 2013) - We have added support for mapping buttons to
some "Consumer Report" keys, also known as Multimedia buttons.
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 5 of 58
Pinouts
This is a tour of all the pins available on the EZ-Key module. The module consists of a CSR
BlueCore with custom firmware on a breakout PCB. The PCB makes it easy to use and hard
to break. Every pin and connection you want is available on the breakout board, and there's
even some handy mounting holes.
Let's take a tour of the pins! Starting with the top control & power pins...
Top Row
Grounds and Vin
To use this module, you will need to at least power it. Powering it is easy though, you can
give it anywhere between 3-16VDC and the power input is reverse-polarity protected.
Connect the positive wire from your battery to Vin and ground to the Gro unds or G pin.
There is an output from the onboard 3.3V voltage regulator on pin 3v that will let you snag
~100mA of current for other sensors, microcontrollers or whatever.
Control and LEDs
To the right of the power pins, there are some control pins
RS - this is the reset pin. To reset the module, pull this pin to ground. It does not affect
pairing.
L2 - this is the same output that is connected to the Pair LED. If you want to put this
in a box and have an external Pair indicator LED, wire an LED from this pin, through a 1K
resistor, to ground.
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 6 of 58
PB - this is the pair button pin. It is connected to the button onboard that is used to
reset the pairing. If you want to make another, external pair button, connect a switch
from this key to 3V (not ground!)
L1 - this is the same output that is connected to the Key LED. If you want to put this in
a box and have an external Key-press indicator LED, wire an LED from this pin, through
a 1K resistor, to ground.
RX - this is the UART input, used if you want to send UART->Keypress data, or re-map
the buttons. It is 5V compliant, use 3V-5V TTL logic, 9600 baud.
TX - this is the UART output, used for watching debug data or re-mapping the buttons.
It is 3V logic level output.
Bottom Row
This row is easy, it is 12 individual pins that connect to a switch that will trigger a keypress.
Each pin has a pullup resistor internally to 3V. To activate a keypress, connect the pin to
ground. When it is connect to ground, a KEYDOWN is sent, when it is disconnected, a KEYUP
is sent.
Do not inject 5V into these pins! They connect directly to the BT module which runs at 3V.
Left Port (6-pins)
Despite looking a lot like an FTDI connector, this is the programming/test port. We use this
at the Adafruit factory to get your modules tested. It is not field reprogrammable. Do not
connect anything to these pins, it could damage or permanently brick the EZ-Key!
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 7 of 58
Pairing to Bluefruit
Before you can use the EZ-Key you have to pair it to your computer, laptop, tablet or
phone. It's pretty easy to do this because EZ-Key acts just like a Bluetooth keyboard.
We have detailed walkthroughs for Windows, Mac and Linux (Raspberry Pi)
We have also paired it without difficulty to iOS devices such as iPhone and iPad (any version)
and an Android tablet but don't have a detailed walkthrough. Check your device's
documentation on how to pair a keyboard. It's usually really easy and just requires turning on
BT and then scanning for the powered up module.
Yo u o nly have to pair o nce to yo ur device. After that, it will auto -co nnect.
If you ever have difficulties with auto-connecting, especially if you do a system update or
upgrade, just follow the pairing procedure from the beginning. It only takes a few minutes.
The following GIF shows meaning of the red LED on board.
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 8 of 58
Windows
This page will show you how to pair your Bluefruit EZ-Key to a Windows computer. It's tested
on XP and 7 but should work similarly with Windows 8.
Yo u o nly have to pair o nce - after the EZ-Key is paired to a co mputer it will
auto -co nnect fro m then o n
First up, you'll have to make sure you have Bluetooth v2.1 or greater on your computer.
Many laptops have BT built in and unless its a really old machine (< 2008), the built in BT
should be OK. If you do not have BT built in, you'll need a USB dongle such as this
one (http://adafru.it/1327)
Many ultra-low cost USB adapters you may find are BT v2.0 and NOT v2.1. You MUST
have a v2.1 or greater adapter, as v2.0 does not support the way we handle pairing. If
you get a BT v4 module you will have no problems, so please do not use "$2"
adapters!
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 9 of 58
Step 0. Install USB adapter
99% of the time, you can just plug it in and Windows will automatically install the drivers, as
there are only two main chipsets (CSR & Broadcom) and they have built in support.
Step 1. Power the Bluefruit EZ-Key and Press the Pair
Button
The title of this step is pretty much what you have to do. Remember that you have solder
the 0.1" headers to the module or at least solder wires to the Vin and Gro und
connections. Connect Vin to 3 to 16VDC (5V is ideal) and ground to the ground power wire.
You should see the red LED blink. Now press the mini butto n o n the EZ Key fo r 5
seco nds and release, this will erase any old pairing information and let you re-pair to your
computer.
The red LED will now blink at a steady once-a-second.
Step 2 Pair using Windows Bluetooth services
In the Control Panel, find the Add Blueto o th Device entry
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 10 of 58
Wait a minute until you see the Adafruit Keyboard device show up with the full ID name, it will
look like this:
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 11 of 58
Select the Adafruit EZ-Key and press Next
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 12 of 58
It may take up to 3 minutes to get the driver and install it, this is normal. If Windows
complains about a timeout, just start the process over (it's rare for that to happen)
If it asks you for a passcode, the pairing code is 1234
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 13 of 58
That's it! You will now see the red LED blinking much slower, to indicate it is paired
succesfully
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 14 of 58
Mac
This page will show you how to pair your Bluefruit EZ-Key to a Mac OS X computer.
Connecting to iOS is nearly identical.
Yo u o nly have to pair o nce - after the EZ-Key is paired to a co mputer it will
auto -co nnect fro m then o n
We have never found a Mac without BT built in so lucky for you, no extra module is
required! (http://adafru.it/1327)
Step 1. Power the Bluefruit EZ-Key and Press the Pair
Button
The title of this step is pretty much what you have to do. Remember that you have solder
the 0.1" headers to the module or at least solder wires to the Vin and Gro und
connections. Connect Vin to 3 to 16VDC (5V is ideal) and ground to the ground power wire.
You should see the red LED blink. Now press the mini butto n o n the EZ Key fo r 5
seco nds and release, this will erase any old pairing information and let you re-pair to your
computer.
The red LED will now blink at a steady once-a-second.
Step 2. Pair Using MacOS Bluetooth Service
In the System Preferences, find the Bluetooth icon
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 15 of 58
Double-click to open, make sure Bluetooth is ON (some computers have it off, you must
have BT on!) and click Set Up New Device
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 16 of 58
Let the assistant run for a minute until it locates and displays the EZ-Key module
Select it and click Continue
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 17 of 58
It'll take a minute for it to pair
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 18 of 58
That's it! If you get a pop-up asking you to configure the keyboard layout, just close or quit
that window.
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 19 of 58
You can now see that the EZ-Key is paired and connected.
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 20 of 58
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 21 of 58
Linux (e.g. Raspberry Pi)
This page will show you how to pair your Bluefruit EZ-Key to a Linux computer. It's tested on
Raspberry Pi & Raspbian but the instructions will be similar for other machines and distros
(we hope!) Check your distro documentation if this doesn't work.
Thanks to http://www.correlatedcontent.com/blog/bluetooth-keyboard-on-the-raspberrypi/ (http://adafru.it/cJW) for the details!
Yo u o nly have to pair o nce - after the EZ-Key is paired to a co mputer it will
auto -co nnect fro m then o n
First up, you'll have to make sure you have Bluetooth v2.1 or greater on your computer.
Many laptops have BT built in and unless its a really old machine (< 2008), the built in BT
should be OK. If you do not have BT built in, you'll need a USB dongle such as this
one (http://adafru.it/1327)
Many ultra-low cost USB adapters you may find are BT v2.0 and NOT v2.1. You MUST
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 22 of 58
have a v2.1 or greater adapter, as v2.0 does not support the way we handle pairing. If
you get a BT v4 module you will have no problems, so please do not use "$2"
adapters!
Step 0 Plug in BT Adapter
With the Raspberry Pi off, plug in the BT module and reboot.
Step 1 Update & Install Bluez
Make sure you have Internet connectivity on your Pi so you can install the following updates
& software for Bluetooth control.
All of the following must be typed into a Terminal window or Console or Command line.
sudo apt-get update
sudo update-rc.d -f dbus defaults
sudo apt-get install bluez python-gobject
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 23 of 58
Now run
hcito o l dev
to see the bluetooth USB module
Lastly, we'll make a minor edit to allow passkey-less pairing. Run
sudo nano /usr/bin/bluez-simple-agent
To edit the agent that manages BT pairing. Type Co ntro l-W to search for
Keybo ardDisplay
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 24 of 58
Then edit that line and change Keyo ardDisplay to DisplayYesNo
Step 2. Power the Bluefruit EZ-Key and Press the Pair
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 25 of 58
Step 2. Power the Bluefruit EZ-Key and Press the Pair
Button
The title of this step is pretty much what you have to do. Remember that you have solder
the 0.1" headers to the module or at least solder wires to the Vin and Gro und
connections. Connect Vin to 3 to 16VDC (5V is ideal) and ground to the ground power wire.
You should see the red LED blink. Now press the mini butto n o n the EZ Key fo r 5
seco nds and release, this will erase any old pairing information and let you re-pair to your
computer.
The red LED will now blink at a steady once-a-second.
Step 3. Scan & Connect to Bluefruit Module
Now it's time to find the Bluefruit device. Run
hcitool scan
to scan for devices. You may have to run it once or twice to see the Adafruit device pop up
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 26 of 58
See that long number before the name? Starts with 00:18:... ? Each module has a unique
identifier number. Your setup will have a different ID so be sure to type out the exact same
ID you have. We will proceed as if you were pairing to the module on my desk :)
We will now create a device for the keyboard. Type in
sudo bluez-simple-agent hci0 00: 18: 96: B0: 04: 82
But changing it to the ID number you have
Next, we will trust this keyboard. Type in
sudo bluez-test-device trusted 00: 18: 96: B0: 04: 82 yes
(don't forget that yes at the end)
followed by
sudo bluez-test-device trusted 00: 18: 96: B0: 04: 82
(no yes at the end)
You should see a 1 after the last command. If you get a 0 try again, check that you typed
the #'s right.
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 27 of 58
Finally, we can connect! The last command to run is:
sudo bluez-test-input co nnect 00: 18: 96: B0: 04: 82
If you want to ever remove the pairing, type in
sudo bluez-test-device remo ve 00: 18: 96: B0: 04: 82
Now you will notice the red LED on the module blink slower.
REMEMBER! This is a USB keyboard so if you are SSH'd or connecting via a Console
cable, you WON'T see keystrokes appear. On a Raspberry Pi you have to connect a TV
to the Composite or HDMI outputs to see the keyboard input.
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 28 of 58
User Manual
The user manual is the shortest page of this guide, because its really really easy to get
going.
1. Power the EZ-Key with 3-16VDC power. Batteries work great: 3 or 4 alkaline or
rechargeable 1.5V, a 9V, Lithium Ion/Polymer, Lead acid... Whatever you have!
2. Pair the EZ-Key to your computer, laptop, tablet or phone
3. Connect one side of a switch to GPIO #0 through #11. Connect the other side to
Ground.
4. Open up a notepad or text editor on the paired computer
5. Press the switch to send a key code
6. Profit?
You will be able to see the green LED blink every time it detects a switch and sends the
keycode.
Since GPIO #0 through #3 are arrow keys, they might be more difficult to detect if the
notepad software is empty. Try GPIO #4 through #11 which send printable characters
When a switch is pressed, a KEYDOWN command is sent, when it is release, a matching
KEYUP goes out. You can have up to 6 switches pressed at once and it will be like they were
pressed all at the same time. 6 is a strict limit of Bluetooth.
Do n't fo rget: Yo u do n't have to use a plain clicky switch! Try tilt senso rs,
reed switches, co nductive velcro , big sto mpy butto ns, arcade jo ysticks,
ANYTHING that makes/breaks two co ntacts
Here is the default switch-to-key mapping:
#0 - Up Arrow
#1 - Down Arrow
#2 - Left Arrow
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 29 of 58
#3 - Right Arrow
#4 - Return
#5 - Space
#6 - the number '1'
#7 - the number '2'
#8 - lowercase 'w'
#9 - lowercase 'a'
#10 - lowercase 's'
#11 - lowercase 'd'
You can customize these with a little bit of effort, see the Remapping Buttons page.
Dimensions in Inches & mm
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 30 of 58
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 31 of 58
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 32 of 58
Sending Keys/Mouse Via Serial
For advanced users, you may want to hook up your Bluefruit to a microcontroller and send
characters or strings via Bluetooth.
You can do this with the UART port on the EZ-Key. The UART pins are labeled RX (data going
into the module) and TX (debug data coming out of the module). You can get away with just
connecting to RX. The RX pin is 5V compliant, you can send it 3V or 5V TTL logic levels. Use
9600 baud serial, all microcontrollers will support this.
You can also send raw HID Keyboard reports for complex key-stroke combinations and
controls.
In versio n v1.1 (Oct 22, 2013 o r later) HID Mouse reports are also supported, you
can send mouse movement and clicks via the UART and microcontroller
In versio n v1.2 (No v 2013 o r later) HID consumer report keys are supported, there
are a few supported 'multimedia keys' - see below for a list and how to send via the UART
Don't forget to also tie a ground pin from your microcontroller to the EZ-Key for the logic
ground reference!
Printable character keymap
For printing ASCII characters, you can simply send those to the UART and they will be 'typed
out'. See below for the list of printable ASCII characters, starting with 0x20 and ending with
0x7E
Thanks to Wikipedia for this nice chart! (http://adafru.it/cJX)
© Adafruit
Industries
Binary
Oct
Dec
Hex
Glyph
010 0000
040
32
20
010 0001
041
33
21
!
010 0010
042
34
22
"
010 0011
043
35
23
#
010 0100
044
36
24
$
010 0101
045
37
25
%
010 0110
046
38
26
&
010 0111
047
39
27
'
010 1000
050
40
28
(
010 1001
051
41
29
)
010 1010
052
42
2A
*
010 1011
053
43
2B
+
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 33 of 58
© Adafruit
Industries
010 1100
054
44
2C
,
010 1101
055
45
2D
-
010 1110
056
46
2E
.
010 1111
057
47
2F
/
011 0000
060
48
30
0
011 0001
061
49
31
1
011 0010
062
50
32
2
011 0011
063
51
33
3
011 0100
064
52
34
4
011 0101
065
53
35
5
011 0110
066
54
36
6
011 0111
067
55
37
7
011 1000
070
56
38
8
011 1001
071
57
39
9
011 1010
072
58
3A
:
011 1011
073
59
3B
;
011 1100
074
60
3C
<
011 1101
075
61
3D
=
011 1110
076
62
3E
>
011 1111
077
63
3F
?
Binary
Oct
Dec
Hex
Glyph
100 0000
100
64
40
@
100 0001
101
65
41
A
100 0010
102
66
42
B
100 0011
103
67
43
C
100 0100
104
68
44
D
100 0101
105
69
45
E
100 0110
106
70
46
F
100 0111
107
71
47
G
100 1000
110
72
48
H
100 1001
111
73
49
I
100 1010
112
74
4A
J
100 1011
113
75
4B
K
100 1100
114
76
4C
L
100 1101
115
77
4D
M
100 1110
116
78
4E
N
100 1111
117
79
4F
O
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 34 of 58
© Adafruit
Industries
101 0000
120
80
50
P
101 0001
121
81
51
Q
101 0010
122
82
52
R
101 0011
123
83
53
S
101 0100
124
84
54
T
101 0101
125
85
55
U
101 0110
126
86
56
V
101 0111
127
87
57
W
101 1000
130
88
58
X
101 1001
131
89
59
Y
101 1010
132
90
5A
Z
101 1011
133
91
5B
[
101 1100
134
92
5C
\
101 1101
135
93
5D
]
101 1110
136
94
5E
^
101 1111
137
95
5F
_
Binary
Oct
Dec
Hex
Glyph
110 0000
140
96
60
`
110 0001
141
97
61
a
110 0010
142
98
62
b
110 0011
143
99
63
c
110 0100
144
100
64
d
110 0101
145
101
65
e
110 0110
146
102
66
f
110 0111
147
103
67
g
110 1000
150
104
68
h
110 1001
151
105
69
i
110 1010
152
106
6A
j
110 1011
153
107
6B
k
110 1100
154
108
6C
l
110 1101
155
109
6D
m
110 1110
156
110
6E
n
110 1111
157
111
6F
o
111 0000
160
112
70
p
111 0001
161
113
71
q
111 0010
162
114
72
r
111 0011
163
115
73
s
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 35 of 58
111 0100
164
116
74
t
111 0101
165
117
75
u
111 0110
166
118
76
v
111 0111
167
119
77
w
111 1000
170
120
78
x
111 1001
171
121
79
y
111 1010
172
122
7A
z
111 1011
173
123
7B
{
111 1100
174
124
7C
|
111 1101
175
125
7D
}
111 1110
176
126
7E
~
Non-printable Characters
There's a lot of other keycodes you may want to send, here is the mapping from the 8-bit
byte to the keycode sent.
© Adafruit
Industries
HEX
Keyname
0x01
Insert
0x02
Home
0x03
Page Up
0x04
Delete
0x05
End
0x06
Page Down
0x07
Right Arrow
0x08
Backspace
0x09
Tab
0x0A
Enter
0x0B
Left Arrow
0x0C
Down Arrow
0x0D
Enter
0x0E
Up Arrow
0x0F - 0x1A
F1 - F12
0x1B
Esc
0x1C
Caps Lock
0x1D
Scroll Lock
0x1E
Break
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 36 of 58
0x1F
Num Lock
0x20-0x7E
Printable Ascii
0x7F
Toggle iOS Keyboard
0xE0
Left Control
0xE1
Left Shift
0xE2
Left Alt
0xE3
Left GUI
0xE4
Right Control
0xE5
Right Shift
0xE6
Right Alt
0xE7
Right GUI
Raw HID Keyboard Reports
Bluefruit can send raw HID Keyboard reports. This allows sending any modifier keys + up to
6 keycodes at once. Its advanced but super useful for when you want to have fine-control of
keypresses!
Raw HID reports start with 0xFD and have 8 bytes following. For keyboard, its
0xFD [mo difiers] 0x00 [keyco de1] [keyco de2] [keyco de3] [keyco de4]
[keyco de5] [keyco de6]
Raw USB HID keycodes are not the same as ASCII!
Here's a list of USB HID keycodes (its in java format but you get the idea), you can also get
another list here http://www.freebsddiary.org/APC/usb_hid_usages.php (http://adafru.it/cQV)
under "7 Keyboard"
// Bits in usbHidKeyboardInput.modifiers
final byte MODIFIER_NONE
=byte((0));
final byte MODIFIER_CONTROL_LEFT =byte((1<<0));
final byte MODIFIER_SHIFT_LEFT =byte((1<<1));
final byte MODIFIER_ALT_LEFT
=byte((1<<2));
final byte MODIFIER_GUI_LEFT
=byte((1<<3));
final byte MODIFIER_CONTROL_RIGHT =byte((1<<4));
final byte MODIFIER_SHIFT_RIGHT =byte((1<<5));
final byte MODIFIER_ALT_RIGHT
=byte((1<<6));
final byte MODIFIER_GUI_RIGHT
=byte((1<<7));
// Values for usbHidKeyboardInput.keyCodes
// Only the key codes for common keys are defined here. See Hut1_12.pdf for a full list.
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 37 of 58
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
© Adafruit
Industries
KEY_NONE
=byte(0x00);
KEY_A
=byte(0x04);
KEY_B
=byte(0x05);
KEY_C
=byte(0x06);
KEY_D
=byte(0x07);
KEY_E
=byte(0x08);
KEY_F
=byte(0x09);
KEY_G
=byte(0x0A);
KEY_H
=byte(0x0B);
KEY_I
=byte(0x0C);
KEY_J
=byte(0x0D);
KEY_K
=byte(0x0E);
KEY_L
=byte(0x0F);
KEY_M
=byte(0x10);
KEY_N
=byte(0x11);
KEY_O
=byte(0x12);
KEY_P
=byte(0x13);
KEY_Q
=byte(0x14);
KEY_R
=byte(0x15);
KEY_S
=byte(0x16);
KEY_T
=byte(0x17);
KEY_U
=byte(0x18);
KEY_V
=byte(0x19);
KEY_W
=byte(0x1A);
KEY_X
=byte(0x1B);
KEY_Y
=byte(0x1C);
KEY_Z
=byte(0x1D);
KEY_1
=byte(0x1E);
KEY_2
=byte(0x1F);
KEY_3
=byte(0x20);
KEY_4
=byte(0x21);
KEY_5
=byte(0x22);
KEY_6
=byte(0x23);
KEY_7
=byte(0x24);
KEY_8
=byte(0x25);
KEY_9
=byte(0x26);
KEY_0
=byte(0x27);
KEY_RETURN
=byte(0x28);
KEY_ESCAPE
=byte(0x29);
KEY_BACKSPACE
=byte(0x2A);
KEY_TAB
=byte(0x2B);
KEY_SPACE
=byte(0x2C);
KEY_MINUS
=byte(0x2D);
KEY_EQUAL
=byte(0x2E);
KEY_BRACKET_LEFT
=byte(0x2F);
KEY_BRACKET_RIGHT
=byte(0x30);
KEY_BACKSLASH
=byte(0x31);
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 38 of 58
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
© Adafruit
Industries
KEY_BACKSLASH
=byte(0x31);
KEY_EUROPE_1
=byte(0x32);
KEY_SEMICOLON
=byte(0x33);
KEY_APOSTROPHE
=byte(0x34);
KEY_GRAVE
=byte(0x35);
KEY_COMMA
=byte(0x36);
KEY_PERIOD
=byte(0x37);
KEY_SLASH
=byte(0x38);
KEY_CAPS_LOCK
=byte(0x39);
KEY_F1
=byte(0x3A);
KEY_F2
=byte(0x3B);
KEY_F3
=byte(0x3C);
KEY_F4
=byte(0x3D);
KEY_F5
=byte(0x3E);
KEY_F6
=byte(0x3F);
KEY_F7
=byte(0x40);
KEY_F8
=byte(0x41);
KEY_F9
=byte(0x42);
KEY_F10
=byte(0x43);
KEY_F11
=byte(0x44);
KEY_F12
=byte(0x45);
KEY_PRINT_SCREEN
=byte(0x46);
KEY_SCROLL_LOCK
=byte(0x47);
KEY_PAUSE
=byte(0x48);
KEY_INSERT
=byte(0x49);
KEY_HOME
=byte(0x4A);
KEY_PAGE_UP
=byte(0x4B);
KEY_DELETE
=byte(0x4C);
KEY_END
=byte(0x4D);
KEY_PAGE_DOWN
=byte(0x4E);
KEY_ARROW_RIGHT
=byte(0x4F);
KEY_ARROW_LEFT
=byte(0x50);
KEY_ARROW_DOWN
=byte(0x51);
KEY_ARROW_UP
=byte(0x52);
KEY_NUM_LOCK
=byte(0x53);
KEY_KEYPAD_DIVIDE
=byte(0x54);
KEY_KEYPAD_MULTIPLY =byte(0x55);
KEY_KEYPAD_SUBTRACT =byte(0x56);
KEY_KEYPAD_ADD
=byte(0x57);
KEY_KEYPAD_ENTER
=byte(0x58);
KEY_KEYPAD_1
=byte(0x59);
KEY_KEYPAD_2
=byte(0x5A);
KEY_KEYPAD_3
=byte(0x5B);
KEY_KEYPAD_4
=byte(0x5C);
KEY_KEYPAD_5
=byte(0x5D);
KEY_KEYPAD_6
=byte(0x5E);
KEY_KEYPAD_7
=byte(0x5F);
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 39 of 58
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
final byte
KEY_KEYPAD_8
=byte(0x60);
KEY_KEYPAD_9
=byte(0x61);
KEY_KEYPAD_0
=byte(0x62);
KEY_KEYPAD_DECIMAL
=byte(0x63);
KEY_EUROPE_2
=byte(0x64);
KEY_APPLICATION
=byte(0x65);
KEY_POWER
=byte(0x66);
KEY_KEYPAD_EQUAL
=byte(0x67);
KEY_F13
=byte(0x68);
KEY_F14
=byte(0x69);
KEY_F15
=byte(0x6A);
KEY_CONTROL_LEFT
=byte(0xE0);
KEY_SHIFT_LEFT
=byte(0xE1);
KEY_ALT_LEFT
=byte(0xE2);
KEY_GUI_LEFT
=byte(0xE3);
KEY_CONTROL_RIGHT
=byte(0xE4);
KEY_SHIFT_RIGHT
=byte(0xE5);
KEY_ALT_RIGHT
=byte(0xE6);
KEY_GUI_RIGHT
=byte(0xE7);
Here is the Arduino function we use to send a raw keyCo mmand. For example, if you want
to send the keystroke for the letter 'a' (no shift) you'll want to call
keyCommand(0, 4);
to press the keycode 4 ('a') followed by a release
keyCommand(0, 0);
if you want to send the keystroke for SHIFT 'a' you'll want to call
keyCommand(MODIFIER_SHIFT_LEFT, 4);
if you want to send the keystroke for CTRL-SHIFT 'a' you'll want to call
keyCommand(MODIFIER_SHIFT_LEFT | MODIFIER_CONTROL_LEFT, 4);
You can also send multiple keystrokes ('chords'). If you want to press 'a' and 'b' at the same
time, send
keyCommand(0, 4, 5);
for keycodes 4 and 5 at the same time. You can send up to 6 consecutive keys at once,
don't forget to send the release 'key up' command or the key will be 'stuck'!
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 40 of 58
void keyCommand(uint8_t modifiers, uint8_t keycode1, uint8_t keycode2 = 0, uint8_t keycode3 = 0,
uint8_t keycode4 = 0, uint8_t keycode5 = 0, uint8_t keycode6 = 0) {
BT.write(0xFD);
// our command
BT.write(modifiers); // modifier!
BT.write((byte)0x00); // 0x00
BT.write(keycode1); // key code #1
BT.write(keycode2); // key code #2
BT.write(keycode3); // key code #3
BT.write(keycode4); // key code #4
BT.write(keycode5); // key code #5
BT.write(keycode6); // key code #6
}
Raw HID Mouse Reports
As of v1.1 (shipping Oct 22, 2013) Bluefruit can also send raw HID Mouse reports. This allows
moving and clicking a virtual mouse! Mouse reports are relative movement. So you can
send 'go left 4 units' but you cant send 'go to absolute location x, y'
Raw HID reports start with 0xFD and have 8 bytes following. For mouse, its
0xFD 0x00 0x03 [butto ns] [left/right] [up/do wn] 0x0 0x0 0x0
For buttons, its a bitmask, left button (button 0) is 0x01 right button (button 1) is 0x02, etc
so that butto n n is (1 << n) you can | these together
up/down/left/right are again, relative movements. You can move up to +127 up/left to -127
down/right units at a time.
void mouseCommand(uint8_t buttons, uint8_t x, uint8_t y) {
BT.write(0xFD);
BT.write((byte)0x00);
BT.write((byte)0x03);
BT.write(buttons);
BT.write(x);
BT.write(y);
BT.write((byte)0x00);
BT.write((byte)0x00);
BT.write((byte)0x00);
}
For example if we wanted to click the left button and drag the mouse down 50 units send
mo useCo mmand(0x1, 0, -50);
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 41 of 58
Raw HID Consumer Reports
As of v1.2, Bluefruit can send raw HID consumer reports. There are "Home",
"KeyboardLayout", "Search", "Snapshot", "VolumeUp", "VolumeDown", "Play/Pause", "Fast
Forward", "Rewind","Scan Next Track", "Scan Previous Track", "Random Play","Stop" keys
you can use with a 2 bytes bitmask.
Raw HID consumer report start with 0xFD and have 8 bytes following. For consumer keys,
its
0xFD 0x00 0x02 [bitmask] [bitmask] 0x0 0x0 0x0 0x0
"Home" is bit 0, the bitmask is 0x01 0x00
"Stop" is bit 12, the bitmask is 0x00 0x10
You can | these together like mouse report
void consumerCommand(uint8_t mask0,uint8_t mask1) {
BT.write(0xFD);
BT.write((byte)0x00);
BT.write((byte)0x02);
BT.write(mask0);
BT.write(mask1);
BT.write((byte)0x00);
BT.write((byte)0x00);
BT.write((byte)0x00);
BT.write((byte)0x00);
}
For example if we wanted to click the Play/Pause
consumerCommand(0x40,0x00);
Then release it
consumerCommand(0x00,0x00);
Testing Sketch (Arduino)
We use this code to generate/test the various UART-sendable characters, you can use it for
reference to control via an Arduino or other microcontroller. Remember that some of these
non-printing characters can really confuse your computer so use with care!
// Adafruit test code for Bluefruit EZ-Key serial reports
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 42 of 58
// Uncomment tests as you wish, remember that this will
// send various keypresses to your computer which may really
// annoy it! We used
// http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes
// to test the non-printing characters!
// Connect the RX pin on the EZ-Key to digital #2 on the UNO
#include <SoftwareSerial.h>
SoftwareSerial BT = SoftwareSerial(3, 2);
void printabletest() {
Serial.println("Testing printable 0x20-0x7E...");
for (char c = 0x20; c <= 0x7E; c++) {
Serial.write(c);
BT.write(c);
delay(10);
}
BT.write('\n');
delay(3000);
Serial.read(); // eat one char
Serial.println();
for (uint16_t i=0; i<200; i++) {
while (Serial.available())
Serial.write(Serial.read());
delay(10);
}
}
void nonprinting() {
Serial.println("Insert");
BT.write(1); delay(1000);
Serial.println("Home");
BT.write(2); delay(1000);
Serial.println("Page Up");
BT.write(3); delay(1000);
Serial.println("Delete");
BT.write(4); delay(1000);
Serial.println("End");
BT.write(5); delay(1000);
Serial.println("Page Down");
BT.write(6); delay(1000);
Serial.println("Right Arrow");
BT.write(7); delay(1000);
Serial.println("Backspace");
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 43 of 58
Serial.println("Backspace");
BT.write(8); delay(1000);
Serial.println("Tab");
BT.write(9); delay(1000);
Serial.println("Enter");
BT.write(10); delay(1000);
Serial.println("Left Arrow");
BT.write(11); delay(1000);
Serial.println("Down Arrow");
BT.write(12); delay(1000);
Serial.println("Enter");
BT.write(13); delay(1000);
Serial.println("Up Arrow");
BT.write(14); delay(1000);
for (uint8_t i=15; i<27; i++) {
Serial.print("F"); Serial.println(i-14, DEC);
BT.write(i); delay(500);
}
Serial.println("ESC");
BT.write(27); delay(1000);
Serial.println("Capslock");
BT.write(28); delay(1000);
Serial.println("Scroll lock");
BT.write(29); delay(1000);
Serial.println("Break");
BT.write(30); delay(1000);
Serial.println("Numlock");
BT.write(31); delay(500);
}
void altkeystest() {
Serial.println("Left Control\n");
BT.write(0xE0);
delay(500);
Serial.println("Left Shift\n");
BT.write(0xE1);
delay(500);
Serial.println("Left Alt\n");
BT.write(0xE2);
delay(500);
Serial.println("Left GUI\n");
BT.write(0xE3);
delay(500);
Serial.println("Right Control\n");
BT.write(0xE4);
delay(500);
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 44 of 58
Serial.println("Right Shift\n");
BT.write(0xE5);
delay(500);
Serial.println("Right Alt\n");
BT.write(0xE6);
delay(500);
Serial.println("Right GUI\n");
BT.write(0xE7);
delay(500);
}
void iphonekeyboard() {
while (1) {
Serial.println("toggle keyboard");
BT.write(0x7F);
delay(1000);
}
}
void keyCommand(uint8_t modifiers, uint8_t keycode1, uint8_t keycode2 = 0, uint8_t keycode3 = 0,
uint8_t keycode4 = 0, uint8_t keycode5 = 0, uint8_t keycode6 = 0) {
BT.write(0xFD);
// our command
BT.write(modifiers); // modifier!
BT.write((byte)0x00); // 0x00
BT.write(keycode1); // key code #1
BT.write(keycode2); // key code #2
BT.write(keycode3); // key code #3
BT.write(keycode4); // key code #4
BT.write(keycode5); // key code #5
BT.write(keycode6); // key code #6
}
void rawkeytest() {
// test sending a single 'a' (keycode 4)
keyCommand(0, 4);
delay(100);
keyCommand(0, 0);
}
/************** Support added in v1.1 */
void rawmousetest() {
Serial.println("Move mouse!");
Serial.println("Right");
mouseCommand(0, -100, 0);
delay(200);
Serial.println("Down");
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 45 of 58
Serial.println("Down");
mouseCommand(0, 0, -100);
delay(200);
Serial.println("Left");
mouseCommand(0, 100, 0);
delay(200);
Serial.println("Up");
mouseCommand(0, 0, 100);
delay(200);
}
void mouseCommand(uint8_t buttons, uint8_t x, uint8_t y) {
BT.write(0xFD);
BT.write((byte)0x00);
BT.write((byte)0x03);
BT.write(buttons);
BT.write(x);
BT.write(y);
BT.write((byte)0x00);
BT.write((byte)0x00);
BT.write((byte)0x00);
}
/************** Support added in v1.1 */
void setup() {
Serial.begin(9600);
BT.begin(9600);
Serial.println("Softserial/BT test!\n\rPress any key+return to start");
while (! Serial.available());
printabletest(); delay(200);
//altkeystest();
//nonprinting();
//iphonekeyboard();
//rawkeytest();
//Supported in v1.1
//rawmousetest();
}
void loop() {
}
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 46 of 58
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 47 of 58
Remapping the Buttons (Serial)
If you have a Bluefruit v1.1 or later, you can wirelessly re-map the keys, no need to use
a console cable (altho the console cable technique will still work). Original v1.0
Bluefruits can only be remapped over serial console
The default buttons->keypresses will be satisfactory for most projects. However, you may
want to customize those keys so when GPIO #0 is pulled to ground, a different keystroke is
sent. It isn't that difficult to do! However, you will need an FTDI Friend (http://adafru.it/284) or
USB console cable (http://adafru.it/954) to connect the EZ-Key to your computer.
If using an FTDI friend, connect the TX pin of the EZ-Key to the RX pin on your FTDI friend and
the RX pin to the TX pin (receiver goes to transmit). Also be sure to power the EZ-Key. You
do not have to pair it for this remapping
You will have to put the EZ-Key into re-mapping mode. To do this, the pair-button must be
pressed while the module is powered up. The easiest way to do this is to disconnect the red
Vin wire from the console cable, press down on the button, then plug in the red wire, that's
it!
As a 'safety' procedure, every time you power the module with the re-pair button
pressed (to enter remapping mode) it will reload the default keymap. This is so if you
somehow really mess things up, you can always get back to the default keymap
without a console cable
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 48 of 58
Load Processing Sketch
We wrote the re-mapping software in Processing. Processing is cross-platform and easy to
install (http://adafru.it/e2C). Please download Processing v1.5.1 (http://adafru.it/cK1) since
that's known to work
You'll also need to download and install the ControlP5 library
Click to download the ControlP5
library
http://adafru.it/djs
Then click below to download the remap software
EZ-Key_Remapper.zip
http://adafru.it/cK2
Uncompress and open the remapper.pde in Processing. Plug in the USB console cable or
FTDI adapter. Select Sketch->Run menu item and look in the debug window below, you
should see Fo und Serial Po rts: and then a list of ports. On Windows, it will be something
like COM1, COM2, COM3 etc. On Mac/Linux it will be something like /dev/USBtty or
/dev/cu.usbserial
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 49 of 58
Copy and paste the list into a notepad, now File->Run it again, this time with the USB
console cable unplugged. The list should be one line shorter. In this case COM3 is missing.
That means that the cable name is COM3
in the line
myPort = new Serial(this, "COM3", 9600);
Change "COM3" to whatever the cable name is. Again, for Mac or Linux it will probably be
/dev/cu.so mething
Replug in the FTDI/Console cable.
Select File->Run again to start the script with the correct /dev or COM port
Now disconnect the red wire that is powering the EZ-Key, press and hold the Pair button on
the module and reconnect the red wire. You should see:
Adafruit Bluefruit HID 9/18/2013
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 50 of 58
Remap ready!
Appear in the bottom half of the screen. Now click that large gray square window to remap
You should see
OK
Set Mapping: 128
Indicating that the mapping was sent.
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 51 of 58
Customizing Keys
OK now you want to actually change the key report. Each of the 12 keys has a report. This is
an example for #0:
hid_keys.set_key_repo rt(0, MODIFIER_NONE, KEY_A, KEY_NONE, KEY_NONE,
KEY_NONE, KEY_NONE, KEY_NONE);
There are 8 'arguments' to each report:
The first one is the GPIO#, in this case its #0.
Second is the modifier keys, such as Shift, Control, Alt, etc. See hid_keys.pde for a list of
the modifier available. You can 'or' the modifiers. For example, if you want to press shift and
control modifiers at the same time, use MODIFIER_SHIFT_LEFT |
MODIFIER_CONTROL_LEFT
The last 6 are the 6 slots available for concurrent keys. You can have up to 6 key-codes
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 52 of 58
sent at once (handy for when you want to send complex key reports. Check hid_keys.pde
for the list of all the keycodes!
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 53 of 58
Remapping the Buttons (Wireless)
The default buttons->keypresses will be satisfactory for most projects. However, you may
want to customize those keys so when GPIO #0 is pulled to ground, a different keystroke is
sent. It isn't that difficult to do!
Bluefruit v1.1 (Oct 22, 2013 or later) supports over-the-air key remapping and also you
can map the pins to mouse movement or mouse clicks
Bluefruit v1.2 (Nov 7 2013 or later) - We have added support for mapping buttons to
some "Consumer Report" keys, also known as Multimedia buttons. You can use the
graphical remapper for the consumer keys.
Over-the-air remapping is suggested since there's no wiring required and you can do it at
any time. You just need to make sure the Bluefruit is paired to your computer. It's been
tested on Mac and Windows but should also work on Linux.
You'll need to install Processing v1.5.1 to run the remapper. (http://adafru.it/cQW)We
suggest 1.5.1, 2.0+ may not work. If v1.5 is giving you problems, though, try v2!
You will also need to download and install the ControlP5 library:
In Windows, you should use the 32-bit version of Processing!
Download the ControlP5 LIbrary
http://adafru.it/djs
Then download the zip with the wireless remapper code
GUI EZ-Key Remapper
12/20/2013
http://adafru.it/d2B
Uncompress and open the GUI_EZKey_remapper.pde in Processing.
Make sure the Bluefruit is paired to your computer, since we need to be paired in order to
send it the new keycodes
Select Sketch -> Run or click the play button to start the graphical remapper
You can now select the pins and then using the menus below select what
mouse/keyboard/consumer reports you want. Mouse reports can be X movement, Y
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 54 of 58
movement, wheel, and three different buttons in any combination. Keyboard reports can be
up to 6 keystroke commands, with modifiers, ascii-type, non-printing, etc. Consumer
reports are special commands, such as volume up, volume down, iPhone keyboard
display/hide and cannot be mixed or combined unlike mouse & Keyboard.
You can also save and load your keymap which is handy for trying out different mappings!
When you're done, click SEND_MAP to send it to your Bluefruit. In the main Processing
window you should see the text report indicate that it found a Bluefruit and also that it sent
data with a Checksum Match
"Text style" over-the-air remapper
The original remapper is a Processing sketch that requires editing the reports by hand. While
this is the most powerful, most people may be happier with the graphical remapper above.
Still, for more advanced users, you can edit the reports per button with more flexibility here.
HID_EZKey_remapper.zip
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 55 of 58
http://adafru.it/cQX
Uncompress and open the HID_EZKey_remapper.pde in Processing.
Make sure the Bluefruit is paired to your computer, since we need to be paired in order to
send it the new keycodes
Select Sketch -> Run or click the play button
You should see the text report indicate that it found a Bluefruit and also that it sent data with
a Checksum Match
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 56 of 58
That's it, you can use it immediately with the new keymap!
© Adafruit
Industries
https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetoothhid-keyboard
Page 57 of 58
FAQ
What is the current draw for Bluefruit?
Bluefruit requires ~3VDC, there's an onboard regulator for providing nice clean power. It
draws 25mA at all times while paired and an extra 2mA on average during transmission
When the module is in Reset mode (Reset tied low) it draws 2-3mA quiescent.
What is the latency ("fly time") for the 12 GPIO buttons?
For Bluefruit v1.0, latency is about 100-120ms. For v1.1 and later (October 22, 2013)
latency is 25-35ms. There is some 'jitter' in the latency but we find its not that noticeable.
Is it possible to firmware update Bluefruits?
There is no way to re-program or update Bluefruit modules internal firmware - the key
remapping is changing the EEPROM data, not the program storage.
How come the EZ-Key can be sluggish on Android?
There's some issues with Android 4.1 thru 4.4 that cause Bluetooth to act odd due to WiFi
interference. Try turning off WiFi to see if that helps. [check this post for
details! (http://adafru.it/djF)]
© Adafruit Industries
Last Updated: 2014-10-05 05:30:13 PM EDT
Page 58 of 58