Why is arduino nano usable as USB keyboard controller?

Hey, just a genuine question - on the library keyboard.h, there is for some reason listed combability with arduino nano, but everybody is saying that atmega328 can't itself work as keyboard manager. I don't have an arduino nano home right now, but i have arduino UNO with which it is 100% not working, atleast for me. So, like isn't arduino nano just a smaller version of arduino UNO? Or am I wrong?

Hi @rekosk.

The library reference pages like https://www.arduino.cc/reference/en/libraries/keyboard/ are automatically generated for all the libraries in the Arduino Library Manager based on the information in their library.properties metadata file.

The "Compatibility" list on the reference pages is based on the architectures field of that file. The reference page generator simply adds all the official boards of each architecture in the field to the list. This is why official boards like the classic Nano and UNO R3 are included in the "Compatibility" list on the "Keyboard" library's page, even though they are absolutely not compatible with the library.

As in this case, a library might require capabilities that are not provided by all boards of that architecture. Currently, there isn't any machine readable data that would allow the generator to understand this so boards that are incompatible with the library may be listed in the reference page.

This problem is tracked by the Arduino website developers here:

The developers are already working on adding the capability to define compatibility at a board-level granularity:

If you have a GitHub account, you can subscribe to that issue to get notifications of any new developments related to this subject.


:exclamation: Please only comment on the GitHub issue thread if you have new technical information that will assist with the resolution. General discussion and support requests are always welcome here on the Arduino Forum.


That is correct.

Note that there are more modern boards in the Nano form factor which are compatible with the library. The Nano 33 IoT is a nice board that does have the native USB capability that will allow it to be used with the Keyboard library.

You can also do keyboard emulation with the Nano ESP32, but that is done using a different library than Keyboard.

2 Likes

Remember that NANO is a form factor used with several different processors with vastly different capabilities. This can be a problem when posters say "I have a NANO" without telling us which one. (Why yes, this is a pet peeve of mine.)

3 Likes

Thanks for fast reply. I understand it now.

1 Like

If you really want something small that supports HID, you can buy the Arduino nano ESP32. It does all of it, I think even trough Bluetooth.

1 Like

You're not the only one :wink:

2 Likes