Home        Store        Docs        Blog

Arduino / ESC boot sequence


(david) #1

Reading the docs, I see the following:

Note: If you power the Arduino before powering the ESC, then the ESC will miss the initialization step and won’t start. Power them up at the same time, power the ESC first, or press “reset” on the Arduino after applying power to the ESC.
Couldn't this be simply fixed by providing power to all at once but changing the arduino setup() code to delay BEFORE attaching the servo as follows: <div class="language-cpp highlighter-rouge"> <pre class="highlight"><span class="cp">#include <Servo.h> </span> <span class="n">byte</span> <span class="n">servoPin</span> <span class="o">=</span> <span class="mi">9</span><span class="p">;</span> <span class="n">Servo</span> <span class="n">servo</span><span class="p">;</span>

<span class=“kt”>void</span> <span class=“nf”>setup</span><span class=“p”>()</span> <span class=“p”>{</span>

&lt;pre class="highlight"&gt;<code>&lt;span class="n"&gt;    delay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// delay to allow the ESC to recognize the stopped signal
&lt;/span&gt;

<pre class=“highlight”><span class=“n”> servo</span><span class=“p”>.</span><span class=“n”>attach</span><span class=“p”>(</span><span class=“n”>servoPin</span><span class=“p”>);</span>
<span class=“n”> servo</span><span class=“p”>.</span><span class=“n”>writeMicroseconds</span><span class=“p”>(</span><span class=“mi”>1500</span><span class=“p”>);</span> <span class=“c1”>// send “stop” signal to ESC. </span>
}

&lt;/div&gt;

(david) #2

great! Lets try that again …

#include <Servo.h>

byte servoPin = 9;
Servo servo;

void setup() {
servo.attach(servoPin);

servo.writeMicroseconds(1500); // send “stop” signal to ESC.
delay(1000); // delay to allow the ESC to recognize the stopped signal
}


(Jacob) #3

I’m a little confused, because you said to delay before attaching to the servo, but have shown the opposite in code.

Also, the note says that the the esc will be initialized with the code provided, if you power the microcontroller and esc at the same time, like you are asking about.

The issue of powering the esc before the arduino still applies with your code.

-Jacob


(david) #4

sigh, yes that was wrong. Stupid cut and paste :-).

The original post that got mangled had the delay BEFORE, which is what I meant. What I intended was, will this code allow me to power everything on at once (i.e. flick a switch!) and have the ESC initialize properly

void setup() {

delay(1000);

servo.attach(servoPin);

servo.writeMicroseconds(1500);

}


(Rusty) #5

David,

The delay(1000) should be enough so that the ESCs will initialize if they and the Arduino are powered up at the same time. I suppose that’s a little confusing in the documentation. The important thing is that you don’t power up the Arduino first. As long as the ESCs are powered before or at the same time, it should be fine.

Thanks for the post!

-Rusty