Bluetooth & BLE · Study deck
Python BLE: RSSI Smoothing and Zones
One weak Bluetooth Low Energy (BLE) packet can make a nearby beacon, a device that broadcasts short radio messages, look far away.
Radio Remi is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- 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: That mapping connects the Python examples to interoperable interfaces and prevents a link-layer success from being mistaken for an application-contract success.
- Explain: An all-in-one module still needs sound host wiring, local power decoupling, good board placement, and clear space around its antenna.
- Explain: Properties say what a client may attempt; the schema says how both sides interpret bytes, units, and versions.
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 Module Architecture
The host controller interface carries commands and data into the baseband block.
- An all-in-one module still needs sound host wiring, local power decoupling, good board placement, and clear space around its antenna.
Major section
Visual: BLE GATT Profile Implementation
Properties say what a client may attempt; the schema says how both sides interpret bytes, units, and versions.
- The worked service makes the distinction concrete: its temperature value is a two-byte signed integer scaled by 0.01 °C.
- A real client must decode that value and prove the promised read, write, or notification behaviour.
Major section
Visual: BLE Connection Flow
That link alone does not mean GATT is ready.
- The peers may still need to set up trust, find a service, and subscribe to a value.
- Each step is a separate test point.
- If one fails, follow the return arrow to the first safe step to try again.
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
RFCOMM and the Bluetooth radio carry the byte stream across the air.
- At the other end, a virtual COM port lets old serial software use that stream.
- The simple app view hides more work in the link: the peers must pair, connect, buffer data, and recover after a drop.
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 host controller interface carries commands and data into the baseband block.
- Properties say what a client may attempt; the schema says how both sides interpret bytes, units, and versions.
- That link alone does not mean GATT is ready.
- 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.
Q4A proximity zone flips when a person briefly blocks the radio path. What should the field test change?
Show answer
Answer: B Measured variation should set the zone decision rule.
Retrieval practice
Recall check 4 of 4

Radio Remi says: answer from memory, then check your reasoning.
Q5What Linux host path passes BLE library requests to BlueZ and its adapters?
Show answer
Answer: B Linux routes library requests through D-Bus to the BlueZ host stack and its adapters.
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 · Measured variation should set the zone decision rule.
- B · Linux routes library requests through D-Bus to the BlueZ host stack and its adapters.
- A · BLE characteristics accept bytearray values.