🔹 Step 1: Components Needed
✅ Microcontroller – Arduino Nano/Uno
✅ Servo Motor – SG90 (small) or MG996R (stronger)
✅ Power Supply – 5V (for servos)
✅ Potentiometer (optional) – For manual control
✅ Jumper Wires & Breadboard
🔹 Step 2: Circuit Connection
Arduino Pin | SG90 |
---|---|
5V | Red (VCC) |
GND | Brown (GND) |
Pin 9 (PWM) | Orange (Signal) |
🔹 Step 3: Code for Basic Servo Control
If using Arduino, you can use the standard Servo.h library.
🔹 Code for Arduino (Basic Servo Movement)
#include <Servo.h>
Servo myServo;
void setup() {
myServo.attach(9); // Servo connected to Pin 9
}
void loop() {
myServo.write(0);
delay(1000);
myServo.write(90);
delay(1000);
myServo.write(180);
delay(1000);
}
🔹 Step 4: Upload Code
🔹 What’s Next?
✅ Once you get the servo moving, we can:
- Add a second servo for more movement
- Use a potentiometer for manual control
- Start designing a simple robotic leg or arm