Servo motor not working

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 ?

Anything we can do here

Start by posting your code but please see Read this before posting a programming question and follow the advice given.

How is the servo powered ?

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

  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

  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: ");

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

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

  // set the servo position

  // wait for the servo to get there

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

Thanks !

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

We fixed it! The capacitor was badly connected :)

Thanks for you help!

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 ?

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

Does the Sweep example work correctly ?