Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use Servo SG90: Examples, Pinouts, and Specs

Image of Servo SG90Design with Servo SG90 in Cirkit Designer

Introduction

The Servo SG90 is a small, lightweight servo motor widely used in hobby projects, robotics, and remote-controlled devices. It is designed to provide precise control of angular position, making it ideal for applications such as steering mechanisms, robotic arms, and pan-tilt camera systems. Its compact size, affordability, and ease of use make it a popular choice for beginners and experienced makers alike.

Explore Projects Built with Servo SG90

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Itsy Bitsy M0 Express Controlled Multi-Servo System: A project utilizing Servo SG90 in a practical application
Itsy Bitsy M0 Express Controlled Multi-Servo System

This circuit consists of an Itsy Bitsy M0 Express microcontroller connected to eight Tower Pro SG90 servos. Each servo is controlled by a different digital or analog output pin on the microcontroller. A single power supply provides +5V and GND to all servos, and the microcontroller is configured with some of its pins interconnected for potential programming or operational purposes.

Open Project in Cirkit Designer
Image of ESP8266 NodeMCU Controlled SG90 Servo Motor: A project utilizing Servo SG90 in a practical application
ESP8266 NodeMCU Controlled SG90 Servo Motor

This circuit connects an ESP8266 NodeMCU microcontroller to an SG90 servo motor. The NodeMCU's D4 pin controls the servo motor via PWM signal, while both the NodeMCU and servo motor share a common ground and the servo is powered directly from the NodeMCU's VIN pin. The circuit is designed to allow the microcontroller to control the position of the servo motor.

Open Project in Cirkit Designer
Image of Arduino Sensor Shield Controlled Servo Motors: A project utilizing Servo SG90 in a practical application
Arduino Sensor Shield Controlled Servo Motors

This circuit utilizes an Arduino Sensor Shield v5.0 to interface with two types of servo motors: an SG90 servo motor and two MG996R servo motors. The SG90 is connected to pin 6 of the shield for PWM control, power (5V), and ground. Each MG996R servo motor is similarly connected to pins 4 and 5 of the shield for PWM control, power, and ground, allowing for independent control of the servo motors via the Arduino platform.

Open Project in Cirkit Designer

Technical Specifications

Pin Configuration and Descriptions

The Servo SG90 has a 3-pin connector with the following pinout:

Pin Number Wire Color Function Description
1 Brown Ground (GND) Connect to the ground of the power supply
2 Red Power (VCC) Connect to a 4.8V-6.0V power source
3 Orange Signal (PWM) Receives PWM signal for position control

Usage Instructions

How to Use the Servo SG90 in a Circuit

  1. Power Connection: Connect the red wire to a 5V power source and the brown wire to ground (GND). Ensure the power supply can provide sufficient current (at least 500mA) to avoid voltage drops.
  2. Signal Connection: Connect the orange wire to a PWM-capable pin on your microcontroller (e.g., Arduino).
  3. PWM Signal: Send a PWM signal to the servo to control its position. The pulse width determines the angle:
    • 1ms pulse width corresponds to 0°.
    • 1.5ms pulse width corresponds to 90° (center position).
    • 2ms pulse width corresponds to 180°.

Important Considerations and Best Practices

Example Code for Arduino UNO

Below is an example of how to control the Servo SG90 using an Arduino UNO:

#include <Servo.h> // Include the Servo library

Servo myServo; // Create a Servo object to control the SG90

void setup() {
  myServo.attach(9); // Attach the servo to pin 9 on the Arduino
}

void loop() {
  myServo.write(0); // Move the servo to 0 degrees
  delay(1000); // Wait for 1 second

  myServo.write(90); // Move the servo to 90 degrees (center position)
  delay(1000); // Wait for 1 second

  myServo.write(180); // Move the servo to 180 degrees
  delay(1000); // Wait for 1 second
}

Code Explanation:

Troubleshooting and FAQs

Common Issues and Solutions

  1. Servo Not Moving:

    • Cause: Insufficient power supply.
    • Solution: Use a dedicated power source capable of providing at least 500mA.
  2. Servo Jittering:

    • Cause: Electrical noise or unstable power supply.
    • Solution: Add a decoupling capacitor (e.g., 100µF) across the power supply.
  3. Servo Overheating:

    • Cause: Prolonged operation under high torque or incorrect PWM signal.
    • Solution: Ensure the servo is not overloaded and verify the PWM signal is within the correct range.
  4. Limited Range of Motion:

    • Cause: Incorrect PWM signal or mechanical obstruction.
    • Solution: Check the PWM signal and ensure there are no physical obstructions.

FAQs

Q: Can I use the Servo SG90 with a 3.3V microcontroller?
A: Yes, but you must power the servo with 4.8V-6.0V and use a level shifter for the PWM signal if necessary.

Q: How many SG90 servos can I control with an Arduino?
A: The number depends on the available PWM pins and the power supply's capacity. Ensure the power supply can handle the total current draw.

Q: Can the SG90 rotate continuously?
A: No, the SG90 is a positional servo with a range of 0° to 180°. For continuous rotation, use a continuous rotation servo.

Q: What is the lifespan of the SG90?
A: The lifespan depends on usage conditions, but it is generally durable for hobby projects when operated within its specifications.