Introduction: Introduction

The following information is a single lesson in a larger project. Find more great projects here.

Project Overview:

In this project, you will use a servo motor to make a gauge that points out what mood you are in today! The servo is a special kind of motor that can go to a specific position and stay there. This project also uses a potentiometer, connected to an analog input, to control the position of the servo.

Step 1: Project Description

In this project you will use a servo motor to make a mechanical gauge that points to what sort of mood you're in today. You will move the servo motor to a specific position using a potentiometer knob.

In the circuit schematic below, you can see that the servo motor is powered by the 5V and GND pins and connects to digital pin 9. Pin 9 will deliver a sequence of on/off pulses to the servo to tell it how far to move. You can also see that the potentiometer is connected to 5V, GND and analog pin A0. Like many of the analog inputs that we use, the potentiometer acts as a voltage divider. Twisting the knob changes two resistance values (above and below the arrow symbol), and A0 sees a changing voltage. You will be learning how to program the Arduino so that twisting the potentiometer knob causes the servo's arm to turn.

  1. Continue to the next step.

Step 2: Bill of Materials

You will need the following electrical components for this project:

1 potentiometer

1 servo motor and motor arm

2 100 uF electrolytic capacitors

...and of course your Arduino Uno and a breadboard!

If you are using the physical Arduino kit, you will need to use pin headers to attach the servo motor to the breadboard. You will also need construction paper and pens to create the Mood Cue gauge.

  1. Can you match each component on the list to its location on the breadboard?

  2. Continue to the next step.

Step 3: Potentiometer

The potentiometer (also called a pot) is a voltage divider packaged in one component. Normally terminal 1 and terminal 3 (shown below) will be connected to ground and power in your circuit.

As you move the knob, called the "wiper," the values of two internal resistors shift, resulting in a new output voltage at the wiper pin. The unique thing about the potentiometer is that the two resistors R1 and R2 always add up to the same amount. Some examples are below.

  1. The pot in your Arduino kit is a 10 k-ohm potentiometer. That means R1 + R2 is always equal to 10,000 ohms. In our projects, this actually makes the output voltage really easy to calculate. It is always (R1/10,000) x 5 V.
  2. If the knob is sitting right in the center, R1 = R2. With a 5V power source, the output voltage will be the source cut in half: 2.5 volts.
  3. Suppose the knob turned partially clockwise so R1 = 8000 ohms and R2 = 2000 ohms. The output voltage will be 8/10 of the total, or 4 volts.
  4. Continue to the next step.
  5. Stuck? HINT: As an extra challenge, you can calculate the formula used in step 1 using what you know about a 2-resistor voltage divider.

Step 4: Servo Motors

A servo motor is a special type of motor that doesn't spin around in a circle, but moves to a specific position and stays there. Servos usually only rotate 180 degrees (one half of a circle).

  1. Similar to the way you used pulses to PWM an LED in the Color Mixing Lamp Project, servo motors expect a number of pulses that tell them what angle to move to.

  2. The pulses always come at the same time intervals, but the width varies between 1000 and 2000 microseconds. While it’s possible to write code to generate these pulses, the Arduino software comes with a command library that allows you to easily control the motor.

  3. Find the servo motor in the Components + menu (All Components tab) for more information.

  4. Continue to the next step

Step 5: Arduino Libraries

One of the great things about the Arduino community are the talented people who extend the platform's functionality through additional software called libraries. There are libraries for a wide variety of sensors and actuators and other devices that users have contributed to the community. The Arduino software comes with a number of libraries that contain extra commands and functions for a variety of input and output components. One of the included libraries is designed to use with servo motors.

  1. On your computer, the library was included in the Arduino file system when you downloaded the Arduino IDE.
  2. In the simulator, open the Code Editor window and click on the Libraries tab to view a short list of libraries that are available in this platform, including "servo."
  3. Continue to the next lesson to learn how to assemble the circuit!

Next Lesson:Setting Up the Circuit

Comments

About This Instructable

231views

1favorite

License:

More by circuits:Move Circuit AssemblyGlow Circuit AssemblyIntroduction
Add instructable to: