ESP32-BLE-Keyboard
ESP32-BLE-Keyboard copied to clipboard
Android compatibility issues and observations with 0.3.2/0.3.0 version
Dear Sirs,
I have been working on BLE Keyboard for last one week. Following are observations:
-
In 0.3.0 verion, saved Bluetooth settings (in Windows or Android) does not reconnect on ESP32 reboot. We have to forget BLE and then pair again. This problem was eliminated in 0.3.2.
-
But in 0.3.2: Android versions did not work well for me. It "Connects" but BLE keyboard is not enabled as input device. And no data comes on Android. I checked on Lenovo Tablet (android 10) and one android phone. This issue was not present in 0.3.0
-
Gradually, I tried to undo changes in 0.3.2. Finally, with reverting Authentication code back to 0.3.0 the problem of (2) is eliminated: //pSecurity->setAuthenticationMode(ESP_LE_AUTH_REQ_SC_MITM_BOND); pSecurity->setAuthenticationMode(ESP_LE_AUTH_BOND);
I am not sure other bad impact of undoing this change.
- Still, there seems to be problem in Android 10 (Lenovo Tab): After first pairing, the BLE keyboard works well. It shows BLE keyboard as "Physical Keyboard" in conjunction with gboard in "Languages settings". And BLE keyboard data comes on Tablet inputs. But, after ESP32 reboot (or BT enable/disable), BLE keyboard is connected, but it does not take keyboard inputs. The keyboard icon is seen in Bluetooth settings. But it is not seen as "Physical Keyboard". This problem is not present in Android mobile phone. I believe this problem is related to specific version of Android 10 (which was latest available for given tablet).
On windows 11, connect-reconnect or ESP32 reboot - all works neatly!
-
Is there option to provide "PIN" for BLE Keyboard. In one of android Tablet version, the pairing failed as it said invalid PIN.
-
If I change the BLE Keyboard name (KEYBOARD1 to KEYBOARD2): Android and Windows picks up connection of KEYBOARD2 (if KEYBOARD1 was stored). I believe the pairing information stores MAC address or other BT address/credentials. And KEYBOARD1/2 are just names for user?
Thanks for wonderful library!
Best regards, Sunand Mittal
Thank you this post..
Since I am new to using Arduino, I tried updating the ZIP library 0.3.2 however, the Android problem was the same so I am not sure that I am updating the library file correctly.
Also, I do not find the ESP32-BLE-Keyboard listed within the library manager. So, being new, I cannot yet confirm what version I am using, I wanted to just remove it, then install it again.
Can you give me advice as to how I can update / confirm the version of ESP32-BLE-Keyboard I have installed?
Thank you this post..
Since I am new to using Arduino, I tried updating the ZIP library 0.3.2 however, the Android problem was the same so I am not sure that I am updating the library file correctly.
Also, I do not find the ESP32-BLE-Keyboard listed within the library manager. So, being new, I cannot yet confirm what version I am using, I wanted to just remove it, then install it again.
Can you give me advice as to how I can update / confirm the version of ESP32-BLE-Keyboard I have installed?
Typically, downloaded library of arduino are installed in directory (for windows): <My documents >\Arduino\libraries\ESP-BLE-Keyboard..
Version number present in file library.properties: name=ESP32 BLE Keyboard version=0.3.2
Is there a reason why it doesn't show up within the Arduino Library Manager? Can you see it within your Arduino library manager?
Note: I am using the ESP32-S3 module, not sure if that is my problem
I have tried the following: v0.3.2beta v0.3.1beta v0.3.0 Works on all operating systems except Android for some reason.
On the first Android phone I tested, it wouldn't remember the pairing After I tested v0.3.0, it now comes up already paired, but won't connect? I tested a new virgin Android phone Connects, no keyboard keystrokes detected
Hello!
I have the same problem. I use Android phones. After update to 0.3.2 beta I solved the reconnection problem but in some phones the keyboard keystrokes are not detected. It's very strange. It connects correctly and detects both are connected ( android phone and the esp32) but the keystrokes sent by esp32 are not interpreted in some Android phonea. How could I solve this issue?
Hello!
I have the same problem. I use Android phones. After update to 0.3.2 beta I solved the reconnection problem but in some phones the keyboard keystrokes are not detected. It's very strange. It connects correctly and detects both are connected ( android phone and the esp32) but the keystrokes sent by esp32 are not interpreted in some Android phonea. How could I solve this issue? Dear @makerbitter Try this change in 0.3.2. beta version code and see if behaviour improves in Android phone: //pSecurity->setAuthenticationMode(ESP_LE_AUTH_REQ_SC_MITM_BOND); pSecurity->setAuthenticationMode(ESP_LE_AUTH_BOND);
Good News !!!
I am not sure exactly what I did differently, however, I removed the ESP32-BLE-Keyboard library, then closed Arduino, then opened Arduino, and installed the library v0.3.0 and I was able to connect to Android and see keyboard data.
I also made sure to UNPAIR the Android device before trying to test. Finally, I changed the name used to identify the BLE Keyboard with each test.
Not sure why it is working, I attached a text file that includes my basic test. Once connected, run "Serial Monitor" After connecting to Android, run a text window on the Android A Blue LED will blink when NOT connected and go SOLID BLUE when connected.
Within the "Serial Terminal" Type "@BK" and ADD any text you want to send to Bluetooth "@BK" is my serial inline command, the program only responds to commands Example: Type into Serial Monitor "@BKHello World!!!" The "@BK" is accepted and stripped off, the rest of the string is sent out to the serial monitor and as BLE Keyboard data.
Please let me know if this works, version v0.3.0, make sure to REMOVE the library, close and open Arduino then install v0.3.0
Hello Sunand Mittal,
You mentioned that you changed the "Authentication code"? So, you are using release v0.3.2 and changed this "Authentication Code?
Gradually, I tried to undo changes in 0.3.2. Finally, with reverting Authentication code back to 0.3.0 the problem of (2) is eliminated: //pSecurity->setAuthenticationMode(ESP_LE_AUTH_REQ_SC_MITM_BOND); pSecurity->setAuthenticationMode(ESP_LE_AUTH_BOND);
I am running release v0.3.0 because it works on Android, and Apple iOS very well, but now it will not re-connect on Windows 8 or Windows 10 when I cycle reset the ESP32 module.
I really need to get a version working with all (3) major operating systems.
Should I use release v0.3.2 and change the "Authentication Code"? Where is that ? What filename?
Hello! I have the same problem. I use Android phones. After update to 0.3.2 beta I solved the reconnection problem but in some phones the keyboard keystrokes are not detected. It's very strange. It connects correctly and detects both are connected ( android phone and the esp32) but the keystrokes sent by esp32 are not interpreted in some Android phonea. How could I solve this issue? Dear @makerbitter Try this change in 0.3.2. beta version code and see if behaviour improves in Android phone: //pSecurity->setAuthenticationMode(ESP_LE_AUTH_REQ_SC_MITM_BOND); pSecurity->setAuthenticationMode(ESP_LE_AUTH_BOND);
I tried and work but I need active nimBLE option. When nimBLE is activated connect and reconnect but no data comes on Android, so I have the same problem 2. How could I solve this with the nimBLE option? Thank you!
I use 0.2.3 which works with android 10 on a nvidia shield, most of the time. Every so often it decides to stop sending keystrokes. It is still connected but for some reason decides to not send anything.
So I guess there is an underlying issue that will most likely raise its head again even if just sporadically, like in my case.
Is there a way to give it a periodic restart/reset without causing other issues???
I had many issues while reconnecting because the MAC of the device was stored somewhere, and changing the name confused the BLE stack of my device : esp_base_mac_addr_set(base_mac_addr) can do this It now works fine with Windows 11, but I can't pair with my Android phone using the .32 version with the paring mode change proposed above. It worked with the same phone but a regular ESP32, but I can't connect an ESP32-C3 device - even if a clear the Bluetooth cache on the Android device....