Brushless motor + ESC with Arduino question

Sorry in advance as I'm still a rookie with Arduino projects. My goal is to use an Arduino Uno 3 to create an inexpensive drone/plane project.

Here are my materials and my set up:

Upon compiling the code I found here and connecting the 9 V battery to the ESC, all I hear is constant beep sounds from the motor (about once every 1.5 seconds). Can anyone help me figure out what's going on? Is it the 9 V battery that's not giving the motor enough juice? Or am I just too silly hoping to create something that works under \$10?

``````#include <Servo.h>
Servo ESC1;

int pos = 0; //Sets position variable

void arm() {
setSpeed(0); //Sets speed variable delay(1000);
}

void setSpeed(int speed){
int angle = map(speed, 0, 100, 0, 180);
//Sets servo positions to different speeds ESC1.write(angle);
}

void setup() {
ESC1.attach(9); //Adds ESC to certain pin. arm();
}

void loop() {
int speed; //Implements speed variable
for(speed = 0; speed <= 70; speed += 5) {
//Cycles speed up to 70% power for 1 second
setSpeed(speed);
//Creates variable for speed to be used in in for loop
delay(1000);
}
delay(4000); //Stays on for 4 seconds
for(speed = 70; speed > 0; speed -= 5) {
// Cycles speed down to 0% power for 1 second
setSpeed(speed); delay(1000);
}
setSpeed(0);
//Sets speed variable to zero no matter what
delay(1000);
//Turns off for 1 second
}
``````

Like the previous answer stated, you should be using a 20-25c battery (can discharge up to 25A). I don't know exactly how much a 9V draws, but it definitely can't supply more than an AMP. Your motor pulls much more than 1 amp. Get yourself a nice LiPo from hobbyking.com, maybe an 8.4v or 11.1v

The ESC beeping could be telling you it can't draw enough Amps from the battery?

• got it working with a better battery, thanks! – PandaMan Feb 9 '17 at 1:55

Probably a bit late but your code has some important parts commented out such as (in order):

• delay(1000);
• ESC1.write(angle);
• arm();

Once you add those to the next lines the program should work and the esc shouldn't just beep and actually get the motor to spin

• thanks anyway! we'll consider this if we use those motors again/ – PandaMan Sep 29 '18 at 23:32

The beeping is actually from the ESC. I believe that this model needs to be properly configured (which you can do using the Arduino - refer to the user manual or here) before it can be used. Some kits come with it preconfigured but since you seem to have possibly purchased it individually you need to configure it yourself. Also it doesn't appear to be that your code wouldn't actually send any PWM signals to the ESC. I've only ever used Servo.write() functions in my quads, so I can't be 100% sure on that.

• thank you. Correction, it's actually not a beeping sound, but a little twitch sound made by the motor (nothing from the ESC) I'll continue to read your link and learn more on this. Best regards! – PandaMan Jan 31 '17 at 5:07
• That twitching is a possible error/idle warning in your ESC configuration. I know that my ESCs came programmed to start twitching like a mad dog if they were idle for 10 minutes, which kinda broke the idle warning/shutdown sequence I had designed for my camera-quad. – Bakna Jan 31 '17 at 5:22

You need high current for working with this motor, 8.4 LiPo battery for example.