Site icon Circuit Ideas for You

Smooth Servo Rotation Circuit with Arduino and Potentiometer

This project shows about Smooth Servo Rotation Circuit with Arduino and Potentiometer.

Turn the knob and see servo arm moves smooth from 0° to 180°.

Easy and fun to learn how Arduino reads analog signal and makes motion.

Its a good project for beginners in robotics, automation or motor control.

Arduino Coding:

#include <Servo.h>
Servo myservo;
int potPin = A0;
int val;

void setup() {
myservo.attach(9);
}

void loop() {
val = analogRead(potPin);
val = map(val, 0, 1023, 0, 180);
myservo.write(val);
delay(15);
}

Coding Explanation:

Circuit Working:

Parts List:

Component NameQuantity
SG90 Servo Motor1
Arduino Mega 25601
Potentiometer 20k1

Potentiometer gives analog voltage between 0V and 5V.

Arduino reads this voltage using analog pin A0.

Arduino converts it into a value between 0 and 1023.

This value is mapped to servo angle between 0 and 180 degrees.

When we rotate the potentiometer then the servo moves accordingly.

Formula with Calculation:

Below is the formula for Potentiometer output voltage = (Position / Full rotation) × 5V

Arduino analog value = (Voltage / 5V) × 1023

Example:

If potentiometer gives 2.5V then,

Analog value = (2.5 / 5) × 1023 = 511

Mapped servo angle = (511 / 1023) × 180 = 90 degrees

How to Build:

To build a Smooth Servo Rotation Circuit with Arduino and Potentiometer follow the below steps for connection:

Conclusion:

Smooth Servo Rotation Circuit with Arduino and Potentiometer is simple and easy to give it a try.

Potentiometer moves servo angle smoothly.

This project teaches analog input and PWM output.

Its useful in robotic arms, camera control, and small automation systems.

References:

Using the Arduino Uno to control multiple Servos via potentiometers

Exit mobile version