Forums > MaxMSP

Reading i2c from Arduino? Maxuino?

October 12, 2011 | 2:34 am

I’ve dug around a lot on the forum and elsewhere and haven’t had any luck. I’m trying to figure out how I might read and make sense of data from sensors that communicate w/ i2c.

Maxuino has been pretty solid for me, and on their page they say "This allows Max to read analog and digital pins, write to digital and PWM pins, control servos, listen to i2c sensors and much much more."

Does anybody here have any experience or ideas for receiving and making sense of i2c sensors in Max?

Thanks in advance for any help.


October 12, 2011 | 5:21 pm

In my experience all the i2c stuff is handled by the arduino (or other microcontroller), then you send the data to the computer via serialUSB, or whatever other options the computer and the arduino can speak. All of the i2C stuff I’ve used have used the "wire" library on the arduino.


October 12, 2011 | 8:43 pm

Hmmm, so no Maxuino. I’ve seen some discussion of Firmata handling i2c, but apparently it doesn’t yet. Anybody else have anything helpful?


October 12, 2011 | 9:27 pm

There are a number of resources on the Arduino website that explain how to interface i2c devices using the Wire library
http://arduino.cc/en/Reference/Wire
http://arduino.cc/en/Tutorial/SFRRangerReader

http://arduino.cc/en/Tutorial/DigitalPotentiometer

Additionally, there are several examples included with the Arduino IDE that deal with serial communication that contain Max5 patches (File>Examples>4.Communications).


October 12, 2011 | 11:07 pm

I’m pretty sure the i2c stuff HAS to be handled by the Arduino as it’s a communication protocol in and of itself. I copy/pasted the code from this to get it going:

http://www.sparkfun.com/products/10530

Thankfully I have that magnetometer, but it gives you a good idea of what needs to happen.

(I found the arduino reference stuff REALLY confusing as it explains everything about wire/i2c, but in a non-practical way.)


October 13, 2011 | 2:57 am

Thanks all for your suggestions. I was hoping to stay in Max because I’ll be teaching this to people with no coding experience. But maybe I can figure out how to make it simple.


April 24, 2012 | 3:33 am

@nilloc

I’m in the same boat. I’m looking to teach a class and want to stay in Max and avoid a lot of hand coding w/ Arduino. I’ve also been using Maxuino for this purpose. I’d like to get them using gyro/magnetometer/accelerometer boards via i2c directly into Max. Did you have any luck figuring this out?


April 29, 2012 | 10:27 pm

i’m exactly in the same situation. ( @lostboy )
any idea guys?

thanks guys


April 30, 2012 | 7:15 am

Reading datas over IC2 with an arduino is quite straightforward but OT. Check the standard Wire.h library. Here is an example with the CMPS10 compass:

http://www.robot-electronics.co.uk/files/arduino_cmps10.ino

p


April 30, 2012 | 7:38 am

I think they’re saying they don’t want to do it IN Arduino, but rather, in max/maxuino.


April 30, 2012 | 10:38 am

yes guys,
i was talkin’ about doin’ it with maxuino.
but thanks for the info.
seems that i have to write the code in arduino to read all my analog and I2C sensors signals e use the serial object in max to read values.
Do you think is something complicated ?( given that i have some practice with c programming so the synthax seems very easy in arduino )
thanks
a.


April 30, 2012 | 1:48 pm

It’s not (that) complicated, especially if you have pervious coding experience. My only coding was object oriented (max) when I got into Arduino, and I didn’t find it too hard to do.

I find using Maxuino to be real clunky either way. Much much easier if you just roll your own using serial object. (There’s a (seemingly buried?) tutorial on the c74 page for setting up an Arduino without needing Maxuino)).


April 30, 2012 | 4:56 pm

There are also the Communication examples that come bundled with the Arduino software, which include Max5/6 patches.


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