Servo malfunction

I am making an automatic door for my chickens including a servo motor. In the process I actually shorted my 5V from my Arduino, for quarter of a second. The servo is powered by external batteries and only gets its signal by digital pin 9. After the shortening, the servo only wanted to go full power 1 way, I can't get it to move the other direction anymore. Does somebody know what happened and/or what to do?

The code I am using is the classic sweeping code for the servo. I tried changing it to digital pin 10, which didn't help. Also, the resistance when turning it by hand didn't change. I didn't smell anything bad.

Thanks!

Post a diagram showing how everything is currently wired, and your code, using code tags, as described in the "How to use this forum" post. Did you connect all the grounds?

Shorting outputs usually results in some permanent damage, but is perhaps not immediately fatal.

As an aside, cheap hobby servos are intended to move model control surfaces, not chicken coop doors and will burn out under heavy loads. Most people use linear actuators for doors, as shown here.

hi @jremington, thanks for thinking with me. I want to use the servo as motor as a pulley, with will lift a small plastic door with a cord. I hope this will be light enough. I added 2 images of the setup I have made with the wiring, using 2 led to indicate the up (yellow) and down (red) state. The 2 blue leds are to indicate if a button is pressed and is just wired to the 5 V. The buttons are attached to D4 and D5. The servo is connected to D10 is this case and to the 4 batteries. The solarpanel is wired to 5V, running through 3 1000 ohm resistors to A0.

Everything ran fine until I accidentaly shortened the 5V to GND. I hope you can say what is wrong!

Thanks in advance.

My code is:

#include <Servo.h>

Servo name_servo;

int servo_position = 0;
int button_open = 4;
int button_closed = 5;
int LEDRED = 12;
int LEDWHITE = 13;
int SUN = A0;

void setup () {
  name_servo.attach (9);
  pinMode(button_open, INPUT);
  pinMode(button_closed, INPUT);
  pinMode(LEDRED, OUTPUT);
  pinMode(LEDWHITE, OUTPUT);
}

void loop() 
{
  {
  int SUN = analogRead(A0);
  Serial.println(SUN);
  delay(1);   
  }
  if(digitalRead(button_open) == HIGH && servo_position >= 0)
  {
  digitalWrite(LEDRED,HIGH);
  digitalWrite(LEDWHITE, LOW);  
    for (servo_position = 180; servo_position >= 0; servo_position -=1) 
    {
      name_servo.write(servo_position);
      delay(10);
    }
    {
      delay(2000);
    }
  }
  if(digitalRead(button_closed) == HIGH && servo_position <= -1 || analogRead(SUN) >= 900 && servo_position <= -1)
  {
  digitalWrite(LEDRED,LOW);
  digitalWrite(LEDWHITE, HIGH);
    for (servo_position = 0; servo_position <=180; servo_position +=1) 
    {
      name_servo.write(servo_position);
      delay(10);
    }
    {
      delay(2000);
    }
  }  
}

robscorpius:
Everything ran fine until I accidentaly shortened the 5V to GND. I hope you can say what is wrong!

Thanks in advance.

Typically, when the supply is shorted to ground, the supply supplies/draws maximum current for a short time, then something gives up the smoke and opens, and no amount of code adjustments are going to fix the burnt component.

Sorry, I can't make sense of the photos. Please post a photo of a hand drawn wiring diagram, with pins and connections sensibly labeled. Just use rectangles for the components.

But there is really no point in continuing the project as it is, until you have verified that all the parts are actually working.

Test just the Arduino and servo (powered by the battery pack) by loading the simple servo sweep example from the Arduino IDE. If that doesn't work properly, time to go shopping.

The old adage applies here, "Check twice, buy once"

More specifically there are several steps its always worth doing:

  1. build the circuit
  2. check the circuit again against the schematic
  3. continuity check the supply rails are not shorted together and are getting to everything they should (this
    includes the ground connection).

Only then is it worth powering anything up.

Don't be tempted to tamper with a powered up circuit, power it down, make changes, check changes, repower.

Bit boring, but less boring than waiting for reordered parts to arrive(!)