Extra 5% OFF Use Code: OL05
Free Shipping over ₹999

Potentiometer-Based 3-Servo Manager With Arduino

Introduction

This project demonstrates the control of three servo motors using potentiometers and Arduino. Each potentiometer adjusts the angle of a corresponding servo, mapped between 0 to 180 degrees. The servos respond in real-time to changes in potentiometer positions. The setup includes analog inputs for reading values and PWM outputs for servo movement. Serial monitoring provides feedback for precise control. This system is ideal for robotics, camera gimbals, and other applications requiring smooth multi-axis motion.

Required Components

  • Arduino UNO, or Nano
  • 3 Servo Motors
  • 3 Potentiometers
  • Jumper wire
  • Breadboard

Circuit Diagram / Wiring

  • Potentiometers with Arduino
    • Potentiometer ONE END → 5V (Arduino)
    • Potentiometer ONE END → GND (Arduino)
    • Potentiometer Middle PIN → A0, A1, A2 (Arduino)
  • Servo with Arduino
    • Servo (RED) VCC → 5V (Arduino)
    • Servo (BROWN) GND → GND (Arduino)
    • Servo (ORENG) SIGNAL → Pin 9, 10, 11 (Arduino)

Arduino Code / Programming

Make sure you have the following librarie installed:

  • Servo library for Servo Motor
#include <Servo.h>

Servo servo1;  // Create Servo object for the first servo
Servo servo2;  // Create Servo object for the second servo
Servo servo3;  // Create Servo object for the third servo

int pot1Pin = A0;  // Potentiometer 1 connected to A0
int pot2Pin = A1;  // Potentiometer 2 connected to A1
int pot3Pin = A2;  // Potentiometer 3 connected to A2

int pot1Value = 0, pot2Value = 0, pot3Value = 0;  // Variables for potentiometer values
int angle1 = 0, angle2 = 0, angle3 = 0;  // Variables for servo angles

void setup() {
  servo1.attach(9);  // Attach servo1 to pin 9
  servo2.attach(10); // Attach servo2 to pin 10
  servo3.attach(11); // Attach servo3 to pin 11
  Serial.begin(9600); // Initialize Serial Monitor
}

void loop() {
  // Read potentiometer values
  pot1Value = analogRead(pot1Pin);
  pot2Value = analogRead(pot2Pin);
  pot3Value = analogRead(pot3Pin);

  // Map potentiometer values to servo angles (0 to 180 degrees)
  angle1 = map(pot1Value, 0, 1023, 0, 180);
  angle2 = map(pot2Value, 0, 1023, 0, 180);
  angle3 = map(pot3Value, 0, 1023, 0, 180);

  // Write angles to servos
  servo1.write(angle1);
  servo2.write(angle2);
  servo3.write(angle3);

  // Print values to Serial Monitor
  Serial.print("Servo1: ");
  Serial.print(angle1);
  Serial.print(" | Servo2: ");
  Serial.print(angle2);
  Serial.print(" | Servo3: ");
  Serial.println(angle3);

  delay(15);  // Short delay for stable operation
}

Explanation

  • This project uses an Arduino to control three servo motors.
  • Three potentiometers are connected to analog pins (A0, A1, A2).
  • The potentiometer values (0-1023) are mapped to servo angles (0-180°).
  • The Servo library is used to control servos on pins 9, 10, and 11.
  • The loop() function continuously updates servo positions based on potentiometer input.
  • Serial Monitor displays the current angles of the servos for real-time feedback.

    Leave a Reply

    Your email address will not be published.

    Need Help?