Reading i2c from Arduino? Maxuino?
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.
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.
Hmmm, so no Maxuino. I’ve seen some discussion of Firmata handling i2c, but apparently it doesn’t yet. Anybody else have anything helpful?
There are a number of resources on the Arduino website that explain how to interface i2c devices using the Wire library
Additionally, there are several examples included with the Arduino IDE that deal with serial communication that contain Max5 patches (File>Examples>4.Communications).
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:
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.)
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.
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?
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:
I think they’re saying they don’t want to do it IN Arduino, but rather, in max/maxuino.
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 )
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)).
There are also the Communication examples that come bundled with the Arduino software, which include Max5/6 patches.