I'm using Jeff Rowberg's famous i2cdevlib library to get yaw, pitch and roll values from my Adafruit MPU6050. I'm using it to control a robotic arm using hand movements. Initially, I had major issues using the DMP6 example provided on a clone Arduino Uno I was using. I had modified the example code for my use case. The program would crash after about 2-3min of use and I had hoped it was due to the Arduino being a clone. The plan was to always switch to a official nano 33 iot and use the wifi capability but was using the clone for testing purposes. Recently I made the switch over to the nano and unfortunately, I have encountered the same problem. After hours of reading through forums I had found out it was a wire.h library issue. I had used a Wire.setWireTimeout() as suggested by some users.
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
Wire.begin();
Wire.setClock(400000); // 400kHz I2C clock.
Wire.setWireTimeout(10000, true);
#elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
Fastwire::setup(400, true);
#endif
This fixed the issue on the Uno and I was really happy with the results after much struggle. Unfortunately since the nano 33 iot uses a different architecture, the setWireTimeout is not implemented in the wire.h library by the arduino guys. My alternative at the moment is to use an official Uno and attach an esp8266 wifi module, however that will be pretty bulky on the wireless glove I plan on putting together. Has anyone encountered this issue or has found a fix for the infamous i2c wire.h issue using the i2cdevlib library by Jeff Rowberg (on a nano 33 iot environment atleast). Any suggestions will be greatly appreciated.