A servo motor is just a simple DC motor with certain modifications. When you look at it, you’ll notice that it has several gears and an electronic circuit. These improvements provide the motor with new capabilities, such as precise control of the shaft’s speed and direction. It also gives the motor the ability to know the current position of the shaft.
In this tutorial, we will use the Arduino to control the servo motor shaft to sweep back and forth across 180 degrees. Let’s have a look at it.
Connect the wires between the servo motor and the Arduino, as shown in the image below:
Connections from the servo motor:
• Servo GND pin→ Arduino GND pin
• Servo VCC pin→ Arduino VCC pin
• Servo signal pin → Arduino pin 9
Now access the serial monitor on your Arduino IDE by clicking on the magnifying glass icon at the top right corner.
Now, as seen in the image below, the serial monitor displays the current position of the servo motor in degrees. You will also notice the sweeping movement of your servo motor.