Forums > MaxMSP

Object or system for smooting out data going to serial out.

October 20, 2013 | 11:58 am


I’m trying to build a usb slider interface that can control the positions of several servo motors powered by an Arduino. My goal is to have each servo be controlled by its own slider, and that I can move multiple sliders at the same time to control multiple servos at the same time.

The problem is that the quicker I move one slider up and down (0-127-0) the data read by the serialRead (serial running 9800 baud) in Arduino eventually gets mucked up. It will read a clear scrolling signal from 0-127 and back if I move it slowly, but if I do it fast it will read combined points (12485) or nonsense data points (-15) in the Arduino reader. If I do two or more sliders at the same time, it’s even worse.

Is there and object, or a system of objects I can use to put the numbers from multiple sliders into that will slow down all the incoming messages and output them at a speed that reads properly over the serial port to the Arduino (9800 baud I guess)?

It doesn’t have to read the backlog of data: I don’t need ever slider tick to read perfectly. Rather I would like it to read the stream of data only often enough (at a rate) that it will be able to be send over the serial port without collecting the errors I describe.

Each slider has their its own range, and a "," as a separator, which are parsed to send to the different servos.


October 20, 2013 | 12:23 pm

Regarding thinning out the data, wouldn’t something like this work?

– Pasted Max Patch, click to expand. –

October 20, 2013 | 5:26 pm

The first suggestion would be to run your serial connection significantly higher than 9800 baud. That speed is incredibly slow for multiple bytes of message data and creates a (probably) unnecessary bottleneck on it. Is there some specific reason to run it so low? I’d suggest trying 115200 baud and see if that alleviates the problem before trying anything more involved. If you want to run slower than that, successively try slower speeds until the problem reappears.

Viewing 3 posts - 1 through 3 (of 3 total)