Script Collection icon Script Collection Manage and execute multiple scripts in a single Script Manager using ControlCommand(), with Control Details showing available commands. Try it →
New Zealand
Asked
MPU9150 polling freezes PCA9685 servos

MPU9150 Polling Freezes PCA9685 Servos

Setup: Arduino Uno over USB to ARC running the Arduino EZB firmware, with an Adafruit PCA9685 16channel servo driver on the Arduino’s I2C (addr 0x40) driving 8 MG996R servos. Separate 5V/6A supply to servos, common ground tied to Arduino and PCA9685. I also have an MPU9150 IMU (addr 0x68) on the same I2C bus. In ARC I’m using the MPU9150 Accelerometer, Gyro, Temperature, Compass robot skill to read orientation and map roll/pitch to two servos. Variables look good in the Variable Watcher until things lock.

Symptom: With a script polling the MPU9150 every 100 ms using ControlCommand("MPU9150", "RunOnce"), after 20-90 seconds all servos on the PCA9685 freeze and the EZB connection becomes unresponsive until I reset the Arduino. If I stop polling the IMU, the PCA9685 runs for hours. Slowing to 500 ms extends the time but it still eventually freezes.

What I tried:

  • Verified I2C addresses: PCA9685 0x40, MPU9150 0x68, no conflicts.
  • Shortened SDA/SCL leads to ~20 cm and added 4.7k pullups to 5V (also tried 2.2k).
  • Ensured solid 5V servo supply and GND common to Arduino/PCA9685/IMU.
  • Called Init once, then RunOnce as documented; also tried pausing Auto Position during reads.
  • Removed the IMU: no freezes; left IMU connected but no RunOnce calls: no freezes.

Minimal script causing the issue:

ControlCommand("MPU9150", "Init")
:loop
  ControlCommand("MPU9150", "RunOnce")
  $roll = $mpu9150_roll
  $pitch = $mpu9150_pitch
  Servo(D0, 90 + ($roll*2))
  Servo(D1, 90 + ($pitch*2))
  Sleep(100)
Goto(loop)

Is this a known I2C blocking issue when using the MPU9150 skill alongside a PCA9685 via an Arduino running EZB firmware, and would migrating the servos to the PCA9685 servo Driver robot skill (recommended method) or reducing the EZB I2C clock be the right fix here?



Related Hardware (view all EZB hardware)
Control PCA9685 servo breakout with Arduino Uno using Synthiam ARC and EZB firmware; servo shield support and programming tutorial.
USB
Servos 16
Camera
Audio
UART
I2C
ADC
Digital

ARC Pro

Upgrade to ARC Pro

Elevate your robot's capabilities to the next level with Synthiam ARC Pro, unlocking a world of possibilities in robot programming.