A servo motor is a motor that works in angles between 0° and 180°.
A servo motor is a motor that can be controlled by a microcontroller such as:
- Arduino
- Raspberry Pi Pico
- Micro:Bit
by sending pulses to the controller in the motor.
It has a small DC motor which only needs about 35 mA. It also has some gears and a potentiometer so that it can know which angle it's on.
ComponentsYou'll need:
- An Arduino (any Arduino will do as long as its 9th pin is a PWM pin)
- A servo motor
- Some jumper wires
- 5V 1A power source (you won't need this if you are using a single servo)
Connect the servo motor like this:
- Signal cable (orange one) ==> D9 on Arduino
- Power cable (red one) ==> 5v pin on Arduino
- Ground cable (black or brown one) ==> ground pin on Arduino
These are the classes and functions in Servo library:
Servo x;
x = the name that you'll use when calling the servo to do something.
x.attach(y);
y = the pin to attach servo.
x.write(pos);
pos = the angle that you want your servo motor to go (between 0° and 180°).
Comments