Hello,
I need your help. I've been fighting a latency issue and can't find the cause.
I have serial device (encoder motor) sending data at 115200 baud (the actual data consists of only 888 bytes per second)
I need to deliver this data over local network to two computers (raspberry and mac) with minimum latency.
However data arrives at both with 40ms lag.
My setup is following
SerialDevice [115200baud] -> Ardiuno -> Shield ---[UDP] ---> Gigabit Router -> Raspberry (and Mac)
Reading serial data seems to be not a problem. To prove that it's not, I blink a led when I reach certain encoder value (hard coded in my sketch). It blinks exactly when motor reaches this position, I checked by filming the setup with a video camera.
However, when I run on raspberry "nc -uklvw 0 port" to recover UDP packets, I observe this 40ms lag from the moment rapsberry "blinks" and value appearing in my terminal.
Actually it looks like this issue goes beyond Arduino. For testing purposes I replaced Arduino/Shield combo with a a specialized hardware converter RS232->Ethernet friends have borrowed me. It called SDS4, costs 400 euros and made by Perle.
To my surprise I have the exactly same lag.
40ms seems a lot ( I have visual application and this lag is obvious to anyone). I've seen some articles about high-speed UDP applications and they talk about 4-5 ms latency.
Any ideas ?
Thanks
M
