Go Down

Topic: ESC- electronic speed control- brushless motor (Read 2715 times) previous topic - next topic

janeik

Jan 07, 2012, 04:17 pm Last Edit: Jan 07, 2012, 04:23 pm by janeik Reason: 1
hello. I cant currently post at Hobbyking forum due to error.

I bought this for my pupils to be able to regulate speed of a brushless motor.

http://www.hobbyking.com/hobbyking/store/uh_viewItem.asp?idProduct=659

Theres no need for direction motor control as the direction is fixed. (else I could have used a H-bridge to achieve this).

My thoughts is to send a pwm signal to input of the ESC from a pwm output of Arduino UNO and MEGA.

My consern is programming the ECS unit.

Do I need to program it initially (once)  ,in any way?

Ive seen some adv. regarding programming units for ESC's without any furhter informations. Does that ease up ,if any, programming of ESC?

Do I need to program it initially (once)  sending pwm signal from the arduino?

Thank You.



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.

Lefty




janeik

#2
Jan 07, 2012, 04:53 pm Last Edit: Jan 07, 2012, 04:55 pm by janeik Reason: 1
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


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.

Lefty





zoomkat

Previous post concerning ESCs for study.

http://www.google.com/search?q=esc+site%3Ahttp%3A%2F%2Farduino.cc%2Fforum%2Findex.php&hl=en&num=100&lr=&ft=i&cr=&safe=images
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

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.)



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).

Code: [Select]

// 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
  }
}

Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

janeik


Previous post concerning ESCs for study.

http://www.google.com/search?q=esc+site%3Ahttp%3A%2F%2Farduino.cc%2Fforum%2Findex.php&hl=en&num=100&lr=&ft=i&cr=&safe=images



Thank You very much for the informations. I will study them.

regards

janeik


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.

regards

janeik

Thanks for sharing this one.

Regards


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).

Code: [Select]

// 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
  }
}



gnkira

Hi, janeik

Are the codes here suitable for Atmega 2560 to try on it ?



regards.


MarkT

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.
[ I won't respond to messages, use the forum please ]

Go Up