In personal project of mine I'm looking to have a system where a number peripherals need to have provided to them, in as real-time as possible, small (~50 bytes max) amounts of information from a central controller. I was considering using low power Bluetooth for this and I'm wondering what kind of performance I could expect. How many times per second could I send this 'packet' of data if there was only one peripheral? What about if the number increases to, say, ten?
1 Answer
You are going to be limited by what is known as the Connection Interval. This defines how often the Central (host) communicates with the Peripheral.
BLE uses a frequency-hopping scheme; two devices each send and receive data from one another on a specific channel, and then meet on a new channel sometime later. The time between the each hop is defined as the Connection Interval.
There can be a maximum of six packets (four for iOS) sent per connection interval, and each packet can have up to 20 bytes of payload. So in your case you would use up three packets, which would fit in one connection interval. You would waste the remaining packets.
According to the BLE specification, the allowable range for the Connection Interval parameter is from 7.5 ms to four seconds. With a minimum Connection Interval of 7.5 ms, you could send theoretically 133 connections per second. So your throughput would be 133*50*8 = 53.2 kb/s. This doesn't count the initial time to establish an initial connection while scanning for Peripheral BLE devices (which will be sending out Advertising packets on a periodic basis). Also, if an ACK has to be sent back to acknowledge receipt of the packets of data, this will require another Connection Interval, and thus halve the data rate.
Note: the Apple iOS guidelines limit the minimum connection interval to 20 ms, not 7.5. So you would only have a maximum of 50 connections per second. In that case the throughput would be 33*50*8 = 20.0 kb/s.
Here's some more information about BLE data rates.
-
\$\begingroup\$ @PlasmaHH Thx for the edit. I try to proofread my stuff, but some things just get by once you've looked at it too many times. \$\endgroup\$– tcrosleyCommented Jan 4, 2016 at 22:19
-
\$\begingroup\$ Thanks for this information! How does the situation change when I include more than one slave? Do I have to "establish the initial connection" every time I switch between the slaves, thus consuming even more Connection Intervals, or am I set, once I'm set? \$\endgroup\$– SanuuuCommented Jan 5, 2016 at 13:36
-
\$\begingroup\$ @Sanuuu No, you shouldn't repeatedly have to establish a connection; from what I've read (I haven't tried this myself), you can have multiple instances of a connection object, and just loop through them. The exact syntax will vary depending on what BLE stack you are using. \$\endgroup\$– tcrosleyCommented Jan 5, 2016 at 14:05