Pages: [1]   Go Down
Author Topic: Weird ESC behavior  (Read 632 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey,
I' am actually trying to drive a coil with an Arduino (Mega or Uno). The coil is actually pretty big, and is plugged to DC 12V 10A generator.
I thought I could use an RC ESC actually I have a I can easily drive the coil threw both of them, just connecting them where the motor is supposed to be and use my RC emitter. It works nice so i thought i was close to achieve what i wanted to do.

But then here is the pain, Driving the coil threw my receiver is not what i want, so i just : "Okay, I'll drive it threw my Arduino board just like i would drive a servo".

I've been searching and trying tons of tricks to make it work but NOTHING.
My actual conclusion is that the signal generated by the Arduino isn't clean enough for the ESC, Servos work perfectly.
I'll clarify :
On the first ESC the LED is on when power is connected, then when the neutral position is given it Arms, and the LED turns off.
But when connected to the arduino, even if the Arduino is off and the ESC on, the LED is blinking but not as if it was an error indicator but more like if the signal wasn't steady. If i unplug the output, the led stays on steady.

So that is the first question, why would the arduino, even off, disturb the signal?

Then if i turn on the arduino, same, the LED blinks weirdly.
In this case, the ESC won't arm because the signal seems to be non stable.
I've been trying in all sorts of way,
  • The ESC plugged to the arduino with the sweep example (worked for a servo!)
  • The ESC plugged to the arduino and the receiver signal pin plugged to another pin of the arduino with a simple program doing : DigitalWrite(ESCpin, DigitalRead(RECpin)) (Worked for a servo!)
  • And a very interesting one : When i add a cable from the signal pin of the receiver to the signal pin of the ESC the LED starts blinking weirdly again...

Seems that there is the same problem with the other one, even if there is no LED blinking or ERROR stating.
If someone has an idea, i'd love to hear about it!
Thank you in advance.
Austr1ker.

PS: i tried to raise the frequency of the board but no effects.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for your reply.
Yes, i did try to Calibrate the ESC, actually, it worked once, don't know why, but then couldn't control the coil. Then when i try to calibrate it, it always comes back to the first step, wich means that it didn't work.
I tried a lot of code but here are some examples of what i have used :
tried that (works for a servo) :
Code:
/ zoomkat 10-4-10 serial servo test
// type servo position 0 to 180 in serial monitor
// for writeMicroseconds, use a value like 1500
// for IDE 0019 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.attach(7);  //the pin for the servo control
  Serial.println("servo-test-21"); // so I can keep track of what is loaded
}

void loop() {

  while (Serial.available()) {
    delay(10); 
    if (Serial.available() >0) {
      char c = Serial.read();  //gets one byte from serial buffer
      readString += c; //makes the string readString
    }
  }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured string
    int n;
    char carray[6]; //converting string to number
    readString.toCharArray(carray, sizeof(carray));
    n = atoi(carray);
    myservo.writeMicroseconds(n); // for microseconds
    //myservo.write(n); //for degees 0-180
    readString="";
  }
}
Or :
Code:
#include <Servo.h>

Servo myservo;

void arm(){
  // arm the speed controller, modify as necessary for your ESC 
  setSpeed(0);
  delay(1000); //delay 1 second,  some speed controllers may need longer
}

void setSpeed(int speed){
  // speed is from 0 to 100 where 0 is off and 100 is maximum speed
  //the following maps speed values of 0-100 to angles from 0-180,
  // some speed controllers may need different values, see the ESC instructions
  int angle = map(speed, 0, 100, 0, 180);
  myservo.write(angle);   
}

void setup()
{
  myservo.attach(9);
  arm(); 
}


void loop()
{
  int speed;

  // sweep up from 0 to to maximum speed in 20 seconds
  for(speed = 0; speed <= 100; speed += 5) {
    setSpeed(speed);
    delay(1000);
  }
  // sweep back down to 0 speed.
  for(speed = 95; speed > 0; speed -= 5) {
    setSpeed(speed);
    delay(1000);
  }
  setSpeed(0); 
  delay(5000); // stop the motor for 5 seconds



With the receiver plugged on pin 7 and the ESC or a servo on 6 (works for a servo). 
Code:

void setup()
{
  pinMode(6, OUTPUT);     
  pinMode(7, INPUT);     
}

void loop()
{
  digitalWrite(6, digitalRead(7));    // sets the LED to the button's value
}


I am actually triying to solve this weird signal non stability when the signal is plugged to the Digital (EDIT : All pins) Pin of the Arduino wich is off!

EDIT : When the power is on no Blinking Anymore. that's a good step. I'll try writeMicroseconds. Have you got a working example?

Thanks.
« Last Edit: June 13, 2011, 12:06:03 pm by Austr1ker » Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You may want to read the many previous post on the forum dealing with the ESC subjects below.

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&tbs=
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17262
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I also suspect your problem is all around the proper 'arming procedure' your ESC requires before it will except commands and actually try and power the magnet. And by all means deal with using writeMicroseconds(n) commands and keep the values from 1000 (0% stopped) to 2000 (100% speed). Also keep in mind that your ESC will only 'reset' and reenter the arming mode when first powered up, so you have to allow for the proper sequencing of when your arduino sketch starts that the ESC is in the ready for arming condition. In a complete RC system all the components are powered up at the same time, and it's not clear how your setup is sequencing start-up.

Lefty
« Last Edit: June 13, 2011, 07:57:37 pm by retrolefty » Logged

Pages: [1]   Go Up
Jump to: