Controlling a Brushless Motor through ESC using Arduino

Hey,

I’m have a brushless motor and ESC, which I’m trying to control using an Arduino Uno for my first quadrotor project. And I’m failing miserably, which is why I’m here. I tried connecting the Arduino to the ESC and using the Servo library, but it didn’t work. All I get are three continuous short beeps on power and then short single beeps. I’m probably not able to even arm the ESC. This is the motor I’m using: http://www.yinyanmodel.com/En/ProductView.asp?ID=58 This is the ESC’s manual(Mine’s the 20Amp Aircraft one, with Ni-MH and LiPo Auto-detect. Table 1.1): http://www.hobbyking.com/hobbyking/stor … 414X39.pdf It’s meant for an RC receiver and I have no idea how I can emulate one through my Arduino. All in all, I’m blank. If anybody could please help, I’d be real grateful. It’d be great if I could get the Arduino code also.

Thanks a lot. :slight_smile:

Assuming you’re using the library correctly and have everything connected OK, I’m guessing it’s because the ESC wants to see the input signal go to “minimum” (ie, 1ms pulse width) before it will start. This is a safety feature to prevent the motor from starting at speed unexpectedly.

I think this question has been asked previously - I can’t remember what the resolution was though. Try searching the forums.

No success :frowning:

My code:

#include <Servo.h>

Servo esc;

int j;

void setup()

{

delay(5000); //Delay to give me enough time to control esc to battery

esc.attach(12);

for(int i=0; i<1000; i++) //Arming

{

esc.write(0);

delay(20);

}

delay(3000);

}

void loop()

{

for(j=0; j<180; j++) //Running the motor

{

esc.write(j);

}

for(j=180; j>=0; j–)

{

esc.write(j);

}

}

All it does is go beep beep beep continously after about 10s.

Sorry, I’m not familiar with Arduino code / libraries - hopefully someone else can comment. I recommend you edit your post to put the code with “code” tags so it’s easy to read.

Nor am I, but I understand C#(and C) very well. What does attach(char) do?

I suggest you use the help feature in the IDE and go to the reference page. From there to the library section and read up on Servo library. The attach method in the Servo class tells you what pin you want the Servo class to output the pulse train on.

Have you verified with a scope or a simple RC servo that the pin is generating the appropriate pulse train? My guess (since you asked what attach does) is that your pulse train is coming out pin 12 but you connected the ESC to some other pin. If that is not the case, I would assume you failed to have a common ground between the ESC and the Arduino.

Also, if your ESC is like my Traxxas ESC, the power distribution is rather funky compared to a “normal” RC setup. The main motor battery connects to the ESC. The ESC then generates a 5V supply to feed to the receiver. The receiver takes in the 5V via the servo wire that runs from the ESC to the receiver. The normal battery input for the receiver is left disconnected. This means that the receiver is receiving power from the ESC and not supplying power to it as in the case of a normal servo. You will have to account for this if you still want the receiver to get power to control itself and the steering servo. If you have a separate battery for the receiver, than “never mind”.