NanoKeys: BLE Nano HID Keyboard


What’s the absolute easiest way to send information from a wireless device to a mobile, tablet or computer?  By making it look like a regular keyboard!

By leveraging all the work that’s gone into the standard HID specification, you can get data from an embedded device to a mobile without needing to code anything: no protocols to develop, no app to create, nothing to install and no learning curve for users.

NanoKeys Library

The NanoKeys library allows you to very easily setup a BLE Nano as a bluetooth low energy HID keyboard.  With only a few lines of code, you will be able to transmit text from your own device to any paired mobile phone or tablet.

Here’s a quick demo that shows the entire process, from pairing to reception, and also includes a quick walk-through of the small amount of code you need to enable the functionality on your own device.

(Note that since that video was made, the throughput of the library has been greatly increased as show in this video)


To use the library you’ll need

And that’s it!


Once it’s setup, you’ll have a NanoKeys::Keyboard object to play with.  This is used the same way as when writing to a Serial device, by implementing the standard Arduino Print interface, so any print()/println() call that works for Serial will work with the keyboard.

More detailed usage/API will be published soon, but for the moment most everything you need can be found in the included example.


The NanoKeys library implements everything required by the GATT HID specification.  That means that, in addition to actually sending key codes, it provides the device information and battery services.  At this time, the battery service is just a stub, meaning that it just responds that the battery is at full capacity (i.e. it totally lies).

Also, the library only emits key codes for standard ASCII—meaning your calls to print() will only actually emit keystrokes when the values passed are between 0 and 127.
If you can extend this functionality to make it more flexible or useful, contributions are welcome.  If you need help doing so, consulting is available.


The library source is available under the terms of the GNU LGPL.

Get the latest version of the NanoKeys library.

In the Arduino IDE, go to

    Sketch -> Include Library -> Add .ZIP library...

and select the zip file.  You should be done.

To try it out, head to

    File -> Examples -> NanoKeys -> autokeys

Select a suitable BLE Nano board and compile/install as usual.