question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a way to reduce the latency in start_notify()?

See original GitHub issue
  • bleak version: 0.14.2
  • Python version: 3.7.11
  • Operating System: Windows 10
  • BlueZ version (bluetoothctl -v) in case of Linux: N/A

Description

Hi,

I am running Bleak on Windows 10 (central) reading 9DOF IMU data (packed into 1 GATT characteristic) from Arduino Nano 33 BLE. I have noticed that there is an average of 180ms -200ms latency between when the IMU characteristic is updated and when the python program is notified in the start_notify() callback. I measured this latency by comparing the Arduino Serial Monitor time stamp (connected to the same Windows 10 machine) and the time stamp in the start_notify() callback for the corresponding record. When I switched to polling the characteristic in a while loop with asyncio.sleep(0), the latency drops to an average of 20-25ms. Is polling the best practice in minimizing the latency of reading characteristic value updates?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
datoslabscommented, Apr 9, 2022

Thank you very much @dlech!

Based on the Bluetooth traffic captured in Wireshark, the polling version, as expected, can only poll every ~110ms due to the extra “handshakes” around read requests whereas notify version continuously receives data packets from the peripheral. After I performed optional driver updates on my Windows 10, the latency for the notify version is at a more acceptable 25-30ms level. One thing to note is that my Bluetooth driver appeared to be the same version after the updates so I am not sure if the latency was fixed due to the restart or updated shared DLLs.

0reactions
dlechcommented, Apr 8, 2022

is there a system log I can check for more details on what’s happening at the pocket levels?

Yes, see https://bleak.readthedocs.io/en/latest/troubleshooting.html#capture-bluetooth-traffic

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 Ways to Reduce Bluetooth Latency - MakeUseOf
Luckily, Bluetooth devices aren't doomed to latency and lag. There are a few ways you can reduce Bluetooth latency.
Read more >
Re: Overhead reduction in LE connection establishment — Linux ...
I would like to > know if it's possible to remove those operations through ... (the central > calls StartNotify() as soon as...
Read more >
How to reduce BLE notification latency - ST Community
I would like to reduce the latency as much as possible for sending notifications between the 2 boards. Currently, I'm able to start...
Read more >
965316 - startNotifications() throws GATT Error: Not Paired ...
2. Click button to prompt device pair window. 3. Find device and click 'pair'. 4. Open JavaScript console and notice the Gatt Error....
Read more >
How to improve network latency in 3 steps - TechTarget
What is network latency and how do you reduce it? What are the causes of latency and the problems that can result from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found