Bluetooth & BLE · Study deck
Python BLE: RSSI Smoothing and Zones
One weak BLE packet can make a nearby beacon look far away.
Radio Remi is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- Explain: This order connects latency and power tuning to correctness: shortening discovery or connection time is useful only when security, service discovery, subscriptions, data exchange, and reconnect behavior remain observable and reliable.
- Explain: The sequence matters because reducing TX power cannot compensate for a radio that wakes too often, and a long sleep schedule is unacceptable if it breaks the promised response time.
- Explain: Raising the advertising rate by 10x can make detection feel faster, but it also turns a maintenance interval measured in years into one measured in months.
- Smooth RSSI samples before classifying proximity zones.
Major section
BLE Power Optimization Decision Flow
The sequence matters because reducing TX power cannot compensate for a radio that wakes too often, and a long sleep schedule is unacceptable if it breaks the promised response time.
- When building battery-powered BLE devices, power optimization is critical.
Major section
Visual: BLE GATT Profile Implementation
The evidence path at the end asks whether real clients can read, write, and receive notifications with the agreed encoding.
- That ordered review connects the Python implementation to interoperable behavior and exposes contracts that a connection-only test would miss.
Major section
Visual: BLE Connection Flow
The path matters because each boundary can succeed while a later one still fails, and each failure needs different evidence.
- This order connects latency and power tuning to correctness: shortening discovery or connection time is useful only when security, service discovery, subscriptions, data exchange, and reconnect behavior remain observable and reliable.
Major section
Visual: BLE Stack Architecture
That mapping connects the Python examples to interoperable interfaces and prevents a link-layer success from being mistaken for an application-contract success.
- The controller/host split is especially important when a module exposes HCI rather than running the complete application stack internally.
Major section
Visual: Bluetooth Serial Port Profile
The application can retain a serial-stream interface, but pairing, link establishment, buffering, disconnection, and reconnection now sit in the path.
- That makes SPP useful for legacy debugging and configuration while requiring explicit timeout and recovery handling.
Major section
Deployment Pattern: BLE Proximity System for Retail Analytics
Retail analytics systems often use BLE proximity detection to estimate customer dwell time and foot-traffic patterns.
- A customer stepping behind a display rack causes a sudden 10-15 dBm drop.
- With alpha 0.2, it takes 4 readings (8 seconds) -- long enough for the customer to move again, preventing a spurious zone change.
- Raising the advertising rate by 10x can make detection feel faster, but it also turns a maintenance interval measured in years into one measured in months.
Major section
Concept Relationships:
RSSI filtering and zone-based detection: Threshold filtering reduces noise from distant devices before zone classification runs.
- EMA smoothing and proximity detection: Exponential moving average stabilizes noisy RSSI readings so zones do not flicker.
- Beacon protocols and indoor positioning: iBeacon and Eddystone formats provide repeatable advertisement structures for location services.
- bleak and cross-platform support: One async Python API can target Windows, macOS, and Linux backends.
Deck summary
Key takeaways
The sequence matters because reducing TX power cannot compensate for a radio that wakes too often, and a long sleep schedule is unacceptable if it breaks the promised response time.
- The evidence path at the end asks whether real clients can read, write, and receive notifications with the agreed encoding.
- The path matters because each boundary can succeed while a later one still fails, and each failure needs different evidence.
- That mapping connects the Python examples to interoperable interfaces and prevents a link-layer success from being mistaken for an application-contract success.
Retrieval practice
Recall check 1 of 4

Radio Remi says: answer from memory, then check your reasoning.
Q1A BLE proximity system uses EMA smoothing with alpha=0.3 at 1 Hz. How does reducing alpha to 0.1 affect the system?
Show answer
Answer: B With alpha=0.1, effective window = 2/0.1 - 1 = 19 samples and 95% response time = -ln(0.05)/0.1 = 30 seconds. This greater smoothing reduces false zone transitions in noisy environments like crowded retail spaces.
Retrieval practice
Recall check 2 of 4

Radio Remi says: answer from memory, then check your reasoning.
Q2Why is RSSI threshold filtering important in production BLE scanners?
Show answer
Answer: C Setting a minimum RSSI threshold (e.g., -70 dBm) filters out distant devices, reducing processing overhead and focusing discovery on devices within a useful range.
Q3What is the standard BLE GATT service UUID for the Heart Rate Service?
Show answer
Answer: B 0x180D is the Bluetooth SIG-assigned UUID for the Heart Rate Service.
Retrieval practice
Recall check 3 of 4

Radio Remi says: answer from memory, then check your reasoning.
Q4Why do BLE proximity systems use zone-based classification (immediate/near/far) rather than precise distance calculations?
Show answer
Answer: B RSSI can vary by +/-6 dBm from multipath fading, 5-15 dBm from body shadowing, and +/-10 dBm from antenna orientation.
Retrieval practice
Recall check 4 of 4

Radio Remi says: answer from memory, then check your reasoning.
Q5Place each BLE Python runtime layer where it lives so you can trace an application call through the host stack to the radio controller.
Show answer
Answer: A The three regions separate Python intent, host-side BLE services, and controller hardware so you can diagnose which boundary owns a failed scan, GATT call, or radio exchange.
Q6Complete the code to write a value to a BLE GATT characteristic:
Show answer
Answer: A BLE characteristics accept bytearray values.
Print reference
Answers 1 of 2
Answer key.
- B · With alpha=0.1, effective window = 2/0.1 - 1 = 19 samples and 95% response time = -ln(0.05)/0.1 = 30 seconds. This greater smoothing reduces false zone transitions in noisy environments like crowded retail spaces.
- C · Setting a minimum RSSI threshold (e.g., -70 dBm) filters out distant devices, reducing processing overhead and focusing discovery on devices within a useful range.
- B · 0x180D is the Bluetooth SIG-assigned UUID for the Heart Rate Service.
Print reference
Answers 2 of 2
Answer key.
- B · RSSI can vary by +/-6 dBm from multipath fading, 5-15 dBm from body shadowing, and +/-10 dBm from antenna orientation.
- A · The three regions separate Python intent, host-side BLE services, and controller hardware so you can diagnose which boundary owns a failed scan, GATT call, or radio exchange.
- A · BLE characteristics accept bytearray values.