Thread Tools
Old Jun 25, 2012, 10:12 AM
Skriptkid is offline
Find More Posts by Skriptkid
Registered User
Help!

Controlling Brushless Motor through ESC using Arduino


Hey,
I 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. I even tried sending 10 pulses of width 1ms, with an interval of 20ms, but that didn't work either. 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(Emax CF2822): http://www.yinyanmodel.com/En/ProductView.asp?ID=58 This is the Red Brick ESC's manual(Mine's the 20Amp Aircraft one, with Ni-MH and LiPo Auto-detect. Table 1.1): http://www.hobbyking.com/hobbyking/s...2X53414X39.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 totally 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.
Sign up now
to remove ads between posts
Old Jun 25, 2012, 11:37 AM
leprud is offline
Find More Posts by leprud
Trying to learn.
leprud's Avatar
At power-up, you need to send 1ms pulse to "init" ESC for couple of seconds (usually, until you here starting sounds, like three continuous short beeps in your case). Only after that you can increase pulse up to 2ms (for full throttle). It's preprogrammed in ESC, as you can mistakenly power up ESC with your throttle signal not in lowest position.

PS Hope, you are trying without prop?
Old Jun 25, 2012, 11:44 AM
Skriptkid is offline
Find More Posts by Skriptkid
Registered User
Yes, I'm trying without props. And I tried doing what you said(sending a 1ms and then increasing throttle.) But it still doesnt spin. When I connect the ESC to the battery, I hear three beeps and then short single beeps of every 1s. Could you please give me the code? That would make me understand much better.
Old Jun 25, 2012, 11:53 AM
leprud is offline
Find More Posts by leprud
Trying to learn.
leprud's Avatar
Actually, single beeps indicate either not 1ms pulse, or lack of pulses!
If all connections are right then, you can try this code https://www.rcgroups.com/forums/show...7&postcount=21
Also, please see post 24 in the same thread. It's related to "throttle range calibration" setting in particular ESC
Old Jun 25, 2012, 12:10 PM
Skriptkid is offline
Find More Posts by Skriptkid
Registered User
Oh, okay Thanks a lot, Leprud. Really helped
Old Jun 25, 2012, 12:18 PM
leprud is offline
Find More Posts by leprud
Trying to learn.
leprud's Avatar

Please post success story soon!
Old Jun 26, 2012, 07:56 AM
Skriptkid is offline
Find More Posts by Skriptkid
Registered User
No success
This is 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(9);

for(int i=0; i<1000; i++) //Arming
{
esc.write(0);
delay(20);
}
}

void loop()
{
for(j=0; j<180; j++) //Running the motor
{
esc.write(j);
}
for(j=180; j>=0; j--)
{
esc.write(j);
}
}

It beeps till the setup() is done. and then goes blank.
Old Jun 26, 2012, 08:00 AM
leprud is offline
Find More Posts by leprud
Trying to learn.
leprud's Avatar
Double checked connections? Maybe post a picture?

Also, instead of
Quote:
for(int i=0; i<1000; i++) //Arming
{
esc.write(0);
delay(20);
try

Quote:
for(int i=0; i<1000; i++) //Arming
{
esc.write(45);
delay(20);
as mentioned in thread i linked
Old Jun 26, 2012, 08:20 AM
Skriptkid is offline
Find More Posts by Skriptkid
Registered User
I tried the code you gave. It goes "beep beep beep" continously turning just slightly. And I've attached the pictures.
Old Jun 26, 2012, 08:25 AM
TS00 is offline
Find More Posts by TS00
Ape-pilot Extraordinaire
TS00's Avatar
Please say you aren't powering that ESC from a PP3 battery...
Old Jun 26, 2012, 08:28 AM
Skriptkid is offline
Find More Posts by Skriptkid
Registered User
Currenlt, yes. I'm trying with the 9V battery
Old Jun 26, 2012, 08:29 AM
TS00 is offline
Find More Posts by TS00
Ape-pilot Extraordinaire
TS00's Avatar
Use something that can deliver more current. That battery will cause you problems, and is unlikely to ever run the motor.
Old Jun 26, 2012, 08:31 AM
Skriptkid is offline
Find More Posts by Skriptkid
Registered User
So can that be the cause my motor isn't running? I'll use NiMH or LiPo(As it's writtent on the ESC.)
Old Jun 26, 2012, 08:35 AM
TS00 is offline
Find More Posts by TS00
Ape-pilot Extraordinaire
TS00's Avatar
I'm not saying it's the only cause, but it's almost certainly one of the causes.

First, a PP3 won't deliver enough current - the voltage will drop very low as soon as the ESC puts a load on it.

Second, most ESCs (I don't know for certain that yours does) detect the voltage and try to figure out the battery type from the voltage (multiple of 1.2 or 3.7). They then cut off when the voltage drops below a preset level. So when you connect a 9V PP3, if your ESC is in NiMH mode it will think you have a weak 8-cell pack attached. It will cut out as soon as the voltage drops to ~7.5V, which it will do instantly.
Old Jun 26, 2012, 08:38 AM
Skriptkid is offline
Find More Posts by Skriptkid
Registered User
Oh...okay. thanks TS00 I'll try using an NiMH. But is the code fine for running it?


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Question How is the way to use arduino to control ESC? windhamwong DIY Electronics 26 Oct 17, 2012 06:29 AM
Wanted 2800kv Brushless Motor/30A Brushless ESC for Multiplex EasyStar upgrade davidjrojas Aircraft - Electric - Power Systems (FS/W) 1 Jun 25, 2012 01:33 PM
Help! Controlling a Brushless Motor through ESC using Arduino Skriptkid Beginner Training Area (Heli-Electric) 2 Jun 25, 2012 08:34 AM
Sold CC Phoenix-25 Brushless motor control (ESC) pro bro steve Aircraft - Electric - Power Systems (FS/W) 0 Jun 06, 2012 04:49 PM
Discussion Brushless Motor+ Speed Controller+ Arduino Uno= Problems d4n1s Power Systems 3 Nov 26, 2010 02:03 PM