The proper way to interface a ESC to a Arduino is using the servo library commands, not analogWrite PWM commands. ESCs are built to emulate acting just like a servo from a control point of view. Also you will need to find out the proper 'arming' commands to activate the ESC from the arduino. Arming is a safety feature on ESC that's prevents them from starting off when first powering on. Usually it's a sequence of 100% signal for one second or so, 0% for one second or so, and wait for ESC to beep signifying it's ready to accept servo speed commands. Yours may have a different sequence so read the operators manual for the ESC.
hi Lefty
Thanks for replying.
Ok, servo lib will be used then. I just think i noticed ,for the motor, said 8k PWM.
Never touched into r/c esc tuning before. It describes tuning process seen thowards a finished rc-system. I have no idea howto realize that thowards a arduino output.
Ive seen some esc tuning kits, wonder if they ease up the settings of asc, eliminating use of rc-unit?
regards
retrolefty:
The proper way to interface a ESC to a Arduino is using the servo library commands, not analogWrite PWM commands. ESCs are built to emulate acting just like a servo from a control point of view. Also you will need to find out the proper 'arming' commands to activate the ESC from the arduino. Arming is a safety feature on ESC that's prevents them from starting off when first powering on. Usually it's a sequence of 100% signal for one second or so, 0% for one second or so, and wait for ESC to beep signifying it's ready to accept servo speed commands. Yours may have a different sequence so read the operators manual for the ESC.
If you look under the files tab, (in the link you provided) you can find the manual.
As far as I can see the only arming process required is that you should make a loop lasting a couple of seconds while
writing 0 or 180 using the servoLib (that should correspond to throttle stick set at 0.)
Servo test code you can try with the ESC. Send a 0, wait a couple of seconds, then send a 90 to see if the ESC arms (or what ever arming sequence is used with the ESC).
// zoomkat 10-22-11 serial servo test
// type servo position 0 to 180 in serial monitor
// or for writeMicroseconds, use a value like 1500
// for IDE 0022 and later
// Powering a servo from the arduino usually *DOES NOT WORK*.
String readString;
#include <Servo.h>
Servo myservo; // create servo object to control a servo
void setup() {
Serial.begin(9600);
myservo.writeMicroseconds(1500); //set initial servo position if desired
myservo.attach(7); //the pin for the servo control
Serial.println("servo-test-22-dual-input"); // so I can keep track of what is loaded
}
void loop() {
while (Serial.available()) {
char c = Serial.read(); //gets one byte from serial buffer
readString += c; //makes the string readString
delay(2); //slow looping to allow buffer to fill with next character
}
if (readString.length() >0) {
Serial.println(readString); //so you can see the captured string
int n = readString.toInt(); //convert readString into a number
// auto select appropriate value, copied from someone elses code.
if(n >= 500)
{
Serial.print("writing Microseconds: ");
Serial.println(n);
myservo.writeMicroseconds(n);
}
else
{
Serial.print("writing Angle: ");
Serial.println(n);
myservo.write(n);
}
readString=""; //empty for next input
}
}
Erni:
If you look under the files tab, (in the link you provided) you can find the manual.
As far as I can see the only arming process required is that you should make a loop lasting a couple of seconds while
writing 0 or 180 using the servoLib (that should correspond to throttle stick set at 0.)
Hi thanks for answer.
The inputs to uC are comming from thumbpotentiometer. Well see to it that the informations input to the servp is of values 0-180 using the thumbpot.
I hope the servolib manages upto 4 diffrent servoes. Thats something Ill have to checkout.
zoomkat:
Servo test code you can try with the ESC. Send a 0, wait a couple of seconds, then send a 90 to see if the ESC arms (or what ever arming sequence is used with the ESC).
// zoomkat 10-22-11 serial servo test
// type servo position 0 to 180 in serial monitor
// or for writeMicroseconds, use a value like 1500
// for IDE 0022 and later
// Powering a servo from the arduino usually DOES NOT WORK.
String readString; #include <Servo.h>
Servo myservo; // create servo object to control a servo
void setup() {
Serial.begin(9600);
myservo.writeMicroseconds(1500); //set initial servo position if desired
myservo.attach(7); //the pin for the servo control
Serial.println("servo-test-22-dual-input"); // so I can keep track of what is loaded
}
void loop() {
while (Serial.available()) {
char c = Serial.read(); //gets one byte from serial buffer
readString += c; //makes the string readString
delay(2); //slow looping to allow buffer to fill with next character
}
if (readString.length() >0) {
Serial.println(readString); //so you can see the captured string
int n = readString.toInt(); //convert readString into a number
One hint that might help with arming - don't expect an ESC to respond to a sudden discontinuous change in command angle -
it may assume this is due to co-channel interference and simply cut-out. Ramp the servo.write () values up and down
smoothly (its also a lot safer, RC brushless motors are extremely high power - if connected to a propeller they can cut a finger
to the bone without the slightest problem - this is why an arming sequence is used and why it beeps before starting).
If the motor is spinning anything like a prop then goggles and gloves are strongly advised.