The SG90 is a compact and lightweight servomotor widely used in the field of robotics and remote-controlled (RC) applications. Its popularity stems from its affordability and its ability to provide precise control of angular position. The SG90 is particularly well-suited for projects that require a simple and efficient method to control motion, such as small robotic arms, RC airplanes, and hobbyist projects.
Pin Number | Color | Description |
---|---|---|
1 | Brown | Ground (GND) |
2 | Red | Power Supply (VCC) |
3 | Orange | Control Signal (PWM) |
#include <Servo.h>
Servo myservo; // create servo object to control the SG90
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop() {
myservo.write(90); // sets the servo to mid-position (90 degrees)
delay(1000); // waits for a second
myservo.write(0); // moves the servo to position 0 degrees
delay(1000); // waits for a second
myservo.write(180); // moves the servo to position 180 degrees
delay(1000); // waits for a second
}
Q: Can I control the SG90 servomotor with a Raspberry Pi? A: Yes, the SG90 can be controlled with a Raspberry Pi, but you will need to generate PWM signals, which can be done using the GPIO pins and appropriate software libraries.
Q: How precise is the SG90 servomotor? A: The SG90 typically has a resolution of around 5 degrees, but this can vary slightly depending on the specific model and operating conditions.
Q: What is the lifespan of the SG90 servomotor? A: The lifespan depends on the usage conditions, such as load, frequency of operation, and environmental factors. Under normal conditions, the SG90 can last for several years of intermittent use.