Uploaded by Gerard Austin Francisco

FRANCISCO ACEE12L-M LAB8 EE3B

advertisement
TECHNOLOGICAL UNIVERSITY OF THE PHILIPPINES
Ayala Boulevard, Ermita, Manila 1000
COLLEGE OF ENGINEERING
ELECTRICAL ENGINEERING DEPARTMENT
MICROPROCESSOR SYSTEM – LAB
Laboratory Activity 8
SUBMITTED BY:
GERARD AUSTIN A. FRANCISCO
BSEE – 3B
SUBMITTED TO:
ENGR. RYAN REYES
GRADES AND REMARKS
Familiarization on Servo Motors using Arduino
Activity:
1. Control a servo to move by 5 degrees counterclockwise until 180 degrees then
return by 5 degrees in the clockwise direction. Add indicator LEDs.
Working Circuit:
Program Blocks:
Program Codes
Observation and Conclusion
In this experiment, the aim is to familiarize in controlling a servo motor using an
Arduino. Knowing how to utilize a servo motor is very useful in robotics or projects. A servo
motor has three input pins. These are the Vcc, Gnd, and the control pin. The control pin is the
one we can plug into the Digital I/O of the Arduino to program it.
To be able to program a servo motor, you would need to import an additional
library. The code used for this is “#include <Servo.h>”. This library contains all the necessary
codes that simplifies the process of making the program codes for the servo motor. To make
the Arduino recognize the servo, you would need to use “servo.attach(pin, min, max)” code.
Then after that you can write more codes in the loop() that would control the servo motor
using the “servo.write()” code to make the servo move to that specified angle. Using a servo
motor with an Arduino is simple and easy to learn. After learning the codes, it is up to the
user on what the servo would be used for.
For the results of this experiment, I was able to make the servo motor first rotate by
5 degrees in the counterclockwise rotation. And while this is happening, only the red LED is lit
up. Then after reaching 180 degrees, the servo would then rotate in the clockwise direction
by 5 degrees back to the start. And while this is rotating in that direction, only the green LED
is lit up. For the conclusion of this experiment, a Servo motor is a programmable DC motor
that can be used in applications such as robotics or DIY projects. And that it is easily
programmable using the Servo library or utilizing code blocks.
Download