MSP>Arduino Latency test results

teqy's icon

hello,

I ran a latency test today using arduino & max msp , I used a maxuino patch to communicate between the two.

what i wanted to find out was : How long does it take to send a signal from the PC computer out to arduino and back into the computer? I sent a signal along the following path : max/msp > serial/usb > arduino digital out >arduino digital in> usb/serial>max msp.

i used a timer module inside max msp to take the readings.

results:

Each time i send a test signal/bang out of max/msp I get a range of latencies for its return back in.

it is not a constant figure, i have readings between 3 ms > 19ms each time i send a single bang.

just thought id post this. maybe there is a way to tighten this up ?

peace : )

brendan mccloskey's icon

just wanted to say thanks for this

it's good to know these things; it would be important to know your OS etc

Brendan

pdelges's icon

As far as I can see, maxuino uses JavaScript (which is 200 slower than everything else in the world...) to process the i/o. I think it would be a better idea to do benchmarks using only serial and a couple of other standard Max objects.
And I'm not sure neither that firmata is optimized for a loopback.

Last time I tried, a speed of 115200 bps worked quite well between Max and an Arduino but Maxuino uses a bit rate of 57600.

p

teqy's icon

hi Patrick : ) wow, thanks for the info. I was about to run some tests again very soon on the arduino. I was just searching for the preference page you mention so to alter the latency and 'bps rate' ..I cant find it now.: ? This is how i found out you posted here , as i saw your message on a google search, lol :) ( i haven't had an email notification.)

I shall have a go with the serial object too, I haven't used that yet by itself as you say and see how it performs.

there are other micro boards i might try like the 'make controller'

this looks real nice. http://makezine.com/controller/

i was just after the lowest latency possible (p.s I am on xp , but have an ubuntu machine too ,that might help)

peace: )

teqy's icon

hello to everyone reading : just to clarify, i am on xp and i am sure as patrick says, the serial object by itself might bring better results as the 'bps rate' can be raised and i am sure i saw a latency page the other day somewhere?( which inspired me to try again, but ive lost it, darn it. i'll report back soon,

pdelges's icon

There is no preference page to set the bit per second rate. It's coded in the arduino and in trhe patch.

On the arduino side, look for a
Serial.begin(blah)

in the setup() procedure, where blah is the bps.

On the Max side, the bps is an argument of the serial object. Both bps must match.

But I think the bottleneck here the polling speed.

The make controller is nice too, more plug&play than the arduino and more powerfull (although I had too many small problems with their v2 compared to v1). I don't know its latency, but it's fast enough for my needs!

Why do you worry so much about latency?

p