
Driving a Servo Motor — SIK Circuit 8
คำแนะนำ
Parts & Introduction
Parts & Introduction
A servo motor can be precisely positioned between 0 and 180 degrees. Unlike a regular motor that just spins, servos hold their position — making them perfect for robotics, pan/tilt mechanisms, and control surfaces. This experiment introduces the Servo library.
Parts Needed
- 1x Arduino Uno + USB cable
- 1x Breadboard
- 1x Servo Motor (with 3-pin header)
- 8x Jumper Wires
The servo has three wires: Red (power), Black (ground), White (signal).
วัสดุสำหรับขั้นตอนนี้:
SparkFun Inventors Kit - V3.21 ชุด
Arduino Uno R31 ชิ้น
Breadboard1 ชิ้น
Servo Motor1 ชิ้น
Jumper Wires3 ชิ้นเครื่องมือที่ต้องใช้:
Hardware Hookup
Hardware Hookup
Wiring Instructions
- Connect 3 jumper wires to the servo's female 3-pin header for breadboarding.
- Connect the Red wire to 5V.
- Connect the Black wire to GND.
- Connect the White wire (signal) to Digital Pin 9.
Power Note: Servos draw significant current. If the servo twitches and the Arduino resets, use a wall adapter instead of USB power, or power the servo from a separate 5V supply.
วัสดุสำหรับขั้นตอนนี้:
Servo Motor1 ชิ้น
Jumper Wires3 ชิ้นArduino Code
Arduino Code
Open the Arduino IDE and upload the following sketch to your Arduino board.
/*
SparkFun Inventor's Kit
Example sketch 08 — SINGLE SERVO
Sweep a servo back and forth through its full range of motion.
Hardware connections:
Servo RED wire (power) to 5V
Servo WHITE wire (signal) to digital pin 9
Servo BLACK wire (ground) to GND
This code is completely free for any use.
*/
#include <Servo.h>
Servo servo1;
void setup()
{
servo1.attach(9);
}
void loop()
{
int position;
// Quick moves to specific positions
servo1.write(90); // Go to 90 degrees
delay(1000);
servo1.write(180); // Go to 180 degrees
delay(1000);
servo1.write(0); // Go to 0 degrees
delay(1000);
// Slow sweep to 180 degrees (2-degree steps)
for(position = 0; position < 180; position += 2)
{
servo1.write(position);
delay(20);
}
// Slow sweep back to 0 degrees (1-degree steps)
for(position = 180; position >= 0; position -= 1)
{
servo1.write(position);
delay(20);
}
}วัสดุสำหรับขั้นตอนนี้:
Arduino Uno R31 ชิ้นเครื่องมือที่ต้องใช้:
Test & Experiment
Test & Experiment
What You Should See
The servo quickly moves to 90°, 180°, and 0° (1 second each), then slowly sweeps from 0° to 180° and back.
Troubleshooting
- Servo not moving: Even with colored wires, it's easy to plug a servo in backwards. Check connections.
- Twitching/resetting: The servo draws too much power from USB. Use a wall adapter or separate power supply.
Experiments to Try
- Add a potentiometer (from Circuit 2) to control servo position with a knob.
- Change the step size and delay to experiment with speed and smoothness.
- Build a simple pan/tilt mechanism with two servos.
วัสดุ
5- $105.00
- 1 ชิ้นตัวยึดตำแหน่ง
- 1 ชิ้นตัวยึดตำแหน่ง
- 1 ชิ้นตัวยึดตำแหน่ง
You might also need
Materials makers commonly use alongside this build.
Related blueprints
Other builds that share materials, tools, or techniques with this one.






CC0 สาธารณสมบัติ
พิมพ์เขียวนี้เผยแพร่ภายใต้ CC0 คุณสามารถคัดลอก แก้ไข แจกจ่าย และใช้งานผลงานนี้เพื่อวัตถุประสงค์ใดก็ได้ โดยไม่ต้องขออนุญาต
สนับสนุนเมกเกอร์โดยซื้อสินค้าผ่านพิมพ์เขียวของพวกเขา ซึ่งพวกเขาจะได้รับ ค่าคอมมิชชันเมกเกอร์ ที่ผู้ขายกำหนด หรือสร้างเวอร์ชันใหม่ของพิมพ์เขียวนี้และรวมเป็นการเชื่อมต่อในพิมพ์เขียวของคุณเพื่อแบ่งรายได้







