working on a project which involes esp32 works as an Audio source, connects to Bluetooth

Hello everyone, I'm working on a project which involes esp32 works as an Audio source, connects to Bluetooth (bt) headset/speaker. The requirement is that, esp32 first scans and pairs to bt headset then transfers the audio source. After that, it will need to automatically reconnect to headset in either ways: - esp power reset - headset power reset - headset is put into the case, close the lid and then open the lid and take it out to the ears - ... The idea for reconnection is that, after pairing and the headset is in the bonded list, I use esp_bt_gap_set_scan_mode and set to connectable and discoverable My code is working fine with various of manufacturers such as Samsung, Sony, Realme, Google Pods. It auto reconnects to headset successfully in any situations listed above. Except Airpods Pro, It only gets connected first time in pairing mode. After that, rarely it gets reconnected and mostly nothing happens. At first I thought the airpods auto connects to other Apple's devices, so I did the factory reset on Airpods to remove all paired devices. However, it does not solve the issue. To reconnect, I need to put the Airpods to pairing mode and scan again. This is a stand-alone source code to reproduce the issue as below: https://github.com/tanmanh0707/esp32-bt-source I have 2 questions: 1. What is the reconnection mechanism? Wheather headset/client finds and initiates the reconnection to the source (esp) OR the source needs to initiate the reconnection? 2. Does anyone test esp32 bluetooth source with Airpod Pro before? And do you encounter this issue?
GitHub
GitHub - tanmanh0707/esp32-bt-source
Contribute to tanmanh0707/esp32-bt-source development by creating an account on GitHub.
6 Replies
electro_coco
electro_coco6mo ago
Iphone Bluetooth has some security issue with other Bluetooth devices i heard about it Maybe you can check that out
Muhammad Hamza
Muhammad Hamza6mo ago
But why does it work perfectly fine when connected for the 1st time, the issue appears only when to connect again after disconnecting.
electro_coco
electro_coco6mo ago
I don't know its pairing is different than other ble or Bluetooth devices Maybe reconnection is rejected due to security of device if your air pods are genuine then i believe they are the culprit and not your code Because every other device seems to do fine try with some Chinese headsets as well
Muhammad Hamza
Muhammad Hamza6mo ago
Yeah its airpod pro and it works after resetting the pros so it seems to me issue is more likely to airpods side. So can we call it a limitation for esp32 or its doable somehow, as i tried to find study material related airpods and how their Bluetooth works and etc but i found nothing useful in that regard
electro_coco
electro_coco6mo ago
I once read a LinkedIn post of a guy who was trying to get wifi creds setup using ble and iphone kind of gave him lots of trouble turned out apple has different approach to ble and Bluetooth than convention Thats why i know that air pods are doing the same thing to your code as well
Muhammad Hamza
Muhammad Hamza6mo ago
Thank you so much ill contact him
Want results from more Discord servers?
Add your server