Lessons on Arming ESC with Arduino


i find question in internet - , see go unanswered. here stepwise guide arm brushless esc using arduino. usual disclaimer applies: 1) general guide know arming point - not specific answer; 2) may kill arduino / esc / motor or computer - not responsible.

having gotten them out of way:

code: [select]

#include <servo.h>

servo motor;

void setup ()
{
  motor.attach(9);
  serial.begin(9600);
  int = 0;

  //give time before start switching on esc / motor

  serial.print("arming test starts in ");
  for(i =10; > 0; i--)
  {
     serial.print(i);
     serial.print(".. ");
  }

  serial.println();

// watch tone when esc gets armed

  for(i = 50; < 130; i++)
  {
     motor.write(i);
     serial.println("i");
     delay(500);
  }
}

void loop()
{
}


when run on esc, first gives 10sec setup / switch on stuff. when switch on esc, hear double beep (note tone). second loop after delay starts - sends 1 degree worth of pulse every 500 millisecs esc. have intentionally made wide range (50 - 130), whereas esc arm close neutral.

when signal esc reaches 87 - 93, pay attention - esc let out beep. different 1 heard when switching on.

there bit of experimentation needed here pinpoint exact arming position. esc, - following, arm it.
code: [select]
void setup()
{
   motor.attach(9);
   motor.write(91);
   delay(300);
}


note 1: esc arms @ signal of "91". esc, may 90 or 92.

note 2: delay crucial. have gone down till 200 millisecs , still got working. try pushing limit, , post reply if can it.


once esc has been armed, simple case of treating angle run signal esc. example - see code below

code: [select]

void loop()
{
  motor.write(105); delay(1000);
  motor.write(91); delay(2000);
}



will repeatedly run motor 1 second, , brake 2 seconds. now, once esc armed - signal code "91" merely treated servo angle signal , not repeatedly arm esc (until switch power off , on again).

i still trying forward , reverse turns on motor reliably - happens sporadically. post second post once have got down pat.

i hope helps.

here, provide sample code managed run car autonomously (meaning: ran without tx / rx).

code: [select]

#include<servo.h>

servo esc;

void setup()
{
  esc.attach(9);
/*
as can see - not arming esc here.
for reason, esc on persistently armed mode now.
upon powering, esc automatically arms.
given sparse documentation esc, not examining behavior change.

however, if esc refuses arm, see first post in thread.
*/

//again - useful during testing part. autonomous running, pointless.

  int i=0;
  serial.begin(9600);
}

void loop()
{
  int i=0;
  // start @ servo degree 70 , go till above neutral.
  // note, neutral @ 94 esc.
  // run in 1 direction.
  for(i=70;i<95;i++)
  {
    esc.write(i);
    delay(200);
  }
//run 2 seconds @ moderately high speed (70).
  esc.write(70); delay(2000);
// apply brakes 40 millisecs.
  esc.write(100); delay(40);
// apply throttle in opposite direction 2 seconds.
  esc.write(110); delay(2000);
// bring down throttle neutral.
  for(i=110;i>90;i--)
  {
    esc.write(i);
    delay(200);
  }
// apply brakes again - change directions 40 millisecs.
  esc.write(70); delay(40);
}



this code has not been rigorously tested @ all. example, there no reason why used 40 millisecs instead of, say, 35. have noticed @ pulse frequency (50hz / 20 millisecs) code doesn't work. so, in likelihood, 21ms work. - don't know happen if bring run throttle (70 , 110) closer neutral (say,
85 , 100). in cases, esc behavior abruptly changes, , direction shifting doesn't happen (it stops running in 1 of directions).

however, code has allowed rc car move forward , in reverse without external input @ all. (time drink).

given below photo of car had used purpose - traxxas / tt rip-off rally frame. big (1/10) frame has plenty of room / power carrying arduino board, 7200 mah nimh battery car, 10000mah usb power bank (used power arduino board) , else in between. have not provided connection drawing, because - @ point - trivial.


Arduino Forum > Using Arduino > Motors, Mechanics, and Power (Moderator: fabioc84) > Lessons on Arming ESC with Arduino


arduino

Comments

Popular posts from this blog

DHT11 Time out error using v0.4.1library

Sketch upload fails with Java error (___REMOVE___/bin/avrdude)!

Arduino Uno + KTY81/210 temperature sensor