limit on sample frequency through web bluetooth?

26 views
Skip to first unread message

Daniel Damelin

unread,
Mar 29, 2022, 2:49:41 PM3/29/22
to web-bluetooth
We are connecting to a Vernier Go Direct sensor via Web Bluetooth, but can only achieve a sampling frequency of 10Hz. The device is capable of being polled up to 50Hz, and using the vendor's own software this works. If we try to poll the sensor for its current reading faster than 10Hz through Web Bluetooth we get identical values for time resolutions less than 0.1 sec.

Is this due to some limitation of the Web Bluetooth API in Chrome or does anyone have a suggestion for something else that could be done to increase sample rate given we know the hardware/sensor is capable of it?

Jack Hsieh

unread,
Mar 29, 2022, 8:39:32 PM3/29/22
to web-bluetooth, Daniel Damelin
Hi Daniel,

It is possible some kind of scheduling inside chrome itself. There is some kind of similar issue reported, though that one is for the Bluetooth Device max throughput, put the link here for reference.

If you don't mind, could you help share the code of using web bluetooth for reading on this device?

Thanks
Jack

Reilly Grant

unread,
Mar 30, 2022, 1:54:45 PM3/30/22
to Jack Hsieh, web-bluetooth, Daniel Damelin
Does the application have to poll the device for updates or is it registering for characteristic value update notifications? If the device uses notifications then Chrome doesn't poll the device, it simply asks the operating system to notify it of updates and that results in a write to the CCCD which tells the device to send those updates over the air. The only inherent limitation with notifications is the available airtime. We have seen some reports of notifications not arriving as quickly as developers expect and I wonder if there are some parameters we can pass to the operating system to control how airtime is allocated to devices.
Reilly Grant | Software Engineer | rei...@chromium.org | Google Chrome


--
You received this message because you are subscribed to the Google Groups "web-bluetooth" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web-bluetoot...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/web-bluetooth/b0b3839b-c746-4727-89c2-8b850061be2cn%40chromium.org.

Daniel Damelin

unread,
Apr 1, 2022, 6:06:56 PM4/1/22
to web-bluetooth, Reilly Grant, web-bluetooth, Daniel Damelin, Jack Hsieh
So I figured out that one can use an event model where the device signals a value changed event or one can poll the device using a timer. We had been using a timer. What I discovered is that the device was batching up a view sensor values at a time and then triggering a few value changed events in quick succession. Then it would wait 0.1 sec and send the next batch of values. This 0.1 sec interval between batches of values caused the polling strategy to only see a new value every 0.1 sec rather than the true sampling frequency the device could generate. Thanks for your suggestions. It helped me go looking for the potential of update notifications rather than timed polling for getting sensor values.
Reply all
Reply to author
Forward
0 new messages