0
$\begingroup$

Summary

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

Detail

I want to use the servo as motor as a pulley, which 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 solar panel is wired to 5V, running through 3 1000 ohm resistors to A0.

Everything ran fine until I accidentally 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);
    }
  }  
}

This is how I wired everything.

$\endgroup$
2
  • 2
    $\begingroup$ Hi @Rob and welcome to Robotics. Without a lot more information, we will be unable to help you diagnose what happened or what to do. That being said, shorting electrical circuits is never good and can make things break in really strange ways. I would suggest replacing affected components. $\endgroup$ – Ben Jun 13 '19 at 23:09
  • $\begingroup$ In order to determine whether the short has damaged the Arduino, try a different Arduino or different pin. $\endgroup$ – Pete Kirkham Jun 17 '19 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.