In this tutorial, we’ll show you how to use the SG90 servo motor with Arduino, control its position, and write code to rotate it smoothly to any angle between 0° and 180°. Servo motor is a small dc motor but it can contain gears that make them more powerful. Servo motors are one of the most popular actuators in robotics, automation, and hobby projects. Whether you’re building a robotic arm, smart door lock, pan-tilt camera, or sensor scanner — the SG90 servo is an affordable and beginner-friendly choice. Servo motor can move from 0-180 degrees. In this lecture, we use a basic small servo but it also available in large size that is more powerful.

What is an SG90 Servo Motor?
The SG90 micro servo motor is a lightweight, low-cost, and high-torque servo often used in DIY electronics and robotics. It’s a rotary actuator that can rotate from 0 to 180 degrees, controlled by sending it a PWM signal from a microcontroller like Arduino.
SG90 Servo Motor Specifications:
- Operating Voltage: 4.8V to 6V
- Torque: ~1.8 kg/cm (at 4.8V)
- Rotation Range: 0° to 180°
- Control Signal: PWM
- Weight: ~9g
- 3-Wire Interface:
- Brown: GND
- Red: VCC (4.8–6V)
- Orange/Yellow: Signal (PWM)

Components Required for Connecting Servo Motor with Arduino:
- Arduino UNO (or Nano/Mega)
- SG90 Micro Servo Motor
- External 5V Power Supply (recommended)
- 100µF Capacitor (optional, for power stability)
- Breadboard and Jumper Wires.
Pinout of SG90 Servo Motor:
Brown –> GND
Red –> Vcc
Orange –> D9

Circuit Diagram for Connecting Servo Motor with Arduino:
Servo Wire | Connect To |
---|---|
Brown (GND) | Arduino GND |
Red (VCC) | 5V Power Supply (or Arduino 5V for testing) |
Orange (Signal) | Digital Pin 9 |
Optional: Connect a 100µF capacitor across VCC and GND to prevent voltage dips.

Can we Power Servo Motor directly from Arduino?
Don’t power the SG90 directly from the Arduino’s 5V pin for long-term use — especially if you’re using multiple servos. Instead, use an external 5V power supply and connect GND of the servo and Arduino together for proper signal reference.
Code for SG90 Servo Motor with Arduino:
#include<Servo.h>
Servo myservo; // Create servo object to control a servo
int pos = 0;
void setup() {
myservo.attach(9); // attach the servo pin 9 to the servo object
}
void loop() {
for (pos = 0; pos<= 180; pos += 1){ // goes form 0 degree to 180 degrees
// in step of 1 degree
myservo.write(pos); // tell servo to go to position in varible 'pos'
// Change the delay to set the speed
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos>= 0; pos -= 1){ // goes form 180 degrees to 0 degrees
// in step of 1 degree
myservo.write(pos); // tell servo to go to position in varible 'pos'
// Change the delay to set the speed
delay(15); // waits 15ms for the servo to reach the position
}
}
How to use Sg90 Servo Motor with Arduino, Video Tutorial:
Applications of SG90 Servo with Arduino:
- Robotic Arms
- Pan-Tilt Camera Mounts
- Smart Locks or Door Opener Projects
- Solar Panel Tracker
- Mini Car Steering System
- Joystick-Controlled Mechanisms
Troubleshooting of Servo Motor:
- Jumping or jittery motion?
- Use an external power supply.
- Add a capacitor for noise filtering.
- Servo doesn’t move?
- Check signal wire.
- Confirm power source.
- Ensure angle is between 0–180.
- Servo moves slowly?
- Reduce delay or optimize your code loop.
Conclusion:
Using an SG90 servo motor with Arduino is a fantastic way to start learning about motion control in electronics. It’s simple, affordable, and highly versatile. With just a few lines of code, you can create moving parts in your projects and take your ideas to the next level.
Whether you’re building a robot, automation system, or creative art piece, the SG90 + Arduino combo is your best first step.
Need Help in Setup of SG90 Servo Motor with Arduino?
If you need any Help or Assistance for Setup of SG90 Servo Motor with Arduino, with Modifications or Customization then you can contact us through WhatsApp. We can deliver you this Project in the Following Ways.
Learn More about the services we offer.
Good day! I just want to offer you a big thumbs up for your excellent information you have got here on this post. Ill be coming back to your blog for more soon.