Controlling a specific ESC from Arduino

I have a student who is wanting to use an ESC and Arduino to control a brushless motor and have very little idea about how to help him. I've read a couple of posts but don't know where to start other than understanding the ESC needs to be armed before it can be controlled.

Is it possible to arm and control this ESC? https://www.banggood.com/Red-Brick-125A-ESC-Brushless-ESC-BEC-5V5A-UBEC125A-p-77972.html

There is a link at the bottom of the page to the manual http://img.banggood.com/file/products/20160112035737Manual.doc but I don't understand how to determine the values required for the arming process.

This is the motor he has purchased https://www.ebay.com.au/itm/Waterproof-4092-1250KV-Brushless-Motor-for-1000mm-or-Above-RC-Boat-Durable-/312022093564?_trksid=p2385738.m4383.l4275.c10

Thanks for any help.

That ESC uses conventional servo control signals so it can certainly be controlled from an Arduino using the Servo library. Unfortunately the "manual" only tells how to do the initial programming of the ESC - only needed if the defaults are not what is required. If it does need programming I'd try to get hold of an RC transmitter and receiver for that step. Otherwise you'd need to write a specific program to do it.

Once the ESC is programmed the startup/arming process is much simpler but as there's no information in the manual you might have to fiddle about to get it right. If it is the same as their smaller ESCs it may be as simple as: writeMicroseconds(1000); delay(1000);

so try that first.

Steve

So the “ESC programming” is a separate initial step required before programming on the arduino?

Does this only ever need to be done once or before each time we use the ESC/brushless motor.

I tried with another smaller ESC and found I was able to make it work without any ESC programming.

I found this sample code which I have been able to make work for the smaller 30A ESC but it does not work for the student’s project.

//This code can be used for any purpose.

#include <Servo.h> //Using servo library to control ESC

Servo ESC1; //Creating a servo class with name as esc

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); //maps servo  to different speeds as percentage 

ESC1.write(angle);

}

void setup() {

ESC1.attach(3); //Adds ESC to certain pin. 

arm();

}

void loop() {

int speed; // 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

}

ESC programming is a one time thing. Once it's done the config is saved until/unless you power it on again with high throttle (write(180) which kicks it back into program mode. And, as I said previously, programming is only needed if the defaults that the ESC comes with are not suitable. I don't have that specific ESC and I have no idea how you're intending to use it so I can't help much with that.

But initially, how is the ESC powered when you're testing it? Is the motor connected? Do you get any beeps? What sets of beeps etc?

That code looks reasonable but I'd put a delay(1000) in setup() after the arm(). If that doesn't work you'll just have to try a few things. It may be easiest to try it with the Knob example from the IDE. That will allow you to try all sorts of combinations to see if you can get it to arm. But arming is usually some fairly simple combination of low throttle, wait and maybe high throttle then back to low.

Steve