Can digitalWrite() makes ESC work?


#1

Hi, I am completely new to the ESC AFRO 12AMP, and i want to use arduino to make it work to let the brushless motor rotate. Anyone with the experience can give me some tips or guidence ? Somebody told me that i only need to calibrate the ESC at the first time…
I don’t know whether it is ok to use digitalWrite() to make the ESC wokk at different speed.
Do I need to “start up” the ESC by code everytime when I use it ?
I will apreciate that. Thanks !


#2

@Golden,

This tutorial might help you.

Regards,
TCIII AVD


#3

It is so kind of you TCIII !


#4

I‘ve tried the code and I made some modification, I came up with a problem. Must I set the PWM signal at
90 degree first everytime I boot up the esc ? Because if I set 70 degree or other values the ESC wouldn’t work; Or do I need to make other initialize procedure before it boot up ? My esc is AFRO 12amp, it is originally on the OpenROV2.8 contorller board.
Here is my code that will activate 2 ESCs.
#include <Servo.h>

Servo esc1,esc2;

void setup()
{
Serial.begin(9600);
esc1.attach(6);
esc2.attach(9);

//int throttle = analogRead(throttlePin);
int throttle = 0;
int value = 0;
for (throttle = 1023; throttle >= 0; throttle–)
{
value = map(throttle, 0, 1023, 0, 179);
esc1.write(value);
esc2.write(value);
Serial.println(value);
}
for (throttle = 0; throttle <= 512; throttle++)
{
value = map(throttle, 0, 1023, 0, 179);
esc2.write(value);
esc1.write(value);
Serial.println(value);
}
delay(1000);
}
void loop()
{

// int throttlePin = 83;
// esc1.write(throttlePin);
// esc2.write(throttlePin);
// delay(3000);
// int fuck=87;
// esc1.write(fuck);
// esc2.write(fuck);
// delay(3000);
//

 int e1 = 0,e2=0;
 for (e1=84;e1<90;e1++)
 {
  esc1.write(e1);
  delay(100);
  for (e2=80;e2<90;e2++)
    {
      esc2.write(e2);
      delay(1000);
    }
  }  

}


#5

A lot of ESC’s have a lockout that if they are powered up when the throttle is not at neutral they will not operate so the answer is probably yes. You should initialize the PWM to 90 degrees to essentially put the ESC in it’s idle state. I expect there is a bit of dead band around this so that as long as the PWM is operational withing a few seconds of the ESC being powered up it will not lock itself out.