Home > Industry Insights >Gear Motor
TECHNICAL SUPPORT

Product Support

Arduino Uno Connected To Micro Servo MG90S SG90 Wiring Diagram And Power Supply Details

Published 2026-02-23

Hey, have you ever encountered this situation - you bought a miniature MG90S or SG90servowith great joy, and wanted to connect it to Uno to make a cool little invention, but after connecting it to the line, it either didn't move at all, or vibrated wildly, completely disobedient? Don’t worry, this is a pitfall that almost every novice player will step into. Today we will go through the process of "taming" the microservo, ensuring that you can make theservorotate obediently after reading it.

How to insert the three wires of the servo?

When you get the servo, the first thing you see is the three wires of different colors. Don't plug them in randomly based on your feelings. You will suffer a big loss if you burn the servo or the board. Generally speaking,the brown(or black) wire isthe negative pole(GND), which must be connected to the GND pin of the Uno;the redwire isthe positive pole, which needs to be connected to the5Vpower supply; andthe orange(or yellow, white) wire isthe signal wire, which needs to be connected to the digital pin, such as the commonly usedpin 9. This connection method makes sense, because the motor and control circuit inside the servo need independent power supply, and the signal pin is only responsible for transmitting the rotation angle command. So you see, the power supply and signal are separated and the division of labor is clear, so that it can work properly.

Why does the servo need an external power supply?

Many friends try to save trouble by directly plugging the red wire of the servo into the 5V pin. If your servo is small and you just turn it briefly without load, it may be barely usable. but! Once your servo is under some load or needs to rotate frequently, taking power from the USB port can easily cause voltage instability, which can cause the servo to twitch and restart the microcontroller, or even burn out the voltage regulator chip on the board. This is like asking a truck to run on the F1 track. The power cannot keep up at all. The safest way is to prepare a separateexternal power supplyfor the servo, such as 4 AA battery boxes or a 7.4V lithium battery, and step it down to 5V or 6V through a power module, and then connect the negative pole of the power supply to GND to ensure signal synchronization.

How to use code to make the servo rotate

Once the hardware is connected, the software side is actually simpler than you think. We don't need to write complex PWM wave control code ourselves, because there are ready-made libraries that can be called. First, make sure you include the "Servo.h" library in your IDE. Then, it only takes two simple steps: insetup()function, use.(9);to tell the program that the servo is connected to pin 9; then, inloop()function, use.write(90);to make the servo rotate to a 90-degree position. You see, the library function has encapsulated the complex timer configuration, and we can just send instructions directly. Here's a little tip. The number filled in thewrite()function is usually0 to 180, which represents the angle you want to turn to.

What should I do if the servo does not respond after writing the code?

If everything looks right, but the steering gear just doesn’t move, don’t be quick to doubt your life. Let’s check it out step by step. First,check the physical connection. Are the signal lines plugged into the correct pins? Are the positive and negative poles of the power cord reversed? Is the external power switch turned on? Many times it's just a loose thread. Secondly,check the code logic. If you write.write(0);the servo will indeed turn to the starting position, but if it is at 0 degrees from the beginning, of course it will look like it has not moved to the naked eye. You can try to make it go from 0 degrees to 180 degrees, adding a 1 second delay in the middle, so that you can see it swinging back and forth. Also, checkAre the pins actually the same as the ones you plugged in? This kind of low-level error is often the most troublesome.

What kind of steering gear is more suitable for the project?

Common micro servos on the market include SG90 and MG90S. Although they look similar, the internal differences are not small.SG90uses plastic gears, which are cheap and light in weight. It is very suitable for use on some small door latches and indicators that do not bear much force.The MG90Sis different. It has been upgraded to a metal gear, with greater torque and much better wear resistance and impact resistance. If the servo in your project needs to drive a heavy robotic arm, or it needs to work for a long time, then it is recommended that you spend a few more dollars to choose MG90S, which will save you a lot of worries. Only by choosing the right tools can the project go smoothly.

How to set the angle of continuously rotating servo

Sometimes, you may not want the servo to rotate only at a fixed angle, but to keep it rotating like an ordinary motor, such as making a small remote control car. At this time, the ordinary servo will not work very well. What you need isto continuously rotate the servo. Its control logic is different from the standard servo: sendwrite(90);it willstop; send a value less than 90, such aswrite(0);it willturn counterclockwise at full speed; send a value greater than 90, such aswrite(180);it willturn clockwise at full speed. And the closer the value is to 90, the slower the speed. After understanding this, you can use it to accurately control the speed and direction of the car. Isn't it interesting?

At this point, you should know the basic routines of connection and programming. However, when you are actually doing it, have you ever thought about what to do if your project needs to control several servos at the same time and the Uno's pins are not enough? Or how to control the speed of the servo in a more precise way so that it can simulate more natural mechanical movements? Welcome to share your thoughts and confusion in the comment area, let’s discuss it together! If you find this article useful, don’t forget to like it and share it with your friends who are also playing~

Update Time:2026-02-23

Powering The Future

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

Mail to Kpower
Submit Inquiry
+86 0769 8399 3238
 
kpowerMap