1. Paul
    Paul April 30, 2011 at 00:26 . Reply

    There’s something very different about our results with Duemilanove. Every time I try, I get 16 ms.

    paul@mac:~/latency > ./latency_test2
    port /dev/cu.usbserial-A800daD3 opened
    waiting for board to be ready:
    latency @ 1 bytes: 15.99 ms average, 16.03 maximum
    latency @ 2 bytes: 15.99 ms average, 16.00 maximum
    latency @ 12 bytes: 15.99 ms average, 16.07 maximum
    latency @ 30 bytes: 15.99 ms average, 16.01 maximum
    latency @ 62 bytes: 15.99 ms average, 16.03 maximum
    latency @ 71 bytes: 16.00 ms average, 16.09 maximum
    latency @ 128 bytes: 15.99 ms average, 16.11 maximum
    latency @ 500 bytes: 47.99 ms average, 48.01 maximum
    latency @ 1000 bytes: 95.99 ms average, 96.00 maximum
    latency @ 2000 bytes: 175.92 ms average, 176.00 maximum
    latency @ 4000 bytes: 351.91 ms average, 352.00 maximum
    latency @ 8000 bytes: 703.90 ms average, 703.99 maximum

    I retested on the OS-X 10.7 preview, and got the same results as 10.6.7.

    My results for Uno and Teensy are pretty much a close match.

    I’m also a little curious why Teensy never does better than 1 ms? It’s probably something fundamental in the USB framing… maybe in the driver or maybe in the host controller chip? Maybe next week I’ll find time to hook up a USB protocol analyzer and get some ns-accurate timing measurements on the actual packets.

  2. Paul
    Paul April 30, 2011 at 14:44 . Reply

    I only have 1 mac and 1 non-uno arduino, so the 16ms could be due to either of those.

    Maybe we need to find more people who can run this benchmark and post their results? I’ll ask on a local mail list.

  3. Paul
    Paul May 1, 2011 at 16:13 . Reply

    Looks like the 16ms is something wrong on my end. At least one other person ran the test and got results similar to yours on Arduino 2009 and a Macbook Air.

    That’s really awesome how you found the usleep(20000) that’s been buried inside RXTX all these years. I can’t recall how many times I’ve seen Arduino users frustrated over latency! This is exactly the sort of huge improvement I was hoping would eventually come out of all this benchmarking. :-)

  4. scotty
    scotty May 7, 2011 at 23:41 . Reply

    hi , has anyone tried controlling a teensy from max /msp via serial? low latency? Is there a script available?
    : )

  5. Paul
    Paul May 9, 2011 at 12:59 . Reply

    @Scotty – Check out http://www.maxuino.org which controls boards running Firmata. I believe they made a number of bandwidth+latency improvements about 1 year ago in their javascript, and rumor has it soon they’re releasing an all native version.

    You could also try using the USB MIDI type instead of serial.

  6. scotty
    scotty May 15, 2011 at 18:56 . Reply


    thanks Paul , i just noticed your message.

    I just purchased a teensy ++ so when it arrives I shall give maxuino a try. : P

    peace + have fun.

  7. [...] wrote in to tell us about some interesting Arduino latency issues he helped nail down and fix on the [...]

  8. [...] wrote in to tell us about some interesting Arduino latency issues he helped nail down and fix on the [...]

  9. Ultimaker - Erik
    Ultimaker - Erik May 25, 2011 at 18:45 . Reply

    It works fine on a Mac. uname -a gives me:
    Darwin macbook-2.local 10.7.0 Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386 i386 i386

    This really allows the Ultimaker 3D printer to print even faster when controlled from a Mac. Apparently now the latency for printing instructions can be fed at a higher rate allowing more detailed prints at high speeds. Thanks!

    Now, the question is… How do I go about recompiling the rxtx lib for other OSs?


  10. [...] neophob.com are you still afraid? This is another rxtx library release based on my pre­vi­ous release. This new ver­sion improves the “ser­ial event call­back func­tion” and thus reduce the library latency enor­mous — for more infor­ma­tion read THIS arti­cle. [...]

  11. linvinus
    linvinus May 26, 2011 at 21:12 . Reply

    Little modification for arduino
    void setup() {
    }//end of setup

    void loop() {
    if (Serial.available())
    also in latency_test2.c
    #define BAUD B1000000
    if (cfsetspeed(&tinfo, BAUD) < 0) die("error in cfsetspeed\n");

    with that settings i get following results
    $ ./latency_test2
    port /dev/ttyUSB0 opened
    waiting for board to be ready:
    latency @ 1 bytes: 2.05 ms average, 7.20 maximum
    latency @ 2 bytes: 2.00 ms average, 2.12 maximum
    latency @ 12 bytes: 2.06 ms average, 6.87 maximum
    latency @ 30 bytes: 2.02 ms average, 3.35 maximum
    latency @ 62 bytes: 2.10 ms average, 7.12 maximum
    latency @ 71 bytes: 2.09 ms average, 4.18 maximum
    latency @ 128 bytes: 3.00 ms average, 3.34 maximum
    latency @ 500 bytes: 7.02 ms average, 8.61 maximum
    latency @ 1000 bytes: 11.99 ms average, 12.21 maximum
    latency @ 2000 bytes: 22.00 ms average, 23.14 maximum
    latency @ 4000 bytes: 41.99 ms average, 42.33 maximum
    latency @ 8000 bytes: 81.98 ms average, 82.71 maximum

  12. linvinus
    linvinus May 26, 2011 at 21:14 . Reply

    i’m sorry forgot to say about OS,
    Ubuntu 10.10 2.6.39-020639-generic x86_64

  13. [...] Java-based applications that use it, librxtx introduces an additional 20ms of latency. I wasn’t using Java or librxtx, but you’ll want to read that if you [...]

  14. Latency « @ STEIM
    Latency « @ STEIM October 24, 2011 at 15:06 .

    [...] bpm to latency in ms 1/(BPM/60) http://www.all8.com/tools/bpm.htm Teensy has less latency http://neophob.com/2011/04/serial-latency-teensy-vs-arduino/ Small test. While loop is problem (as expected) has a direct link with scan resolution. Use [...]

  15. Jordan
    Jordan January 11, 2012 at 22:16 . Reply

    I stumbled on this page when trying to build a PS3 mouse adapter. I was thinking about buying the FT232RL serial-usb-converter breakout board at Sparkfun (http://www.sparkfun.com/products/718), to use with a Teensy board…

    Now, I understood probably 1% of what was stated in this article, and I really have no clue what any of this means (I’m just building this adapter with the aid of pictures). But, stumbling upon this page tells me one thing… that certain Arduino products may have latency issues.

    Well, latency is a big deal in the gaming community, and I was wondering; does any of this latency-talk apply to the FT232RL product? It looks like an Arduino product. If so, I might as well settle for the CP2102 serial to USB converter.

    This may be a very misinformed question, which I understand completely, and these Arduino latency issues may not even apply to the FT232RL converter I mentioned at all.

  16. [...] the author of the PixelController software did suffer from the same problems he did some measurements of the serial latency issue of different micro controllers of the Arduino universe. The Teensy USB Development Board has proven [...]

  17. [...] preventing the Java program from sending RGB frames at ~20fps. An Arduino Uno due to his even worse serial performance isn’t able to drive more than two Rainbowduino controllers at ~20fps. Therefore it was quite [...]

  18. [...] There always are some milliseconds some latency. More information available here. [...]

  19. [...] We quickly ran into a major issue with using Processing to read the serial data. Once we had the workflow fully set up, we noticed major latency issues between pressing a physical button on the Arduino and hearing an audio response. At first, we weren’t sure where the latency was occurring – but we found that there’s inherent latency problems in Processing caused by Java’s RXTX library, responsible for serial data (read more here). [...]

  20. [...] 8 ms, bastante coherente con los resultados de otra gente (he utilizado el codigo de esta pagina http://neophob.com/2011/04/serial-latency-teensy-vs-arduino/). Los papers clasicos dicen que el umbral para un controlador musical es 10 ms, mucho menos en [...]

  21. [...] I dont want to use the USB option, because it adds the USB latency. [...]

  22. efrianto
    efrianto June 27, 2013 at 10:34 . Reply

    I want to ask, so arduino latency is at least 20 ms? and we can reduce the arduino latency with the code in this website? Thank you very much

Leave a Reply

%d bloggers like this: