NimBLE-Arduino icon indicating copy to clipboard operation
NimBLE-Arduino copied to clipboard

How to achieve long-distance connection communication?

Open Blue186 opened this issue 1 year ago • 3 comments

Hello, what should I do to extend the Bluetooth connection distance? In terms of software, I set the maximum gain NimBLEDevice::setPower(ESP_PWR_LVL_P9); /** +9db */ but the distance is only about 8m, so the connection is unstable, but my Bluetooth antenna can support a connection distance of about 100m. (Using the ESP32 BLE basic library); Are there any other parameter settings that can achieve stable long-distance connections?

Blue186 avatar Apr 25 '24 04:04 Blue186

Are you saying that with the bluedroid library you get more distance than with NimBLE? I don't know how that could be but please test and confirm so I can look at it. FWIW I get well over 30m with my esp32's at 9dbm.

h2zero avatar Apr 25 '24 23:04 h2zero

Thanks for answering my question, It should be that my other configuration parameters were not done well. I found that by adjusting the parameters of pClient->updateConnParams();, I can adjust the connection distance, and finally successfully achieved a 100-meter connection. image At the same time, in addition to the updateConnParams function on the client, the server also has it. What configurations should I make on the client and server to achieve a stable and efficient connection between the client and the server? The main ones are connection distance and data delay.

Blue186 avatar Apr 26 '24 01:04 Blue186

That makes sense, you should be loose with the timeout for distance, latency also if you're inclined. The min max interval being a factor of 15ms is recommended by Apple but there is no reason to follow that other than connecting with Apple devices that I can fathom. Trial and error here will be required to maximize if that's the goal.

h2zero avatar Apr 26 '24 02:04 h2zero