The SG90 Servo Motor is one of the most commonly used small servo motors in electronics projects, especially with Arduino, NodeMCU (ESP8266/ESP32), and Raspberry Pi.
Key Specifications
Model: SG90 (Micro Servo)
Operating Voltage: 4.8V – 6V (works well on 5V)
Current: ~100mA (idle), up to 500mA (stall)
Torque: ~1.8 kg·cm
Rotation Range: ~0° to 180° (some variants allow ~270°)
Control Signal: PWM (Pulse Width Modulation)
Connector: 3 wires
Brown → GND
Red → VCC (5V)
Orange → Signal (PWM)
How It Works
Angle control is based on PWM signal:
1 ms pulse → ~0°
1.5 ms pulse → ~90°
2 ms pulse → ~180°
Standard PWM frequency: 50 Hz (20 ms period).
Wiring with NodeMCU (ESP8266)
Red → VIN or 5V external supply (don’t power directly from NodeMCU if multiple servos)
Brown → GND
Orange → D4 (GPIO2) or any PWM pin
Sample Arduino Code for NodeMCU
#include <Servo.h>
Servo myServo;
void setup() {
myServo.attach(D4); // Attach servo to D4 (GPIO2)
}
void loop() {
myServo.write(0); // Move to 0 degrees
delay(1000);
myServo.write(90); // Move to 90 degrees
delay(1000);
myServo.write(180); // Move to 180 degrees
delay(1000);
}





















