Home Industry InsightBLDC
Looking for a suitable motor? Looking for a suitable motor?
Looking for a suitable motor?

servo motor sg90 arduino connection

小编

Published2025-10-18

If you’re looking to add precision and control to your projects, the SG90 servo motor is a solid choice, especially when combined with an Arduino. It’s small, efficient, and easy to use, making it ideal for a wide range of DIY electronics projects.

The SG90 is a popular choice for hobbyists because it offers reliable, smooth movements and can handle small to medium loads. Whether you're building a robotic arm, a simple camera slider, or just experimenting with motion, this tiny servo has you covered.

So, how do you connect the SG90 to an Arduino? Let’s break it down in simple steps.

Basic Connection Setup

First things first, you’ll need an Arduino board and the SG90 servo motor. The connections are easy to make. The servo has three wires: Power (usually red), Ground (usually brown or black), and Control (usually yellow or orange).

  1. Connect the Power wire (Red) to the 5V pin on the Arduino.
  2. Connect the Ground wire (Brown or Black) to the GND pin on the Arduino.
  3. Connect the Control wire (Yellow or Orange) to one of the PWM-enabled pins on the Arduino. Pin 9 is a good choice for simplicity.

Once your servo is connected, you’ll want to write a small sketch to control the motor. The Arduino IDE has a library called Servo, which makes programming the motor a breeze.

Programming the Arduino

The next step is writing the code to move the servo. Here’s an example:

#include <Servo.h>

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

void setup() {
  myServo.attach(9);  // Attaches 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
  delay(1000);       // Wait for 1 second
  myServo.write(180); // Move the servo to 180 degrees
  delay(1000);        // Wait for 1 second
}

This code will make the servo rotate between 0, 90, and 180 degrees with 1-second delays in between. You can adjust the angles and delays as needed for your project.

What Can You Do With It?

The possibilities are endless. Want to build a simple robot? The SG90 can control its movements. Need to create a camera mount that tilts and pans? The servo motor can do that too. It’s even used in hobby drones for controlling stabilizers and camera gimbals.

One of the coolest features of the SG90 is its precise control over rotation angles, typically ranging from 0 to 180 degrees. This means you can get exactly the movement you need for your project, whether it’s turning a wheel, controlling a lever, or adjusting the position of a sensor.

Why Choose SG90?

Why not go for a bigger, more powerful motor? The SG90 stands out because of its size, ease of integration, and cost-effectiveness. It provides a perfect balance of functionality for lightweight tasks without being overly complex. Whether you’re just getting started with Arduino or have a ton of experience, the SG90 is an approachable, reliable choice.

Besides, once you get the hang of using the SG90 with Arduino, it opens up new opportunities to experiment with other servos and motors. It’s a great gateway to more advanced robotics and control systems.

Final Thoughts

The SG90 servo motor paired with an Arduino is an awesome combination for a wide range of projects. Whether you're an enthusiast or someone looking to add some motion to a project, it provides both ease of use and flexibility. The ability to control movements with precision, coupled with the simplicity of the Arduino platform, makes it a winning combo for makers everywhere. With a little imagination and some coding, you’ll have your servo moving in no time!

Established in 2005, Kpower has been dedicated to a professional compact motion unit manufacturer, headquartered in Dongguan, Guangdong Province, China. Leveraging innovations in modular drive technology, Kpower integrates high-performance motors, precision reducers, and multi-protocol control systems to provide efficient and customized smart drive system solutions. Kpower has delivered professional drive system solutions to over 500 enterprise clients globally with products covering various fields such as Smart Home Systems, Automatic Electronics, Robotics, Precision Agriculture, Drones, and Industrial Automation.

Update:2025-10-18

Contact a motor expert for product recommendation.
Contact a motor expert for product recommendation.

Powering The Future

Contact Kpower's product specialist to recommend suitable motor or gearbox for your product.