# Servo problems.

**URL:** <https://community.sparkfun.com/t/servo-problems/17858>\
**Category:** Arduino\
**Created:** [October 22, 2010, 3:54am UTC](https://community.sparkfun.com/t/servo-problems/17858 "2010-10-22T03:54:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jolijar](https://avatars.discourse-cdn.com/v4/letter/j/c5a1d2/32.png) [@jolijar](https://community.sparkfun.com/u/jolijar)\
**Post date:** [October 22, 2010, 3:54am UTC](https://community.sparkfun.com/t/servo-problems/17858/1 "2010-10-22T03:54:30Z")

</div>

I am trying to use the Arduino to turn on a servo, move it to a position, then turn the servo back off. I need the servo to be turned off because of power consumption issues among other reasons.

Here is my code

```auto
 #include <Servo.h> 
 
Servo myservo; // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
 
int pos = 0; // variable to store the servo position 
int Servo = 5; // Servo power connected to pin 5

void setup() 
{ 
  myservo.attach(9); // attaches the servo on pin 9 to the servo object 
  pinMode(Servo, OUTPUT); // Set a digital pin for the GPS Power
 
} 
 
 
void loop() 
{ 
  digitalWrite(Servo, HIGH); // Turn the Servo on
   myservo.write(10); // tell servo to go to position 
  digitalWrite(Servo, LOW); // Turn the Servo off
    delay(1000);                       
       digitalWrite(Servo, HIGH); // Turn the servo on  
    myservo.write(105); // tell servo to go to position 
    delay(1000);                        
 digitalWrite(Servo, LOW); // Turn the Servo off
  }

```

It works when I have the power line connected to the 5v pin on the Arduino however it will not work when it is plugged into pin 5 (or any other pin I set it to for that matter)

I use this same method successfully to power a GPS unit. Any ideas on why it will not work?

I thought maybe adding delays after the servo high and before the servo low might help but it does not.

Pin 5 reads 4.75v

5v Pin reads 4.80v

---

<div class="post-metadata">

**Author:** ![trialex](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@trialex](https://community.sparkfun.com/u/trialex)\
**Post date:** [October 22, 2010, 12:36pm UTC](https://community.sparkfun.com/t/servo-problems/17858/2 "2010-10-22T12:36:41Z")

</div>

An arduino digital pin can supply ~40mA of current.

Your servo power input needs more than that - your GPS doesn’t

Look for examples that show how to use a transistor to switch high current (or high voltage) lines.

---

<div class="post-metadata">

**Author:** ![jolijar](https://avatars.discourse-cdn.com/v4/letter/j/c5a1d2/32.png) [@jolijar](https://community.sparkfun.com/u/jolijar)\
**Post date:** [October 22, 2010, 11:48pm UTC](https://community.sparkfun.com/t/servo-problems/17858/3 "2010-10-22T23:48:15Z")

</div>

ok I got it working with a NPN transistor however even with the power to the transistor off the servo still makes noise. I can stop the noise by gently moving the servo arm (attached to a lock) I will not be able to do this when the unit is in operation. It is so loud you can hear it from several feet away. I don’t care how much noise it makes while it is moving but after it is done then I want it to be quiet. Any Ideas on how to make it quiet?

---

<div class="post-metadata">

**Author:** ![tecoist](https://avatars.discourse-cdn.com/v4/letter/t/f19dbf/32.png) [@tecoist](https://community.sparkfun.com/u/tecoist)\
**Post date:** [October 23, 2010, 1:29am UTC](https://community.sparkfun.com/t/servo-problems/17858/4 "2010-10-23T01:29:13Z")

</div>

If the servo is making noise, you haven’t powered it down. No power, no noise. I’d start looking there.

---

<div class="post-metadata">

**Author:** ![jolijar](https://avatars.discourse-cdn.com/v4/letter/j/c5a1d2/32.png) [@jolijar](https://community.sparkfun.com/u/jolijar)\
**Post date:** [October 23, 2010, 2:08am UTC](https://community.sparkfun.com/t/servo-problems/17858/5 "2010-10-23T02:08:32Z")

</div>

I measured the voltage and it goes from 4.8v to .01v

I guess the transistor has some leak-through Maybe if I double up on the transistors and then use two digital ports to control the servo.
