NAQuarter 3 Module 3 Final
NAQuarter 3 Module 3 Final
Creative Technology 10
Quarter 3 - Module 3, week 4-5
Republic Act 8293, section 176 states that: No copyright shall subsist in
any work of the Government of the Philippines. However, prior approval of the
government agency or office wherein the work is created shall be necessary for
exploitation of such work for profit. Such agency or office may, among other things,
impose as a condition the payment of royalty.
Introductory Message
This part contains instructions for the learner and for the facilitator on how to
use the module
• For the Learner:
We are delighted to have you join us on this journey throughout the world of robotic
technology. This course will educate you regarding the essential modules and
elements that make up robotic systems. You'll learn how each module functions, how
they interact with one another, and how to combine them to form practical robots.
Ready for a journey into the captivating domains of sensors, actuators, control
systems, and programming. By the end of this course, you'll have a good basis for
creating and experimenting with your own robotic projects.
What I Know
Pre-Test
What’s In
What’s New
The Servo Library is a great library for controlling servo motors. In this article, you
will find two easy examples that can be used by any Arduino board.
The first example controls the position of an RC (hobby) servo motor with your
Arduino and a potentiometer. The second example sweeps the shaft of an RC servo
motor back and forth across 180 degrees.
Hardware Required
• Arduino Board
• Servo Motor
• 10k ohm potentiometer
• hook-up wires
• capacitors
• power supply
Servo motors have different power requirements depending on their size and the
workload they are experiencing. A common servo motor such as the Feetech Mini
Servo Motor requires between 4.8 - 6 V at 5 – 6 mA when idle. It doesn't take
very much energy to stand still.
But as soon as the motor starts moving, it starts using more energy, and it gets
that energy by pulling more current from the power source.
This high current-draw is generally not safe to draw from an Arduino board. To
avoid damaging our board we need to power the servo motor through an external
power supply. Choosing the correct power supply depends on the servo motor you
are using, so always check the specifications. Pay especially close attention to the:
To power a 4.8 - 6 V servo you could use a 5 V 1 A AC Adapter, cut the cable, and
connect the wires to the servo using e.g. a breadboard.
Note that USB wall chargers are limited to 500 mA (USB 2.0) or 900 mA (USB 3.0).
If your project needs to move around freely without being attached to a power outlet
you can also choose batteries to power the servo. If you need 5 V exactly you can
use two 18650 Li-Ion batteries together with a step-down converter.
A step-down converter is needed because 18650 Li-Ion batteries will give you
around 7.4 V. The max current depends on the specific battery but most of them
are designed to output above 1A which is enough to power our small servo.
If you are using bigger or more servos make sure to check your power requirements
accordingly.
Capacitors are recommended for powering servo motors. They help stabilize the
power supply, minimize voltage drops, and reduce electrical noise. The specific
capacitor values may vary based on the servo motor's requirements, but including
them is good practice for better performance and reliability.
Because some capacitors are polarised (meaning that they have a direction), you
may need to be careful with how you connect them to your circuit. Make sure to
connect them correctly by checking for markings such as a white stripe, a '+'
symbol, or a longer lead. If your capacitor has these, match the indicators of the
capacitor with your circuit (pay attention to the + and - signs), and be careful not
to exceed the voltage limits. This precaution helps prevent issues like leaks or
damage that could harm your circuit.
Circuit
Servo motors have three wires: power, ground, and signal. The power wire is
typically red, and should be connected to positive pole (+) of your power source. The
ground wire is typically black or brown and should be connected to the negative
pole (-) of your power source.
The signal pin is typically yellow or orange and should be connected to PWM pin on
the board. In these examples, it is pin number 9.
Knob Circuit
For the Knob example, wire the potentiometer so that its two outer pins are
connected to power (+5V) and ground, and its middle pin is connected to
A0
on the board. Then, connect the servo motor as shown in the circuit below.
Sweep Circuit
For the Sweep example, connect the servo motor as shown in the circuit below.
Examples
Knob
Controlling a servo position using a potentiometer (variable resistor).
#include <Servo.h>
int val; // variable to read the value from the analog pin
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
void loop() {
val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between
0 and 180)
Sweep
Sweeps the shaft of a RC servo motor back and forth across 180 degrees.
#include <Servo.h>
void setup() {
void loop() {
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
What is It
What’s More
#include <Servo.h>
int val; // variable to read the value from the analog pin
void setup() {
void loop() {
val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between
0 and 180)
What I Can Do
Performance Task. Group Activity.
Directions: Execute the Sweep Circuit Code using Arduino IDE with complete
diagram.
Group #:
Group Name:
Date:
1.
2.
3.
4.
5.
Assessment
Post-Test
1. What is a primary use of a servo motor in robotics?
A) Measuring temperature
B) Controlling rotational movement
C) Storing data
D) Generating sound
2. Which type of signal is used to control a servo motor?
A) Analog signal
B) Pulse Width Modulation (PWM)
C) Digital signal
D) Direct current (DC)
Additional Activities
Answer Key
What’s More
What I Have Learned
References
• Include all third party materials or sources in developing the material
• Follows the Chicago Manual of Style 17th edition
https://docs.arduino.cc/learn/electronics/servo-motors/
You can also visit the Servo GitHub repository to learn more about this library.