Mood Cue
Mood Cue
COLLEGE OF
S
COMPUTER STUDIES
MOOD CUE
In the Subject
Submitted by:
Collamar, Abiegail R.
Submitted to:
Instructor I
COLLEGE OF
CC
S
COMPUTER STUDIES
TABLE OF CONTENTS
I. OVERVIEW
Servo motors are a special type of motor that don’t spin around in a circle,
but move to a specific position and stay there until you tell them to move
again. Servos usually only rotate 180 degrees (one half of a circle).
Combining one of these motors with a little cardboard craft, you’ll be able to
let people know if they should come and ask for your help on their next
project or not. 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. 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 library that allows you to easily control the motor.
Because the servo only rotates 180 degrees, and your analog input goes from
0-1023, you’ll need to use a function called map() to change the scale of the
values coming from the potentiometer. One of the great things about the
Arduino community are the talented people who extend its functionality
through additional software. It’s possible for anyone to write libraries to extend
the Arduino’s functionality. There are libraries for a wide variety of sensors
and actuators and other devices that users have contributed to the
community. A software library expands the functionality of a programming
environment. The Arduino software comes with a number of libraries that are
useful for working with hardware or data. One of the included libraries is
designed to use with servo motors.
MATERIALS
Table 1. The Materials and Equipment Used in the Laboratory Activity
The table above shows the different equipment and materials that are
need to understand the project to build which entitled “Mood Cue” where the
elements required are : potentiometer, servomotor, male headedpins and two
100uf capacitor.
II. PROCEDURES
1. Attach 5V and ground to one side of your breadboard from the
Arduino.
2. Place a potentiometer on the breadboard, and connect one side to 5V,
and the other to ground. A potentiometer is a type of voltage divider.
As you turn the knob, you change the ratio of the voltage between the
middle pin and power. You can read this change on an analog input.
Connect the middle pin to analog pin 0. This will control the position of
your servo motor.
3. The servo has three wires coming out of it. One is power (red), one is
ground (black), and the third (white) is the control line that will receive
information from the Arduino. Plug three male headers into the female
ends of the servo wires (see Fig. 3). Connect the headers to your
breadboard so that each pin is in a different row. Connect 5V to the red
wire, ground to the black wire, and the white wire to pin 9.
4. When a servo motor starts to move, it draws more current than if it
were already in motion. This will cause a dip in the voltage on your
board. By placing a 100uf capacitor across power and ground right
next to the male headers as shown in Fig. 1, you can smooth out any
voltage changes that may occur. You can also place a capacitor
across the power and ground going into your potentiometer. These are
called decoupling capacitors because they reduce, or decouple,
changes caused by the components from the rest of the circuit. Be
very careful to make sure you are connecting the cathode to ground
(that’s the side with a black stripe down the side) and the anode to
power. If you put the capacitors in backwards, they can explode.
void loop() {
ValuePot=analogRead(PinPot);//Reading PinPot
Serial.print(ValuePot);
Serial.print(Angle);
S
COMPUTER STUDIES
how to start things moving. A servomotor will be utilized to do this. As you are
probably aware, it is a type of motor that moves into a position and stays
there if no additional instructions are given. In addition, it should be
understood that a
servo that employ the same method used for PWM on the prior project to
inform the servo what angle it should rotate at. Nevertheless, that the
information sent
to the servo would either be one or the other based on the pulse width
adjustment. To achieve this, a potentiometer will be utilized as an analog
input. In this manner, the servo will rotate along with the potentiometer.
VI. REFERENCES
https://programminginarduino.wordpress.com/2016/03/01/project-05/