Memsic 2125 accelerometer and Max
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!
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.
It’s probably simpler to Arduino program (http://www.arduino.cc/en/Tutorial/AccelerometerMemsic2125) then read the data in Max using the serial object.
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.
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("2"); //header for Yval
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.
Thank you Brendan! I will give your suggestion a try and post the results.
Forums > MaxMSP