# Servo motor not working

**URL:** <https://forum.arduino.cc/t/servo-motor-not-working/644960>\
**Category:** Starter Kit\
**Created:** [March 28, 2020, 1:19pm UTC](https://forum.arduino.cc/t/servo-motor-not-working/644960 "2020-03-28T13:19:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![nickelnoff](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/nickelnoff/32/522883_2.png) [@nickelnoff](https://forum.arduino.cc/u/nickelnoff)\
**Post date:** [March 28, 2020, 1:19pm UTC](https://forum.arduino.cc/t/servo-motor-not-working/644960/1 "2020-03-28T13:19:44Z")

</div>

Hello - this is our first post.

We are trying to get Project 05 - Mood Cue - from the Starter Kit working.

We are almost there however the servo motor is not spinning and making a clicking noise.

The Serial Monitor is showing variable pot and angle values but no activity on the servo.

Anything we can do here or do we most likely have a broken servo ?

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [March 28, 2020, 1:21pm UTC](https://forum.arduino.cc/t/servo-motor-not-working/644960/2 "2020-03-28T13:21:42Z")

</div>

> Anything we can do here

Start by posting your code but please see [Read this before posting a programming question](https://forum.arduino.cc/index.php?topic=97455.0) and follow the advice given.

How is the servo powered ?

---

<div class="post-metadata">

**Author:** ![nickelnoff](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/nickelnoff/32/522883_2.png) [@nickelnoff](https://forum.arduino.cc/u/nickelnoff)\
**Post date:** [March 28, 2020, 3:05pm UTC](https://forum.arduino.cc/t/servo-motor-not-working/644960/3 "2020-03-28T15:05:21Z")

</div>

The code is the standard code from the project p05-ServMoodIndicator - it is follows:

```cpp
/*
  Arduino Starter Kit example
  Project 5 - Servo Mood Indicator

  This sketch is written to accompany Project 5 in the Arduino Starter Kit

  Parts required:
  - servo motor
  - 10 kilohm potentiometer
  - two 100 uF electrolytic capacitors

  created 13 Sep 2012
  by Scott Fitzgerald

  http://www.arduino.cc/starterKit

  This example code is part of the public domain.
*/

// include the Servo library
#include <Servo.h>

Servo myServo;  // create a servo object

int const potPin = A0; // analog pin used to connect the potentiometer
int potVal;  // variable to read the value from the analog pin
int angle;  // variable to hold the angle for the servo motor

void setup() {
  myServo.attach(9); // attaches the servo on pin 9 to the servo object
  Serial.begin(9600); // open a serial connection to your computer
}

void loop() {
  potVal = analogRead(potPin); // read the value of the potentiometer
  // print out the value to the Serial Monitor
  Serial.print("potVal: ");
  Serial.print(potVal);

  // scale the numbers from the pot
  angle = map(potVal, 0, 1023, 0, 179);

  // print out the angle for the servo motor
  Serial.print(", angle: ");
  Serial.println(angle);

  // set the servo position
  myServo.write(angle);

  // wait for the servo to get there
  delay(60);
}

```

The servo is powered through the USB cable from my laptop (which is plugged in to power)

Thanks !

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [March 28, 2020, 3:19pm UTC](https://forum.arduino.cc/t/servo-motor-not-working/644960/4 "2020-03-28T15:19:47Z")

</div>

Check the wiring to the servo. Exactly how is it connected to the Arduino and power ?

---

<div class="post-metadata">

**Author:** ![nickelnoff](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/nickelnoff/32/522883_2.png) [@nickelnoff](https://forum.arduino.cc/u/nickelnoff)\
**Post date:** [March 28, 2020, 3:32pm UTC](https://forum.arduino.cc/t/servo-motor-not-working/644960/5 "2020-03-28T15:32:34Z")

</div>

We fixed it! The capacitor was badly connected 🙂

Thanks for you help!

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [March 28, 2020, 4:40pm UTC](https://forum.arduino.cc/t/servo-motor-not-working/644960/6 "2020-03-28T16:40:04Z")

</div>

What is the purpose of the capacitor and how is it connected to the circuit ?

> The servo is powered through the USB cable from my laptop (which is plugged in to power)

I don't understand what you have said. Is the servo getting its current via the Arduino ?

---

<div class="post-metadata">

**Author:** ![nickelnoff](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/nickelnoff/32/522883_2.png) [@nickelnoff](https://forum.arduino.cc/u/nickelnoff)\
**Post date:** [March 28, 2020, 7:22pm UTC](https://forum.arduino.cc/t/servo-motor-not-working/644960/7 "2020-03-28T19:22:07Z")

</div>

Correct - the servo is receiving power via Arduino. The Arduino is powered via USB,

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [March 28, 2020, 7:28pm UTC](https://forum.arduino.cc/t/servo-motor-not-working/644960/8 "2020-03-28T19:28:06Z")

</div>

Does the Sweep example work correctly ?

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 5:34pm UTC](https://forum.arduino.cc/t/servo-motor-not-working/644960/9 "2021-05-06T17:34:00Z")

</div>

Closed on May 6, 2021, 5:34pm UTC


