ESP32 Bluetooth Scan Sensitivity

BeepBorp
Posts: 3
Joined: Tue Aug 08, 2023 8:01 pm

ESP32 Bluetooth Scan Sensitivity

Postby BeepBorp » Tue Aug 08, 2023 8:54 pm

Hi All,

Problem summary: ESP32 with external antenna connected via i-pex not picking up bluetooth advertisements nearly as reliably as Raspberry pi with usb bluetooth dongle.

I'm working on a project to extract data from the bluetooth advertisements of a specific device. I'm using an ESP32-WROOM-32U which is based on ESP32-DevKitC. The board has an i-pex connector that I have connected to an omnidirectional 2.4ghz antenna. I am able to pick up bluetooth advertisements, but have noticed that the ESP32 is not picking them up as reliably as a simple USB bluetooth dongle on an RPI. I've tried fiddling with the scan interval and window. I've tried turning on active scan. Nothing seems to allow my project to pick up the advertisements at the same distance or level of interference that the RPi seems to be able to with a bluetooth dongle.

I'm at a loss for what to do next except try different antennas and maybe a different board. If anyone can provide advice on how I could improve the performance, I would really appreciate it.

Pictures attached
Attachments
esp32_ble.jpg
esp32_ble.jpg (819.2 KiB) Viewed 1301 times
esp32_ble (2).jpg
esp32_ble (2).jpg (693.53 KiB) Viewed 1301 times

ESP_zhanghaipeng
Posts: 38
Joined: Thu May 04, 2023 3:49 am

Re: ESP32 Bluetooth Scan Sensitivity

Postby ESP_zhanghaipeng » Wed Aug 09, 2023 6:52 am

Are you using classic Bluetooth or BLE?
What criteria are you using to evaluate scan performance?

If you want better performance, if you use BLE, you can adjust the scan parameters using the API "esp_ble_gap_set_scan_params." Specifically, consider the following two aspects:

1-Set the scan_interval and scan_window to the same value.
2-You can set scan_interval to be slightly larger, for example: 0x0050.

BeepBorp
Posts: 3
Joined: Tue Aug 08, 2023 8:01 pm

Re: ESP32 Bluetooth Scan Sensitivity

Postby BeepBorp » Wed Aug 09, 2023 1:04 pm

Thanks for helping me out!

I'm using BLE. As for performance evaluation, there are a couple of scenarios:
  1. The advertising device in question is located in a refrigerator with metal sides and glass door. The device advertises every 20 seconds. The esp32 and RPI are located in a metal weatherproof box 18 feet from the advertising device. In this scenario the RPI's bt dongle will pick up about 12 out of 15 advertisements in a 5 minute period, while the ESP32 setup will pick up 0 advertisements from the device in the same time period.
  2. The advertising device is in a refrigerator still, but the ESP32 and RPI are on a shelf 8 feet away with two refrigerators between it and the advertising device. There are two refrigerators directly between the ESP32 and the advertising device. In this scenario the RPI's bt dongle will pick up about 8 out of 15 advertisements in a 5 minute period, while the ESP32 will pick up 2 out of 15 in the same period.
As of now I have the interval at 100 milliseconds and window at 99 milliseconds. I will try it with window at 100 milliseconds and see if that helps.

BeepBorp
Posts: 3
Joined: Tue Aug 08, 2023 8:01 pm

Re: ESP32 Bluetooth Scan Sensitivity

Postby BeepBorp » Thu Aug 10, 2023 1:53 am

ESP_zhanghaipeng wrote:
Wed Aug 09, 2023 6:52 am
Are you using classic Bluetooth or BLE?
What criteria are you using to evaluate scan performance?
I'm using BLE.
The criteria I'm using is that there's a temperature sensor that advertises once every 20 seconds. This temperature sensor is located inside of a refrigerator. In one scenario, the ESP32 does not pick up any advertisements, while a Raspberry Pi's bluetooth usb is able to pick up 12/15 transmissions in a 5 minute period. In another scenario, the ESP32 only picks up 2/15 transmissions while the Raspberry Pi picks up 8/15 transmissions.

I have the Interval at 100 milliseconds and window at 99 milliseconds right now. I'll try setting the window to 100 milliseconds.
Thanks for your help!

ESP_zhanghaipeng
Posts: 38
Joined: Thu May 04, 2023 3:49 am

Re: ESP32 Bluetooth Scan Sensitivity

Postby ESP_zhanghaipeng » Mon Aug 14, 2023 4:21 am

You can also try the following methods:

1-Avoid Enabling Duplicate Scanning:

Do not enable duplicate scanning (BLE_SCAN_DUPLICATE_DISABLE in esp_ble_gap_start_advertising in esp_ble_gap_set_scan_params), as this could automatically filter out identical broadcast packets within a specific time frame.

2-Select Broadcast Type: If you are solely utilizing broadcasting and do not require a connection, you can set the broadcast type to non-connectable and non-scannable (ADV_TYPE_NONCONN_IND in esp_ble_gap_start_advertising).

Who is online

Users browsing this forum: No registered users and 57 guests