Connecting to a Bluetooth Keyboard with a esp32 as Master using Bluetooth Classic

I'm trying to connect a keyboard (link my reply below) with Bluetooth Classic 3.0 to an esp32. I want the esp32 to be the master that actively connects to the keyboard as a slave. The goal is to be able to use the keyboard to send key inputs to serial.

I have ran the bt_classic_device_discover example. The dump from looks like:

16:01:25.402 -> Starting discover... 
16:01:35.397 -> >> Dump scan results:     
16:01:35.397 -> - 1: Name: Bluetooth 3.0 Keyboard, Address: 20:20:01:3d:3f:95, cod: 9536, rssi: -83    
16:01:35.397 -> -- Dump finished -

I tried using the SerialToSerialBTM example but it never successfully connects to the keyboard.

I set the esp32 to master with SerialBT.begin("ESP32", true); set the address like uint8_t address[] = {0x20, 0x20, 0x01, 0x3D, 0x3F, 0x95}; and then attempted to connect connected = SerialBT.connect(address); but it always fails.

I have done a lot of Google searching and tried quite a few things. I have tried setting the PIN with the common values (0000, 1111, 1234). I can successfully connect to the keyboard using my Android phone. I can also successfully connect to the esp32 with my Android phone. There is no prompt to enter a PIN when pairing the keyboard to my phone.

I have tried downgrading to 1.0.2 as was suggested in this git issue (link in my reply below) but still no success.

Does anyone have any experience or advice for connecting a device to an esp32 where the esp32 is running as master?

Would I have more success trying to do this using ESP-IDF or BTStack?

Thank you very much for anyone who takes the time to try and help.

edit: Just now I found an app that will make my Android phone go into "slave" mode and I was able to connect to it via mac address with the SerialToSerialBTM example and I sent data from the Arduino IDE serial monitor to the phone app.

Link to the keyboard
Link to the github issue

Since I'm a new account I wasn't allowed to have more than 2 links so I had to break it up here...

Any luck with this project? I'm trying to connect the Adafruit mini Bluetooth Keyboard to an ESP32. Scanner works well, but SerialToSerialBTM does not.

I am trying to do the same. Would love to see a working example.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.