4.8-6.6V
4.8-6.6V
1.8 kg/cm
60 degrees per second
180 degrees
-20C to 60C
approximately 25 grams
22.8 mm x 12.2 mm x 28.5 mm
Pinout
The MG90S Mini Servo Motor has a standard 3-pin connector | |
VCC (Red wire) | Positive power supply voltage |
GND (Black wire) | Ground |
Signal (Yellow/White wire) | PWM control signal |
MG90S Mini Servo Motor (180 Degree) Documentation
Overview
The MG90S Mini Servo Motor is a small, high-torque servo motor capable of rotating up to 180 degrees. It is commonly used in robotics, automation, and IoT projects that require precise angular control. This documentation provides an overview of the component's specifications, pinouts, and code examples to help you get started with using the MG90S Mini Servo Motor in your projects.
Specifications
Operating Voltage: 4.8V to 6.6V
Stall Torque: 1.6 kg.cm (230 oz.in)
Rotation Angle: 180 degrees
Speed: 0.12 sec/60 degrees
Weight: 9g
Dimensions: 23 x 12 x 23 mm
Pinouts
The MG90S Mini Servo Motor has a standard 3-pin servo connector:
VCC (Red): Power supply (4.8V to 6.6V)
GND (Brown): Ground
Signal (Orange): Control signal (PWM)
Code Examples
### Example 1: Basic Servo Control with Arduino
This example demonstrates how to control the MG90S Mini Servo Motor using an Arduino board.
```c++
#include <Servo.h>
Servo myServo; // create a servo object
void setup() {
myServo.attach(9); // attach the servo to digital pin 9
}
void loop() {
myServo.write(0); // set the servo to 0 degrees
delay(1000);
myServo.write(90); // set the servo to 90 degrees
delay(1000);
myServo.write(180); // set the servo to 180 degrees
delay(1000);
}
```
### Example 2: Sweep Control with Raspberry Pi (Python)
This example demonstrates how to control the MG90S Mini Servo Motor using a Raspberry Pi and Python.
```python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT) # set up GPIO 18 as an output
pwm = GPIO.PWM(18, 50) # create a PWM object with a frequency of 50 Hz
pwm.start(0) # start the PWM with a duty cycle of 0
while True:
for i in range(0, 181, 10): # sweep the servo from 0 to 180 degrees
pwm.ChangeDutyCycle(i / 18 + 2) # calculate the duty cycle for the current angle
time.sleep(0.1)
time.sleep(1)
```
### Example 3: Servo Control with ESP32 (MicroPython)
This example demonstrates how to control the MG90S Mini Servo Motor using an ESP32 board and MicroPython.
```python
import machine
import time
servo = machine.PWM(machine.Pin(18), freq=50) # create a PWM object with a frequency of 50 Hz
while True:
for i in range(0, 180, 10): # sweep the servo from 0 to 180 degrees
servo.duty(i) # set the duty cycle for the current angle
time.sleep(0.1)
time.sleep(1)
```
Note: Make sure to adjust the pin numbers and PWM frequencies according to your specific board and setup. Additionally, ensure that the power supply to the servo motor is within the recommended voltage range.