im doing a quadcopter flight controller project and I have been having a problem with my motors. Im using 4 of them and when i try to turn them on, i can increase all quad motors to about 30% or so and some of the motors would turn off. im using arduino nano.
this is the battery: Amazon.com
the ESC: Amazon.com
the PDB:Amazon.com
The motors: Amazon.com
all motors get the same write. which is Servo.writeMicroseconds (**somee microseconds); I also tried using a 4 in 1 ESC but that didnt work. i noticed when testing out a PDB with Leds that if i increase the speed of the motors, the PDB's(power distribution board) led gets quite dim so im guessing a possible hardware problem but im not sure.
here is the code related to the motors.
#include <Servo.h>
int Motor1Analog_1=3;
int Motor1Analog_2=9;;
int Motor1Analog_3=10;
int Motor1Analog_4=11;
setup(){
ESC.attach(Motor1ESC , MinMicroSeconds_Motor , MaxMicroSeconds_Motor); //1000 to 2000
ESC2.attach(Motor2ESC , MinMicroSeconds_Motor , MaxMicroSeconds_Motor);//
ESC3.attach(Motor3ESC , MinMicroSeconds_Motor , MaxMicroSeconds_Motor);
ESC4.attach(Motor4ESC , MinMicroSeconds_Motor , MaxMicroSeconds_Motor);
}
void loop() {
SetMotorsSpeed();
}
void SetMotorsSpeed(){
Motor_1_Speed=map(Motor_1_Speed,1000000,2000000,1000,2000);
Motor_2_Speed=map(Motor_2_Speed,1000000,2000000,1000,2000);
Motor_3_Speed=map(Motor_3_Speed,1000000,2000000,1000,2000);
Motor_4_Speed=map(Motor_4_Speed,1000000,2000000,1000,2000)
//Serial.print(" Motor1: "); Serial.print(Motor_1_Speed);
// Serial.print(" Motor2: "); Serial.print(Motor_2_Speed);
//Serial.print(" Motor3: "); Serial.print(Motor_3_Speed);
// Serial.print(" Motor4: ");Serial.println(Motor_4_Speed);
//analogWrite(Motor1Analog_1,Motor_1_Speed);
//analogWrite(Motor1Analog_2,Motor_2_Speed);
//analogWrite(Motor1Analog_3,Motor_3_Speed);
//analogWrite(Motor1Analog_4,Motor_4_Speed);
ESC.writeMicroseconds(Motor_1_Speed);
ESC2.writeMicroseconds(Motor_2_Speed);
ESC3.writeMicroseconds(Motor_3_Speed);
ESC4.writeMicroseconds(Motor_4_Speed);
}
and while we are at it, i tried switching to analogwrite instead of servo.write microseconds by mapping the values to 0 to 255 range. the results were pretty bad. the motors no longer sync and turn off and on seemingly at random. if anyone know the possible cause, that would be great.