Documentation on HIDKeyboard

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
grantbt
 
Posts: 35
Joined: Mon Dec 10, 2018 7:45 pm

Re: Documentation on HIDKeyboard

Post by grantbt »

There is a report elsewhere on this forum that v0.7.7 works OK, whereas v0.8.0 has the no-reconnect issue. I have some people testing it now and will report back on whether or not this module is really usable in multiple environments.

I still have reservations about the slow speed, the weak UART implementation and lack of F13-F24 keys.

User avatar
bbx10node
 
Posts: 148
Joined: Sun Feb 22, 2015 4:14 pm

Re: Documentation on HIDKeyboard

Post by bbx10node »

I am using a Bluefruit LE UART Friend with a CP2104 break out board. This combo has CTS and RTS connected for hardware flow control. This is important because the UART speed is running at 115200 (AT+BAUDRATE=115200). This helps reduce the delays caused by the long AT keyboard commands.

The BF is plugged into a Linux computer and is driven by a Python program. The program opens a pygame window to capture key up/down events and send AT+BLEKEYBOARDCODE commands to the BF. This works so far with an iPad.

Even after powering the BF off and back on, it auto reconnects to the iPad. The baudrate is retained across power cycles.

User avatar
grantbt
 
Posts: 35
Joined: Mon Dec 10, 2018 7:45 pm

Re: Documentation on HIDKeyboard

Post by grantbt »

What version of firmware is in your module(s)? I've thought of moving to 115200, but with the problems I was experiencing I expected the basic plumbing to get worse. That needs to be solid before I can tackle the slow speed.

User avatar
bbx10node
 
Posts: 148
Joined: Sun Feb 22, 2015 4:14 pm

Re: Documentation on HIDKeyboard

Post by bbx10node »

The version is 0.8.0.

User avatar
bbx10node
 
Posts: 148
Joined: Sun Feb 22, 2015 4:14 pm

Re: Documentation on HIDKeyboard

Post by bbx10node »

Python3 key up/down to BLE HID keyboard. CP2104 + Bluefruit Friend UART running at 115200 with CTS/RTS hardware flow control.

https://BANNED.com/p9Bqn4vd

User avatar
willwade
 
Posts: 50
Joined: Sat Dec 01, 2018 3:04 pm

Re: Documentation on HIDKeyboard

Post by willwade »

Interesting. Thanks for that. I’m going to order one of these - it seems cp2104 is already on board: https://shop.pimoroni.com/products/adaf ... escription - I’m going to try and follow your lead here (thanks for the code. Neat!)

User avatar
grantbt
 
Posts: 35
Joined: Mon Dec 10, 2018 7:45 pm

Re: Documentation on HIDKeyboard

Post by grantbt »

bbx10node wrote: Even after powering the BF off and back on, it auto reconnects to the iPad. The baudrate is retained across power cycles.
So, just to be clear, the Linux Box + Bluefruit LE Friend dongle looks like a keyboard to a remote iPad? Is that your situation?

User avatar
bbx10node
 
Posts: 148
Joined: Sun Feb 22, 2015 4:14 pm

Re: Documentation on HIDKeyboard

Post by bbx10node »

@willwade That board looks better than the separate boards. No soldering and cheaper!

@grantbt Take a look at the link to get an idea of what the target is. The Linux + keyboard development system is used to evaluate the Bluefruit Friend running at 115200 but it is not the target. There are assistive tech input methods that do not use physical keyboards but generate key up/down events.

https://haroldpimentel.BANNED.com/20 ... h-arduino/

User avatar
grantbt
 
Posts: 35
Joined: Mon Dec 10, 2018 7:45 pm

Re: Documentation on HIDKeyboard

Post by grantbt »

bbx10node wrote:@grantbt Take a look at the link to get an idea of what the target is. The Linux + keyboard development system is used to evaluate the Bluefruit Friend running at 115200 but it is not the target. There are assistive tech input methods that do not use physical keyboards but generate key up/down events.
OK, looks interesting. Just be sure to test on whatever devices+OS (tablet, phone, PC) you hope to use in the end. I've found surprises and disappointments (mostly on the PC side).

User avatar
bbx10node
 
Posts: 148
Joined: Sun Feb 22, 2015 4:14 pm

Re: Documentation on HIDKeyboard

Post by bbx10node »

I ran BLE HID keyboard examples on a Adafruit Feather nRF52840. It reconnects after power cycling to my Android phone, iPad, and Win 10 computer without re-pairing. Auto connect works better than the BF Friend. Of course, there are lots of versions of Android, Windows, and IOS so these are just three data points.

The coding is very different (no AT commands) but there are examples.

User avatar
grantbt
 
Posts: 35
Joined: Mon Dec 10, 2018 7:45 pm

Re: Documentation on HIDKeyboard

Post by grantbt »

Thanks, that's refreshing to hear. It seems like a pretty different beast to the nRF51822 based LE UART.

I'll have to see if there is an equivalent to the Adafruit Feather nRF528xx with an interface that a micro can use to control it (UART would be great) and minimum extra hardware for price saving. I'm basically looking for a "slave" device to my micro that allows me to create a full-featured BLE HID keyboard or generic/raw BLE HID device.

User avatar
willwade
 
Posts: 50
Joined: Sat Dec 01, 2018 3:04 pm

Re: Documentation on HIDKeyboard

Post by willwade »

Wow. @bbx10node you are a hero. This works! AMAZING! Amazing that there is no arduino/soldering/arduino code needed with the v3 of that module. Awesome

User avatar
bbx10node
 
Posts: 148
Joined: Sun Feb 22, 2015 4:14 pm

Re: Documentation on HIDKeyboard

Post by bbx10node »

@willwade I'm glad to hear it works.

I found the nRF52840 Feather does a better job at reconnecting after a power cycle on Win10 so I created a small sketch that implements the AT+BLEKEYBOARDCODE command. This makes the 840 work with the Python program even though the 840 does not understand any other AT command.

Updated ble_uart.py to include support for the 840. https://BANNED.com/cSxPmvap

AT command sketch for the 840. https://BANNED.com/Ddb3QXN1

User avatar
willwade
 
Posts: 50
Joined: Sat Dec 01, 2018 3:04 pm

Re: Documentation on HIDKeyboard

Post by willwade »

@bbx10node - I need to jointly work on this app. Mind if I put it in Github? Happy for me to reference you?! :)

User avatar
bbx10node
 
Posts: 148
Joined: Sun Feb 22, 2015 4:14 pm

Re: Documentation on HIDKeyboard

Post by bbx10node »

@willwade Feel free to do whatever you want with the code. Much of it comes from examples so it is not all my code.

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

Return to “Wireless: WiFi and Bluetooth”