CSE 122/222C ; WES 269�BLE Advertising Deep Dive
Pat Pannuto, UC San Diego
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
BLE Advertising Deep Dive Goals
2
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Outline
3
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Bluetooth Classic and BLE co-exist & have different use cases
4
Car BT Audio
Bluetooth Low Energy (introduced in v4.0)
Bluetooth Classic (around since 1999)
Headphones
Mobile Photo
Printers
Fitness Trackers
Tracking Devices�(eg: Apple AirTag)
Switches
and Sensors
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Bluetooth Low Energy Roles: Scanner, Advertiser
5
Scanner
Advertisement:
“Current temp is 76F"
Advertiser
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
BLE Central and Peripheral roles are for connections
6
Central
Advertisement:
“I’m the Living Room Light”
Peripheral
Connection Request
Connected (stops advertising)
“Set light brightness to 50%”
(note: this is highly simplified)
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
BLE Layers
7
GAP
Host
Controller
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
What’s the need for the HCI Layer?
8
Host layers run
on computer
Controller layers run
on BLE hardware
HCI can be software API,
or physical (USB, RS232,..)
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Advertisement and Scanning in Action
9
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Advertisement payloads are in Length – Type – Value Format
10
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Outline
11
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Advertisements alone can be used for communication
Recall: BLE advertisements are uncoordinated, broadcast messages designed for discovery
12
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Beacons
13
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Beacons to advertise presence and send out useful information
14
Self-guided tours at museums
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Tracking
15
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
BLE signals can be used to track distance to items
16
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
nRF Connect Activity
17
Advertiser
Scanner
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
RSSI and some questions
18
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
RSSI Experiments
19
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Intuition on using signal strength to find distance
20
Measured Power: -20 dBm
factory-calibrated, read-only constant
“Hey you should be getting an RSSI of -20 dBm at 1 m distance from me”�
RSSI from
received signal
Can roughly figure out
how far the beacon is
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Problem with RSSI-based distance – not accurate
21
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Apple uses BLE on its devices to implement “Continuity”
22
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Uses BLE ”Manufacturer Specific Data” to communicate
23
Martin, Jeremy, et al. "Handoff all your privacy–a review of apple’s bluetooth low energy continuity protocol." Proceedings on Privacy Enhancing Technologies 2019.4 (2019): 34-53.
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Local Communication: Exposure Notifications
24
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Cautionary Tale:�Technology cannot solve all the world’s problems
25
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Outline
26
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Paper: power measurements of BLE advertisements
Schrader, Raphael, et al. "Advertising power consumption of bluetooth low energy systems." 2016 3rd International Symposium on Wireless Systems within the Conferences on Intelligent Data Acquisition and Advanced Computing Systems (IDAACS-SWS). IEEE, 2016.
27
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Energy model for BLE advertisements
28
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Power measured for BLE adv states for hardware
29
nRF51 DK
nRF51822 SoC
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Exercise: How much energy does one advertising cycle consume?�(for the peripheral / advertising device)
30
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
How much energy does one advertising cycle consume?
31
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
How much energy does it cost to send data over advertisements?
32
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Outline
33
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Example of real-world research:�Sensor data collection via BLE advertisements
34
DeBruin, Samuel, et al. "Powerblade: A low-profile, true-power, plug-through energy meter." Proceedings of the 13th ACM Conference on Embedded Networked Sensor Systems. 2015.
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Questions about network capability
35
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
BLE advertisements are periodic, broadcast transmissions.
36
time
Tadv_interval
+ tadv_delay
advertisement event
advertisement event
Bluetooth SIG. Bluetooth Core Specification 4.2. (2014).
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
What causes transmissions not to be received?
37
broadcast domain
X
X
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
What is the probability of a packet collision?
38
Packet 0
time
tadv_0
Jeon, Wha Sook, et al. "Performance analysis of neighbor discovery process in bluetooth low-energy networks." (IEEE Transactions on Vehicular Technology, 2016).� Perez-Diaz de Cerio, David, et al. "Analytical and experimental performance evaluation of BLE neighbor discovery process including non-idealities of real chipsets." (Sensors, 2017).
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Let’s define some terms for a single advertiser
39
Packet 0
time
Tadv
Jeon, Wha Sook, et al. "Performance analysis of neighbor discovery process in bluetooth low-energy networks." (IEEE Transactions on Vehicular Technology, 2016).� Perez-Diaz de Cerio, David, et al. "Analytical and experimental performance evaluation of BLE neighbor discovery process including non-idealities of real chipsets." (Sensors, 2017).
Tadv: Transmission Time for packet
tadv_delay: Random advertisement delay
TadvInterval: Advertisement interval
Next Packet
Tadv_interval
tadv_delay
Tadv
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
What is the probability of a packet collision?
40
Packet 0
Packet 1
time
tadv_0
tadv_1
Packet 1
Packet 1
Packet 1
Packet 1
Jeon, Wha Sook, et al. "Performance analysis of neighbor discovery process in bluetooth low-energy networks." (IEEE Transactions on Vehicular Technology, 2016).� Perez-Diaz de Cerio, David, et al. "Analytical and experimental performance evaluation of BLE neighbor discovery process including non-idealities of real chipsets." (Sensors, 2017).
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
What is the probability of a packet collision?
41
Packet 0
Packet 1
time
tadv_0
tadv_1
Probability of Collision
Jeon, Wha Sook, et al. "Performance analysis of neighbor discovery process in bluetooth low-energy networks." (IEEE Transactions on Vehicular Technology, 2016).� Perez-Diaz de Cerio, David, et al. "Analytical and experimental performance evaluation of BLE neighbor discovery process including non-idealities of real chipsets." (Sensors, 2017).
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Collisions occur if any part of the two packets overlap
42
Packet 0
Packet 1
time
Tadv
Tadv
Packet 1
Packet 1
Packet 1
Jeon, Wha Sook, et al. "Performance analysis of neighbor discovery process in bluetooth low-energy networks." (IEEE Transactions on Vehicular Technology, 2016).� Perez-Diaz de Cerio, David, et al. "Analytical and experimental performance evaluation of BLE neighbor discovery process including non-idealities of real chipsets." (Sensors, 2017).
no collision
Tadv
Packet 1
t
t - Tadv
t + Tadv
2 * Tadv
Vulnerable period
no collision
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Computing probability of collision from vulnerable period and Tx window
43
Packet 0
time
Tadv
t
t - Tadv
t + Tadv
2 * Tadv
Vulnerable period
Packet 0
Tadv_interval + tadv_delay
tadv_delay
Transmission window
Probability of Collision
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Break + Determine Probability of Multiple Failures
44
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Easy way to combat inevitable collisions: Just say it twice!�(…or three times, or four times, …)
45
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Determine Probability of Multiple Failures�(How many times should we say the same thing?)
46
Probability of Collision
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
When are transmissions from two devices independent?
Assumption is true for any BLE device that has been advertising for some time
47
time
Tadv_interval
delay
Tadv_interval
delay
Tadv_interval
delay
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
When are transmissions from two devices NOT independent?
Independence assumption is false for two BLE devices that have recently collided.
48
time
Tadv_interval
delay
New time period collisions could occur within
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Calculating probability of a repeat collision
49
difference in transmission time
probability
tadv_0
tadv_1
Probability of Repeat Collision
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Important lesson: spend time on things that are important
How important is accounting for repeat collisions with advertisement-based networking?�
Maximum error is about a 1% change in Data Reception Rate.
This is due to size of delay 10 ms compared to size of transmission ~300 µs.
50
200 ms interval advertisements
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Equations for modeling data transmissions
51
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Is the model valid?
Empirical testing setup:
Transmit monotonically increasing sequence numbers.�
Sweep number of devices and advertising intervals.
52
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
The model is accurate across advertisement rates and deployment sizes.
Accuracy is fairly consistent across intervals.
The model consistently overestimates the measured PRR values.
The effect could be due to RF interference.
53
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
The model accurately accounts for redundancy as well.
The same dataset can be used to measure the effect of redundancy by grouping sets of sequence numbers.
The model again slightly overestimates, but error reduces quickly as DRR approaches 100%.
54
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
What questions can we answer with a collision model?
55
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Redundancy results in high DRR even with many devices.
In this example, a sensor has new data once per second and sends it in 1-3 packets.
Even without redundancy, data reception rates never fall below 87% even with 200 devices in a deployment, assuming no interference.
56
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Redundancy is (normally) better than less congestion.
Design question:
The answer changes, but only with many devices.
57
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Outline
58
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Scan requests/responses seem intriguing
59
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Scan Requests and Responses don’t work for data use case
Kravets, Robin, Albert F. Harris III, and Roy Want. "Beacon trains: blazing a trail through dense BLE environments." Proceedings of the Eleventh ACM Workshop on Challenged Networks. 2016.
60
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell
Next up: BLE Connections
61
CSE 122/222C ; WES 269 [WI25]
CC BY-NC-ND Pat Pannuto – Content developed in coordination Branden Ghena and Brad Campbell