Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Controlled Dual Servo Motion System

View and Edit Project In Cirkit DesignerImage of Arduino UNO Controlled Dual Servo Motion System

Circuit Documentation

Summary of the Circuit

This circuit is designed to control two micro servo motors using an Arduino UNO microcontroller. The servos are powered by a 9V battery and are controlled by the PWM (Pulse Width Modulation) signals from the Arduino UNO. The circuit allows for the independent movement of each servo motor through a range of 0 to 180 degrees.

Component List

Arduino UNO

Micro servo 9G (x2)

9V Battery

Wiring Details

Arduino UNO

Micro servo 9G (Servo 1)

Micro servo 9G (Servo 2)

9V Battery

Documented Code

#include <Servo.h> 

Servo servo1; // Bottom servo motor
Servo servo2; // Top servo motor

void setup() {
  servo1.attach(9);  // Attach bottom servo to pin 9
  servo2.attach(10); // Attach top servo to pin 10
  servo1.write(0);
  servo2.write(0);
}

void loop() {
  // Move bottom servo from 0 to 180 degrees and back
  for (int pos = 0; pos <= 180; pos += 1) {
    servo1.write(pos);
    delay(10);
  }
  for (int pos = 180; pos >= 0; pos -= 1) {
    servo1.write(pos);
    delay(10);
  }

  // Move top servo from 0 to 180 degrees and back
  for (int pos = 0; pos <= 180; pos += 1) {
    servo2.write(pos);
    delay(10);
  }
  for (int pos = 180; pos >= 0; pos -= 1) {
    servo2.write(pos);
    delay(10);
  }
}

Filename: sketch.ino

Description: This Arduino sketch initializes two servo objects and attaches them to pins 9 and 10, respectively. In the loop function, it moves each servo from 0 to 180 degrees and then back to 0 degrees in a continuous loop. The movement is achieved by incrementing the position degree by degree with a short delay between each increment to create a smooth motion.