Forums > MaxMSP

Memsic 2125 accelerometer and Max

Aug 07 2011 | 12:04 pm

Greetings to the group.

I am currently working on a project in which I would like to utilize data from a Memsic 2125 accelerometer to control audio spatialization patches in max5.

Utilizing the max2arduino object set I have established communication between the memsic 2125 and Max. I need some advice on which possible objects in max might best decode the pulse sequences from the 2125 into x,y coordinates.

Thanks in advance for any help!

Aug 07 2011 | 2:20 pm

if you can be a little more specific re ‘pulse sequences’ we can help you out; exactly what type(s) of data are you getting in Max, and in what range/frequency? Not everyone is familiar with the specific sensor you’re using.


Aug 07 2011 | 3:26 pm

It’s probably simpler to Arduino program ( then read the data in Max using the serial object.

Aug 08 2011 | 12:24 pm


I have attached the datasheet to the post. I would greatly appreciate any insight of where to begin.

I can use the arduino sketch, but I need a suitable Max interface as my spatialization patches are written in Max. The project is to have accelerometer data map onto some of the parameters controlling the sound diffusion.



  1. Memsic2125.pdf
Aug 08 2011 | 12:57 pm

There are several ways to access and map the accelerometer data; here’s what I would do. After loading the above Arduino sketch and hooking up the Memsic use the serial monitor window in Arduino to view the raw values coming off the board. If the values regularly exceed 250 amend the Arduino code so that the last few lines look like this:

accelerationX = ((pulseX / 10) – 500) * 8;
accelerationY = ((pulseY / 10) – 500) * 8;

accelerationX /= 4;
accelerationY /= 4;
/*adjust this value such that the serial monitor values are consistently in the range 0 – 250, or manipulate the multiplier (8) in the two lines above these*/

// print the acceleration
Serial.print("1"); //header for Xval
Serial.print(accelerationX, BYTE);
Serial.print("2"); //header for Yval
Serial.print(accelerationY, BYTE);


Then in Max you need [serial] (with the correct arguments for port and baud rate), [zl group 2] to pair the header with the value, then [route 49 50] (ascii 1 and 2) to separate out the two independent number streams.

Go here for a demo/toot:

If you need an example patch which maps the raw values to a mixer/panner/diffuser, then just ask, or search the forum using those keywords.


Aug 08 2011 | 11:30 pm

Thank you Brendan! I will give your suggestion a try and post the results.

Many thanks,


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

Forums > MaxMSP