Laboratory Activity No. 3 Control of Servo Motor
Laboratory Activity No. 3 Control of Servo Motor
3
Control of Servo Motor
NAME:__________________________ DATE:_______________________
SECTION:_______________ INSTRUCTOR: ________________
Objectives
This experiment will enable the student
1. To control the angular displacement of the servomotor.
2. To create a computer program user interface to send data control to Arduino
Introduction:
In this activity we will going to control the movement of the robotic arm
which joints are compose of servo motors. The movement of the conveyor is
controlled through a program implemented in Visual Studio and Arduino. The
Arduino microcontroller will control the Servo motor and the visual studio will
provide the interface to execute commands.
The graphical user interface is compose of a track bar. The track bar is set
from a minimum value of 0 degree to the maximum angle rotation of the servo
motor of 180 degrees. Each time the track bar value change, the computer will
send the angle data which the microcontroller will execute. A label box is also
included for it to show the angle it will move.
Procedures
A. Set-up
1. Connect the computer and Arduino microcontroller using USB serial cable
2. Connect the black cable to ground, red cable to 5V and yellow to pin 9 of the
microcontroller respectively.
B. Arduino Program:
1. Create a program for the microcontroller that will control the angular displacement
of the motor by sending pulse with different width that correspond to the angle of the
servo motor.
C. Graphical User Interface
1. Create the GUI to the Microsoft visual studio as shown below.
D. Interface Code
1. Create code for the program that it will send angular value to the microcontroller
that correspond to the angular displacement for the servo motor. The motor will
rotate every time the track bar is pressed and change it value..