How to control servo motor using potentiometer
Required HardwareArduino BoardServo Motor10k ohm PotentiometerJumper WiresMini Breadboard
Servo motors have three wires: power, ground, and signal. The power wire is typically red, and should be connected to the 5V pin on the Arduino or Genuino board. The ground wire is typically black or brown and should be connected to a ground pin on the board. The signal pin is typically yellow or orange and should be connected to pin 9 on the board.
The potentiometer should be wired so that its two outer pins are connected to power (+5V) and ground, and its middle pin is connected to analog input 0 on the board.
I recommend! You not connect directly the servo motor to the Arduino. I suggest you use external power to the servo. SG90 Mini Servo motors can be used.
Components:
- Jumper wire.
- Breadboard
- Potentiometer
- Servomotor
- Power supply
- Arduino
- Resistor
How Does it Work ?
Before we get started with our Arduino servo Tutorial, when using a motor, always use an external source to power your Arduino, do not draw power from a USB connection!
Servos are controlled by sending an electrical pulse of variable width or pulse width modulation (PWM), through the control wire. Thus it can either be controlled by PWM pins or —any digital pin. As shown in the diagram below, with a 1.5ms pulse width applied to the control line, the servo sits at the neutral position—in this case, identified as 90º. When the pulse width increases or decreases, the servo moves towards 180º or 0º, respectively.You could also describe the neutral position as 0º, in which case the servo’s angular range extends from -90º to +90º.

In other words, a 1.5ms pulse will make the motor turn to the 90° position. A Pulse Shorter than 1.5ms moves it in the anti-clockwise direction toward the 0° position, and any pulse longer than 1.5ms will turn the servo in a clockwise direction toward the 180° position.That’s i
Interfacing With Arduino
Connect the potentiometer 1st pin to Arduino’s 5V pin, and 3rd pin to GND with a resistor .The 2nd pin of potentiometer will be the analog input of Arduino.Connect it to A0 pin.
Now Give 5 volt supply to sevo motor and connect the 3rd pin of servo to arduino pin 9 for PWM signal.

code to Arduino:
Now upload your code to arduino for control purpose of Arduino.
Servo myservo; // create servo object to control a servo
int potpin = 0; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop() {
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
}
Applications of Servo Motor
The servo motor is small and efficient, but serious to use in some applications like precise position control.This motor is controlled by a pulse width modulator signal. The applications of servo motors mainly involve in computers, robotics, toys, CD/DVD players, etc. These motors are extensively used in those applications where a particular task is to be done frequently in an exact manner.
- The servo motor is used in robotics to activate movements, giving the arm to its precise angle.
- The Servo motor is used to start, move and stop conveyor belts carrying the product along with many stages. For instance, product labeling, bottling and packaging
- The servo motor is built into the camera to correct a lens of the camera to improve out of focus images.
- The servo motor is used in robotic vehicle to control the robot wheels, producing plenty torque to move, start and stop the vehicle and control its speed.
- The servo motor is used in solar tracking system to correct the angle of the panel so that each solar panel stays to face the sun
The Servo motor is used in metal forming and cutting machines to provide specific motion control for milling machines - The Servo motor is used in Textiles to control spinning and weaving machines, knitting machines and looms
Reference:
https://miymakers.wordpress.com/2017/05/12/controlling-servo-motor-with-a-potentiometer/
https://learn.digilentinc.com/Documents/388
https://www.arduino.cc/en/tutorial/knob
https://www.instructables.com/id/Arduino-How-to-Control-Servo-Motor-With-Potentiome/