algorithm to estimate Cyton latency?
Hi All,
I have the Cyton+Daisy connecting to PC via the dongle. I want to estimate the latency between them. I came across the clock synchronization algorithm. Have anyone has an experience with performing clock synchronization algorithm with the boards? Is it possible to estimate latency at all?
Best,
vattha
Comments
Attha, hi.
The Cyton radio packets are being produced every 4 milliseconds (250Hz). I assume you have set your dongle latency to 1 ms using the Windows Device Manager. (The dongle uses the FTDI FT231X usb serial chip.) This means that incoming samples are flushed into the Windows usb system every millisecond. Depending on the load of your CPU, the consuming process should have the sample within a couple milliseconds of it's creation at the Cyton mainboard.
William
https://docs.openbci.com/Cyton/CytonDataFormat/#16-channel-data-with-daisy-mdule
Thanks William for your quick response
.
Hi William,
I did some test in Windows 10 in which I opened no program (as far as I knew). In this test, I have an ESP32 to send a sine wave to the USB and the OpenBCI simultaneously. The shape of the sine wave from both devices arrives PC nicely. I measured the USB port latency, i.e. time for sending a byte from ESP32 to PC, that is around 0.5 ms. I got the sine wave from OpenBCI using Brainflow. I also applied the FTDI latency timer to 1 ms as you suggested. I compared the time shift between the sine wave from the USB and the OpenBCI, c.f. a distribution of the time shift given in the below figure. It turns out to be around 17 ms. So my conclusion would be it takes OpenBCI around 17.5 ms for a sample to arrive at PC using Brainflow. Before you mentioned a timescale of a couple millisecond that is quite mismatch from what I measured, did I do something incorrectly?
Best,
attha
Attha, hi.
It's possible that you are using Brainflow in such a way, that this is inducing the delay. Radio packets are generated by the Cyton every 4 ms, so these should get flushed into the usb serial port in much less than 4 ms (with latency set at 1ms). There is additional buffering possibly happening in the Brainflow low level. Which could be reduced with the proper configuration. What language are you using with Brainflow?
Mentioning @Andrey1994, Andrey Parfenov, the Brainflow developer.
William
Thanks for your quick response. I use python.
Please post a comment on Andrey's Brainflow Slack ('askhelp' section), and give a link to this thread on the Forum. Join the Slack via link on this page:
https://brainflow.org/