Arduino resetting

Good afternoon,

I'm not sure if this is the right board, but because I think it has to do with the arduino itself I post it here. My excuses if not so.

I'm developing a self controlling quadcopter and today I had an accident. For testing I had one propellor attached to it. When I decided to reset the arduino with the red button on it, the ESC stopped for 2 seconds and after that is goes 100% throttle for about 3 seconds, with the result it hit me... Two large slices on my arm around my wrist...

Anyway, the question I have: What is the reason the ESC got max input? It's not programmed to do so! I found it does the same when I change the baud rate.

What's happening here? Has it something to do with the arduino or is the ESC the cause? I thought from not because the esc receives pwm input from the arduino.

Thanks! :slight_smile:



When the Arduino resets, it's no longer sending a signal out on those pins - depending on the exact ESC, this could make it turn on.

If it's active high, put external pulldowns on the control pins (assuming it's taking a normal PWM signal), if active low, put external pullups on the control pins - that way when the arduino pins are tristated, the ESC won't turn itself on.

As an aside, always keep your hands clear of the propellers when the power is on, so you don't get your hands cut up in the event of a fault.

Hi Drazzy,

Thanks for your answer. I don't really understand. Do you mean with 'active low': if t don't receive a signal, 100% throttle? But what do you mean with 'high'? If it's high it is working as it should.

A little more explanation, if possible.

I have learnt of this accident, yeah... For a little I thought my artery was cut. :') But offcourse, it always can be worse..

Only i'm wondering how I can test motor response without tilting my quadcopter. :confused: hmmmm



Edit: I found that if i use another code, it don't gives this behaviour when I press the reset button. Difference is that this other code input from serial needs(pwm input). It's not actually for flying.

"active high" means that when the pin is high (ie, 5v or w/e), the whatever it is (in this case the motor) is on.

"active low" means that when the pin is low (ie, 0v), the thing is on.

So the behavior is different with different code? That suggests a bug in the code that you didn't post.

My first guess (since I don't have your code to look at, nor the specs of the ESC) would be that it's active low, and you do pinMode(motorPin,OUTPUT) in setup - but you didn't first do digitalWrite(motorPin,HIGH), so when you set it as output, it drives the pin low, turning the motor on 100%... But if it's not active low, that wouldn't make sense :wink:

Also, depending on the ESC, if the pins are high impedance, rather than being pulled towards the off state, when the arduino was in reset or running bootloader, the arduino pins would also be high impedance, so those pins would be floating, and could thus make it turn on on it's own - so in that case, you'd want pullup/pulldown resistors as appropriate.


Aha, thanks for explanation!

I found the issue.... It's due to a delay(5000) in the setup... If I comment out that line it's is works normal when I press the reset button or change the baudrate.

void setup() {
  //digitalWrite(MOTOR_PIN_1, HIGH);
  //digitalWrite(MOTOR_PIN_2, HIGH);
  //digitalWrite(MOTOR_PIN_3, HIGH);
  //digitalWrite(MOTOR_PIN_4, HIGH);
  while (!Serial);
  while (Serial.available() &&;
  // Conects I2C

I tried digital write, but that didn't make the difference. Now I know it's that first delay, I'm wondering why that creates this issue. The second delay doesn't. That one is to properly arm the ESC.

Anyway, do I need to implement one of these suggestion for safety? Or is the issue fixed this way. I don't know if it's active high or low. I'm using the Afro Esc from hobbyking.



Edit: Wait, I need to investigate further... It did the same, 2 minutes ago...

Edit2: I found that the time the motor is spinning full throttle, is related to this delay. The 'edit' before, I said, it did the same with this settings for 1 time. I don't know why. It happened when I changed the baud rate and put it back again to the correct baudrate, because the serial didn't output.

Edit3: I read the following article Pull-up Resistors -, and found I can enable internal pull-up resistors with pinmode. But does this make any sense, since we don't know it's active high or low?