I2C Crash with some DigitalServo

I am using an Arduino pro mini(and Teensy 3.1) to make a RC airplane gyro.
I use a gyro sensor mpu6050.
Using the SBUS and DSMX protocol control 12 ~ 16ch servos.

There is no problem when using the analog servos.
When using digital servos, such as Corona DS-918MP. board is down.
(Radio Control Planes, Drones, Cars, FPV, Quadcopters and more - Hobbyking)

The problem does not occur doesn't move the servos or dosen't read I2C device.
Changing the value of the test TWBR tried(10~166), but the problem is not resolved.

Probably is estimated to hardware problems.

The test source code available.
(softwareServo also experiencing the same problem.)

I2C_DigitalServoCrashTest.ino (2.39 KB)

What is the result of the I2C crash ?

Perhaps the analog servos use older motors inside that draw less current, and maybe the digital servos causes a drop or spike in the power supply.

The most important thing might be the wires, especially the ground wires. Do you have wires to the MPU-6050 ? Are they near the wires of the power to the servo motors ? Is the GND to the MPU-6050 somehow connected with the GND of the servo motors ? They should be connected at the Arduino board, but not somewhere else.

Please do not change the TWBR for now.
In the new Arduino 1.5.8 BETA is a function: Wire.setClock ( 200000 ) ;
But please do not use that either, keep it nicely at the default 100kHz.

In initGyro(), you keep the I2C bus active with : Wire.endTransmission ( true ) ;
I think you can remove the 'true', there is not need for a repeated start.

In readGyro(), you can also remove the 'true' from Wire.requestFrom(). There is no need for a repeated start there either.

Thanks for answers.
This description may not be accurate because I do not speak English well.

What is the result of the I2C crash ?
The result of crash is Arduino board shutdown. (Within few minute)

Perhaps the analog servos use older motors inside that draw less current, and maybe the digital servos causes a drop or spike in the power supply.
No. Power is pretty enough. I tested with 1~5A SBECs.
Furthermore, I said, If you do not read the MPU6050(I2C device) problem does not occur.
Under the servo does not crash. It requires more power.
Corona DS-329MG

Do you have wires to the MPU-6050 ?
Yes. I use 2.54mm 10cm wire jumper cable.

Are they near the wires of the power to the servo motors ?
Yes.

Is the GND to the MPU-6050 somehow connected with the GND of the servo motors ?
Yes.
And i tested MPU-6050 connected only Arduino board’s GND pin. But same problem occurred.
Within the board GND is connected anyway. The relationship seems not seem.

Please do not change the TWBR for now…
So I change my source code.
But there is no will issue.

Add a digital servo test results I have
Crash digital servo Lists.
Corona DS-918MP
Corona DS-939MG

No crash digital servo Lists
Corona DS-329MG
Turnigy MX-96E

Servo Links

My test youtub link: Arduino I2c digital servo crash test - YouTube

In my video Turnigy MX-96E(servo is bad condition but still move) and Corona DS-329MG The normal operation. But when I connect DS-918MP or DS-939MG. Arduino board shutdown in few seconds.

Such as the tried several times to test the servo.
The results were the same.
Due to a hardware problem seems to occur with digital servo compatibility issues.
So I like to progress interoperability testing with servos.

Corona Digital Servo 9g / 1.8kg / .12sec
Corona DS633BP Digital Micro 0.82kg/ 6.2g/ 0.12sec
Corona Digital Servo 2.2kg / 12.5g / .11sec
Corona DS939HV Digital Metal Gear Servo 2.8kg/ 12.5g/ 0.12sec
Corona 919MG Digital Metal Gear Servo 1.7kg/ 12.5g/ 0.06sec
Corona DS238MG Digital Metal Gear Servo 4.6kg/ 22g/ 0.14sec
HK15178I High Speed Digital Metal Gear BB Servo 9.8g / 0.85kg / 0.06s
Turnigy MX-D80M 12g / 2kg / 0.10sec Digital Metal Geared Micro Servo
Turnigy MX-D80E 8.5g / 2kg / 0.10sec Digital Micro Servo
HKSCM12-5 Single Chip Digital Servo (5V) 10g / 1.5kg / 0.18s
HK-15178B Digital MG Servo 13.5g / 1.5kg / 0.08s
Turnigy XGD-11HMB Digital Mini Servo 3.0kg / 11g / 0.12
Hobby King Digital Servo 2.2kg / 12.5g / .11sec
Hextronik MG-14 14g/2.6kg/0.11sec Digital Aircraft Servo
HobbyKing HK-922MG Digital Metal Gear Servo 1.8kg/ 12g/ 0.07sec
HobbyKing HK-933MG Digital MG Servo 2.0kg/ 12g/ 0.10sec

I2C_DigitalServoCrashTest.ino (2.48 KB)

Thanks for all the info !

Everything is pointing in the direction of the I2C bus and the Wire library. When something is wrong on the I2C bus, the Wire library could halt the complete Arduino.
This is a design flaw in the Wire library, it should never halt the Arduino when the I2C is wrong. But that is just my personal opinion.

I suggest to make make the I2C bus more reliable, but there is a lot to say about that.

Is that Arduino a 5V Arduino ?
The MPU-6050 sensor is a 3.3V sensor, so you will have a mismatch between the signal levels. A lot depends on the value of the pullup resistors on the MPU-6050 module. Do you have a link to your Pro Mini board and your MPU-6050 module ? Can you see the value of the pullup resistors on the MPU-6050 module ?
I think you have to add a level shifter for the I2C bus.
A I2C level shifter converts the 5V SDA and SCL to the 3.3V SDA and SCL of the MPU-6050.

How is the Arduino powered ? With 7.2V to the RAW pin ?

You have a flat ribbon cable for the MPU-6050 module. Could you split that cable into seperate wires ? The I2C signals SDA and SCL may not be next to each other in a flat ribbon cable, any cross-talk between them is not allowed.
I know that it won't look very nice, but for now our goal is only to get it working.

Even if everything is small, there are currents going to the servo motors. Could you add a capacitor of say 220uF or 470uF or 1000uF to the 5V and GND of the Pro Mini board ? Simple solutions like this do often have a good result.

Everything is pointing in the direction of the I2C bus and the Wire library.
Sorry but I was going all the possible tests. And It's my conclusion.
because I tested the 20 planes over the past year.
Circuit and the input voltage is considered that there is no problem.
My planes had all passed the total-100-hour tested with so many analog servos and some(only two) digital servos.
In addition, I am selling the following products made in Korea's Internet cafes. ( S.Bus and DSMX decoder 12~16ch )
When using a digital servo is not a problem.

http://cafe.naver.com/ArticleRead.nhn?clubid=26006035&page=1&menuid=45&boardtype=L&articleid=2055&referrerAllArticles=false

Is that Arduino a 5V Arduino ?
Yes.

Is that Arduino a 5V Arduino ?
Yes. I use 5v Atmega328p 16mhz arduino pro minis and mpu6050 board

my arduinos so many... over 200 pcs
http://www.aliexpress.com/item/Free-Shipping-10PCS-LOT-Pro-Mini-Atmega328-5v-16MHz-For-Arduino-Compatible-nano-uno/1735348583.html
http://www.aliexpress.com/snapshot/6303458733.html
http://www.ebay.com/itm/5PCS-New-IMG-Gold-ATMEAG328P-AU-5V-16Mhz-For-Arduino-Pro-Mini-Compatible-Nano-/191117216392?

pt=LH_DefaultDomain_0&hash=item2c7f794a88

my Gyro( gy-521, gy-86) module so many... over 100 pcs
[gy-86]
http://www.ebay.com/itm/121254202598?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649
http://www.ebay.com/itm/161080531135?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649
http://www.aliexpress.com/snapshot/6134881449.html

[gy-521]
http://www.aliexpress.com/snapshot/6236710360.html
http://www.aliexpress.com/snapshot/6215129420.html

They have 3.3v regurator. but I test with 3.3v becs.

How is the Arduino powered ? With 7.2V to the RAW pin ?
I use so many 10~60A escs (With bec 5v)
And confirmed once again in just a test environment.
Was measured using two different methods.

and I connected that RAW pin (not VCC pin :slight_smile:

You have a flat ribbon cable for the MPU-6050 module. Could you split that cable into seperate wires ? The I2C signals SDA and SCL may not be next to each other in a flat ribbon cable, any cross-talk between them is not allowed.
I know that it won't look very nice, but for now our goal is only to get it working.
I was going to test a number of cables.
If a cable problem would not also be normal gyro values.
But there are no problems, the gyro values.
This is a basic test crash test requirements.

in my source. The code below is the normal output.
Serial.print(" | GyX = "); Serial.print(GyX);
Serial.print(" | GyY = "); Serial.print(GyY);
Serial.print(" | GyZ = "); Serial.println(GyZ);

Even if everything is small, there are currents going to the servo motors. Could you add a capacitor of say 220uF or 470uF or 1000uF to the 5V and GND of the Pro Mini board ? Simple solutions like this do often have a good result.
Already finished the test. (at july 2014) with 16v 3300uF capacitor.
After these tests and I doubt the i2c conflict.

my test capacitor.

This is some of my flight test video. with my gyros. It is very precise.

p.s
If you still think I did something wrong.
I want to order the servos that can test for you. If you permit.
And tell me your address and I will order the servo in hobbyking.com.

That leaves only one thing: a I2C level shifter. Could you try one ?

If the level shifter doesn't help at all, then I don't know what the cause it.

sure i can do it.
I expected to be 3-4 weeks for delivery.
I will reply to the result after the test.

Thank you very much.