Still no USB keyboard support?

Good evening!
Years ago I built a system for a company. The device needed the user to type information on a keyboard, so instead of using a specific keyboard, I chose a computer Keybard. I had to select a PS/2 keyboard cause that's the only one supported by Arduino libraries.

My client is complainig that they are running out of PS/2 keyboards that are gettign harder to find , and also they have a specific waterproof model of keyboard that they are using at other places at the facility, and they would like to use it with my device too, but it's USB, not PS/2

I'm coming back to check whether things have changed these years but I find that it looks like there's still no support for USB keyboards for Arduino.

Or has anyone ever found one? I've seen tutorials for using USB keyboard but when you check more detailed information you realize that they are talking about specific USB models that were providing both PS/2&USB signals at the connector, so not every USB KB on the market would work with this

Thank you!

Several Arduino boards have USB host support. A USBHost library comes bundled with the Arduino SAMD Boards platform of the MKR boards, Nano 33 IoT, and Zero boards. Here you can see the "KeyboardController" example sketch:

It mentions "Arduino Due board", but I think this is only a copy/paste error because the library is ported from the library of the same name that was created for the SAM architecture of the Due:

I see there's also a USB host library for the Arduino Portenta H7 board:

I'm sure there are additional libraries for third party Arduino boards. For example, I see this for Teensy:
https://www.pjrc.com/teensy/td_libs_USBHostShield.html

I also know there are USB host shields to add this capability to the classic Uno/Mega/Leonardo boards.

I don't have any experience with USB host on Arduino. Perhaps someone else here will

you could check if the preferred usb keyboard doesn't work with a simple usb to ps2 adapter for keyboards. it looks like many usb keyboard controllers support it

I tried the PS/2 adapter approach with the six random keyboards and tenkeys (everything from the cheapest no-name junk to high end mechanical switch models) I had on hand and the only one that didn't work was the ~$1 tenkey I bought on eBay.

pert:
I tried the PS/2 adapter approach with the six random keyboards and tenkeys (everything from the cheapest no-name junk to high end mechanical switch models) I had on hand and the only one that didn't work was the ~$1 tenkey I bought on eBay.

Ok, for some reason I thought the chances of getting one that DOES provide internal PS/2 protocol over USB was minimal, I will ask this guy to test his keyboard with an adaptor and see what happens
Thanks for the tip!!

pert:
Several Arduino boards have USB host support. A USBHost library comes bundled with the Arduino SAMD Boards platform of the MKR boards, Nano 33 IoT, and Zero boards.
....
I also know there are USB host shields to add this capability to the classic Uno/Mega/Leonardo boards.

...

Ok, in my case my current setup is using a Wemos D1 R2 board (ESP8266 based). For what I know this chip doesn't have real hw USB support. I found really chip USB adapter boards (MAX3421E based) that could work for me but it looks like they use 4 digital pins to the microcontroler, I these wemos boards are really short on usable D pins, so Im not sure if I would be able to get free pins for this.
I will check this out, thank you!

edugimeno:
Ok, for some reason I thought the chances of getting one that DOES provide internal PS/2 protocol over USB was minimal, I will ask this guy to test his keyboard with an adaptor and see what happens

I was under the very same impression. I was very surprised to get these results.

USB is really complex (at least for me), so it's really cool that it's possible to interface modern input devices with even a simple AVR microcontroller using such a simple circuit and code.

pert:
USB is really complex (at least for me), so it’s really cool that it’s possible to interface modern input devices with even a simple AVR microcontroller using such a simple circuit and code.

Yes same here. I truly needed a real computer keyboard to worki with my device so being able to just plug one in and have all the capabilities of a full KB with a simple library was great.
Well to be honest this library didn’t work “out of the box” in a 8266 device, so I had to deal with it for days until I found some changes to make it work with these devices. I uploaded the changes to the library’s github and they were then applied to the main library (which I’m proud of :slight_smile: )
Next week I will get feedback from this company about whether their waterproof USB KB works with a PS/2 adapter or not