Raspberry Pi 3B+ Maximum BLE Connections #RaspberryPi
(この記事には日本語版があります)
When I tested the limits of BLE connections a Raspberry Pi 3B+ can hold at a time as a BLE central (Number of BLE peripherals that can remain connected at the same time), I found that the limit was about 9, and only about 7 seemed to be stable enough to use. The details of the test are described below.
Test procedure
- Turn on a certain number of BLE peripherals and start advertising them in a connectable state.
- Then let a BLE Central start scanning. Verify that all BLE peripherals have established a connection and begin receiving notifications within a minute of the start of the scan
Since it is impractical to take too long to establish a connection, so I set a time limit of one minute.
Test environment
BLE central(Raspberry Pi 3B+)
- Hardware revision: Rev 1.3
- OS version: Raspbian Stretch
- The test application is implemented in Node.js(v8.11.1),
- BLE library: noble(1.9.1)
- a BlueZ wrapper for Node.js.
- BlueZ version: 5.43-2+rpt2+deb9u2
- a BlueZ wrapper for Node.js.
- The test program will continue to scan until all devices which are specified at the program startup are connected
BLE peripheral(ESP32 DevKitC)
- After the power is turned on, it starts advertising in a connectable state, and after the connection is established, it continues to send a notification to the central at regular intervals.
- BLE library: ESP32_BLE_Arduino(0.4.16)
Test result
The number of BLE peripherals that have attempted to connect simultaneously | Result |
---|---|
6 | 5 out of 5 successful (log) |
7 | 5 out of 5 successful (log) |
8 | 5 out of 5 successful, but took a little bit time before a connection to the eighth peripheral had established. (log) |
9 | 1 out of 5 successful, Up to 8 connections complete, time expires before 9th connection is established (log) |
10 | 0 out of 5 successful, "Connection Rejected due to Limited Resources (0xd)" errors begin to occur. (log) |
Conclusion
When I tested the limits of BLE connections a Raspberry Pi 3B+ can hold at a time as a BLE central (Number of BLE peripherals that can remain connected at the same time), I found that the limit was about 9, and only about 7 seemed to be stable enough to use. At Developers.IO Cafe, one ESP32 is connected to one weight sensor, and the weight data is sent to a Raspberry pie via BLE. However, we limit the number of ESP32s to connect to a Raspberry pi to six for conservative.