Implementing a I2C communication with Arduino Firmata

Hey everybody,

I’m currently working on a project, which involves reading sensor data from a MPU6050 used with an Arduino Uno.
We recently switched to OF and Firmata. Before that I used the “normal” Arduino IDE without Firmata and everything worked out.

As I found some great examples on how to use analog and digital inputs with OF & Firmata, I am quite lost when it comes to I2C.

Does anyone has an example on how to implement the communication? I went through the ofArdunio class methods but couldn’t really find a proper documentation, or maybe I just totally overlooked it. I tried using some of the methods but didn’t get far.

I would really appreciate your help.

I’ve no experience with firmata, however, I found this in the ofArduino.cpp file:

I think those i2c functions will do the job?
Good luck
Edit: now I read that you already tried some of these methods without much luck, and are looking for an example. So my answer will be a bit too undetailed I’m afraid.

Hey Jildert,

thank you so much for your effort. I’ll have a closer look, I’ll have to wrap my head around it.


hey @Ge_org , just to learn about it… but:

What’s the point of control i2c directly from OF? What benefits do you get?

Why you don’t use something like and then handling i2c with (faster) Arduino libs internally?

Correct me if I am wrong, but it could not be slower the cycle time (fps) of an OF app vs the Arduino itself?

Some time ago I used ofxSerial to an Arduino Mega and then I communicated to/from an ESP8266 controller (using Aruino IDE) using i2c and it worked fine.
You can use OSC through USB too with this addon. (There’s another new one from @bakercp too:

Also, related to MPU6050, there’s some boards that makes some (hardware accelerated) filtering/signal cleaning of sensors, faster than what you can do inside OF (if I am not wrong)

1 Like


it’s less about controlling i2c but more about utilising the Arduino directly from OF. So we don’t have to go back and forward into the Arduino IDE.

But yeah, I’ll go for a different approach now, I’ll check out ofxSerial, thanks for the hint (: