Welcome to Electronoobs Q&A, where you can ask questions and receive answers from other members of the community.


PCBWay Ad

Calibrating ESC with arduino

0 votes
I am calibrating an esc with arduino. I have copied your arduino code an uploaded it. I am using a 9V volt battery instead of a 11V lipo battery. The brushless motor (A2212/13T  1000KV) is running but not with full speed and also the speed gradually decreases. Is this happenig because the motor I am using is different? Please help me solve this problem.  

The code is as below.

#include <Servo.h>

#define MAX_SIGNAL 2000
#define MIN_SIGNAL 1000
#define MOTOR_PIN 9
int DELAY = 1000;

Servo motor;

void setup() {
  Serial.begin(9600);
  Serial.println("Don't forget to subscribe!");
  Serial.println("ELECTRONOOBS ESC calibration...");
  Serial.println(" ");
  delay(1500);
  Serial.println("Program begin...");
  delay(1000);
  Serial.println("This program will start the ESC.");

  motor.attach(MOTOR_PIN);

  Serial.print("Now writing maximum output: (");Serial.print(MAX_SIGNAL);Serial.print(" us in this case)");Serial.print("\n");
  Serial.println("Turn on power source, then wait 2 seconds and press any key.");
  motor.writeMicroseconds(MAX_SIGNAL);

  // Wait for input
  while (!Serial.available());
  Serial.read();

  // Send min output
  Serial.println("\n");
  Serial.println("\n");
  Serial.print("Sending minimum output: (");Serial.print(MIN_SIGNAL);Serial.print(" us in this case)");Serial.print("\n");
  motor.writeMicroseconds(MIN_SIGNAL);
  Serial.println("The ESC is calibrated");
  Serial.println("----");
  Serial.println("Now, type a values between 1000 and 2000 and press enter");
  Serial.println("and the motor will start rotating.");
  Serial.println("Send 1000 to stop the motor and 2000 for full throttle");

}

void loop() {
   
  if (Serial.available() > 0)
  {
    int DELAY = Serial.parseInt();
    if (DELAY > 999)
    {
      
      motor.writeMicroseconds(DELAY);
      float SPEED = (DELAY-1000)/10;
      Serial.print("\n");
      Serial.println("Motor speed:"); Serial.print("  "); Serial.print(SPEED); Serial.print("%");
    }     
  }
}
asked Mar 13 in Arduino by manishDas (120 points)

1 Answer

0 votes
why you use different motor ? maybe the problem from the motor, because different brushless, different characteristics
answered Apr 16 by taufik (250 points)
...