Servo Motor Control Using Potentiometer with Arduino Uno (Beginner Guide)

 Servo motor control using potentiometer


 Introduction

In this project, we will learn how to control a servo motor position using a potentiometer with the Arduino Uno.

A potentiometer acts as an analog input device that changes resistance when rotated. The Arduino reads this analog value (0–1023) and maps it to a servo angle (0°–180°). As you turn the knob, the servo shaft moves proportionally.

This is one of the most popular beginner projects in robotics and DIY electronics.


Key Components

  • Arduino UNO

  • Servo Motor (e.g., SG90)

  • 10kΩ Potentiometer

  • Jumper Wires

  • Breadboard (optional)


 Circuit Connections

Potentiometer:

  • One outer pin → 5V

  • Other outer pin → GND

  • Middle pin → A0

Servo Motor:

  • Red wire → 5V

  • Brown/Black wire → GND

  • Orange/Yellow wire → Digital Pin 9

 If the servo jitters, use an external 5V power supply.


Working Principle

  1. The potentiometer produces an analog voltage.

  2. Arduino reads this value using analogRead().

  3. The value (0–1023) is converted into an angle (0–180°) using map().

  4. The angle is sent to the servo using the Servo library.

  5. The servo rotates according to the knob position.


 Arduino Code

#include <Servo.h>

Servo myServo;

int potPin = A0;
int servoPin = 9;
int potValue;
int angle;

void setup() {
myServo.attach(servoPin);
}

void loop() {

potValue = analogRead(potPin);
angle = map(potValue, 0, 1023, 0, 180);

myServo.write(angle);
delay(15);

}

 Learning Outcomes

Students will understand:

  • Analog input reading

  • Mapping values in Arduino

  • Servo motor control

  • Manual robotic arm movement basics


 Applications

  • Robotic arm control

  • Camera angle adjustment

  • Steering systems

  • DIY robotics projects

  • Automation prototypes


 Troubleshooting Tips

  • Ensure common GND between servo and Arduino.

  • Avoid powering high-torque servos directly from Arduino.

  • Check servo library installation if compilation fails.

Code:


Try it in Tinker cad:



BEGINNER PROJECTS (Foundation Skills)

  1. Ultrasonic Distance Measurement
  2. Traffic Light Simulation with 7-Segment Display
  3. 7-Segment Display Counter
  4. Kids Piano Circuit (8-Key Version)
  5. 16×2 LCD Display with Text Output
  6. LCD I2C to Arduino UNO
  7. Temperature Measurement using Arduino UNO
  8. LDR Controlled Street Light

INTERMEDIATE PROJECTS (Build Your Skills)

  1. Servo Motor Control Using Potentiometer
  2. DC Motor Speed Control
  3. Temperature Controlled Fan
  4. PIR Based Theft Alert System
  5. LPG Gas Leakage Detection System
  6. Automatic Door Locking System
  7. Soil Moisture Based Automatic Watering System
  8. Simple Digital Clock using Arduino UNO
  9. Automatic Voting Machine (EVM)
  10. Joystick Control using Arduino Uno
  11. RGB Lamp Control using Arduino Uno

    ADVANCED PROJECTS (Master Level)

    1. Home Automation Using Arduino UNO
    2. Bluetooth RC Car using Arduino Uno
    3. Obstacle Avoiding Robot
    4. Line Follower Robot
    5. Radar System Using Arduino UNO
    6. Automatic Parking System
    7. Bi-Directional People Counter using Arduino Uno 
    8. Automatic Plant Watering System
    9. NeoPixel LED Ring Control using Arduino Uno
    10. Smart Gloves for Bedridden People

      ROBOTICS & MOTION PROJECTS

      1. RC Car Using L293D Motor Driver
      2. Robot Arm and Leg Control Using Servo
      3. Smart Irrigation System using Arduino Uno

      Comments