Controlling brushless dc motor using esc and arduino

Hello everyone,

Im trying to make a drone so i decided to use arduino uno r3 as its brain.
Now im stuck at one place , when i tried to calibrate the esc everything went well and the motor starts rotating but above a point the speed of the motor decerases i dont know why… Please help me out of this …

#include<servo.h>

Servo esc;

void setup() {

esc.attach(9);
Serial.begin(9600);

}

Void loop() {

int speed;
speed = map(analogRead(A0), 0, 1023, 700, 2000);
Serial.println(analogRead(A0));
esc.writeMicroseconds(speed);
}

There is no syntax error that i get.

I tried both writeMicroseconds and write functions but im facing the same problem.

In the above code the speed drops when the analogvalue is around 600.

Any type of help will be appriciated :slight_smile:

u.kavathia54@gmail.com

Hi, Try mapping 0-180 instead of 700-2000 when you use Servo.write(). Although your way should work too. You probably were already doing that.

Thank you very much for your reply,
I tried the way you told but that didn't work.
If you have any other suggestions please tell me :slight_smile:

Maybe calibration issue? I would try the standard servo.write function mapped from 0-179. Then go through the calibration / throttle limits programming steps on your esc.