Brushless motors having different speeds.

I created a quadcopter. When i test it, the motors are working great. I can increase/decrease the speed with no problems. But after some secounds (almost a minute) , two of the motors stop working. They stop at the exact same time. And sometimes, if I let them run, the other two also stop running. If I disconnect and re-connect the battery + arduino, everything starts working again and the cycle repeats. What could be the problem?
BTW. The 2 motors are not always the same, but they stop working in pairs. Somethings motor 1 and 2 and sometimes motor 3 and 4. I cant think of any way these pairs are linked.

The problem was from my batter. I charged it and everything is ok now. New problem. Motors dont have the same speed. Anyone knows how to fix that? I saw somewhere that I have to calibrate the ESC's somehow.

DETAILS:
Motors : 13T , 1000KV
ESC's : 30A
Battery : 11.1V , 3000mAh, 25C
Arduino : NANO

Code :

#include <Servo.h>

Servo M1;
Servo M2;
Servo M3;
Servo M4;

void setup() {
  Serial.begin(9600);
  initiaza_motoare();
  delay(1000);
  delay(5000);
}

void loop() {
  if(Serial.available()) {
    int value = Serial.parseInt();
    Serial.println(value);
    set_speed(M1,value);
    set_speed(M2,value);
    set_speed(M3,value);
    set_speed(M4,value);
    Serial.println(value);
  }
}

void initiaza_motoare(){
  M1.attach(4);
  M1.write(40);
  M2.attach(5);
  M2.write(40);
  M3.attach(6);
  M3.write(40);
  M4.attach(7);
  M4.write(40);
}

void set_speed(Servo ESC, int viteza){
   if(viteza >-1 && viteza < 101){
     if(viteza == 0){
        ESC.writeMicroseconds(0);
     }else{
        int viteza_setata = map(viteza,1,100,1170,2250);
        ESC.writeMicroseconds(viteza_setata);
     }
   }
}

Inside the attached scheme you can see exactly how everything is placed. You can also find a real-image.

Since you are the creator, you have all the information necessary to debug the problem. How about sharing some of that with us?

Code in [ code ] tags.
Schematic (not F**zing).
Part numbers and datasheets for all components.
Which Arduino?

Motors : 13T , 1000KV
ESC's : 30A
Battery : 11.1V , 3000mAh, 25C
Arduino : NANO

Code :

#include <Servo.h>

Servo M1;
Servo M2;
Servo M3;
Servo M4;

void setup() {
  Serial.begin(9600);
  initiaza_motoare();
  delay(1000);
  delay(5000);
}

void loop() {
  if(Serial.available()) {
    int value = Serial.parseInt();
    Serial.println(value);
    set_speed(M1,value);
    set_speed(M2,value);
    set_speed(M3,value);
    set_speed(M4,value);
    Serial.println(value);
  }
}

void initiaza_motoare(){
  M1.attach(4);
  M1.write(40);
  M2.attach(5);
  M2.write(40);
  M3.attach(6);
  M3.write(40);
  M4.attach(7);
  M4.write(40);
}

void set_speed(Servo ESC, int viteza){
   if(viteza >-1 && viteza < 101){
     if(viteza == 0){
        ESC.writeMicroseconds(0);
     }else{
        int viteza_setata = map(viteza,1,100,1170,2250);
        ESC.writeMicroseconds(viteza_setata);
     }
   }
}

Inside the attached scheme you can see exactly how everything is placed. You can also find a real-image.

OK, the code is simple enough. There does't seem to be anything obvious there that would stop two motors. Certainly not a random pair.

Since two stop simultaneously, it could be whatever power connection is common to both. Pull on the wires in each of those connectors - it may have broken the wire or it isn't screwed down properly.

Change your code to let you re-initialize the motors (the .write(40) line) so you can see if the motor goes offline permanently or if it was a transient glitch that went away.

Hi,
What is powering the Arduino?? This sounds like electromagnetic interference of some type. You have a lot of high power fast signals and they can easily get into the Arduino.

All the ESC grounds should meet at the battery negative terminal. Maybe add bypass capacitors across ESC power?

Somewhere in your main loop, flash an LED so you know where your code is running and if it crashes.

What's driving those motors? Is it adequately rated? Is it getting hot? Does one driver unit feed two motors...?

I guess you can see where I'm going..

regards

Allan.

Guys. The problem was from the battery. It had only 7V. I charged it and everything is ok now.
But I have another problem. Motors dont have the same speed. Anyone knows how to fix that? I saw somewhere that I have to calibrate them somehow.

There's probably a lot of different ESCs that use the name "30A" unless you can tell us exactly where you bought them from, we would be guessing or giving you incorrect information.

How do you even know that the speed is different? Those propellors will all be making slightly different thrust, even at the same speed. You need active control to balance the quadcopter. I don't see any components in your list or in your photos which would allow the Arduino to measure the tilt of the copter, so you won't have any control over it once it lifts off the ground.

The gyroscop module is coming.
These are my ESC's : http://www.ebay.com/itm/30A-Brushless-Motor-Speed-Controller-RC-BEC-ESC-T-rex-450-V2-Helicopter-Boat-F5-/111754367246?hash=item1a0514510e:g:n5EAAOSwAL9UgtHt

I noticed the difference in speed when trying to lift the drone. One side is lifting more.

If what you are saying is true (about the propellers), is there any way to find for sure if the speed is different?

You can buy optical revcounters very cheaply . Try one of those...

regards

Allan.

Hi,
What are the specs/data for your ESC, do they need calibrating?

Have you tried swapping ESCs around, then motors around, then arduino outputs around to try and isolate the problem?

If you are trying to lift with the setup pictured, even your leads hanging over the side to the arduino will give an uneven load.

Tom... :slight_smile:

the problem is not the code nor the alimentation, go to the multiwii page and check the pre flight check

here: http://www.multiwii.com/wiki/index.php?title=Multiwii_Beginners_Guide_to_Basic_First_Flight

check esc calibration