nkolban / esp32-snippets

Sample ESP32 snippets and code fragments
https://leanpub.com/kolban-ESP32
Apache License 2.0
2.37k stars 710 forks source link

BLE Windows disconnects every 35 seconds #1096

Closed e-protocol closed 2 years ago

e-protocol commented 3 years ago

Hello. When I connect to ESP32 via BLE(bluetooth low energy) in Windows 10, it disconnects after 35 seconds. But when I connect to the same device via android - no disconnection happens. I already tried setting: setMinPreferred(0x06); setMaxPreferred(0x12);

chegewara commented 3 years ago

1) you didnt provide any logs 2) if it works with android and fail with windows, dont you think it is windows or your app issue? 3) usually when disconnection happen after 30 seconds it means it is secured connection and some peer device didnt send pin or didnt confirm/accept connection

e-protocol commented 3 years ago

Thanks for fast reply. Let me give additional information: 1) is it really so necessary? Because I agree with your third paragraph 2) not windows, nor my app, I've tested with BLE modules like HM10, and there are no disconnections at all with same Arduino sketches. It only appeares on ESP32 3) But, I don't use pin confirmation to establish connection. Should I reconfirm no pin connection every 30 seconds? How to do that? Or how to directly disable secure connection?

thomasimajinedev commented 2 years ago

Hello @e-protocol, I'm having similar issues with ECP32-WROOM-32E , BLE connects to the device and after a few seconds auto-disconnect it. It's always like 30 seconds. Did you solve the issue? If you did the solution maybe can be useful for me.

Thanks in advance!! Thomas.

e-protocol commented 2 years ago

Hello @e-protocol, I'm having similar issues with ECP32-WROOM-32E , BLE connects to the device and after a few seconds auto-disconnect it. It's always like 30 seconds. Did you solve the issue? If you did the solution maybe can be useful for me.

Thanks in advance!! Thomas.

Hello @thomasimajinedev. I've solved this issue. Here is what I've done:

1) In my project on Qt I used this source code https://github.com/kdewald/nativeble Because with some of my BLE boards original Qt BLE doesn't work. 2) I've changed my BLE adapter. As far as I know different adapters use a little bit different frequencies and versions of built in communication algorithms. So it's very dependened from manufacturer. Just try different ones. I.e. on the picture below the left one works exactly as an issue described, but the right one works with no dropout at all for ESP-WROOM32. It's a little chance, but your esp can be defected also.

ble_adapters