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

Arduino UNO Controlled Servo Motor Sweeper

View and Edit Project In Cirkit DesignerImage of Arduino UNO Controlled Servo Motor Sweeper

Circuit Documentation

Summary of the Circuit

This circuit consists of an Arduino UNO microcontroller, a servo motor, and a power supply. The Arduino UNO is programmed to control the servo motor, making it sweep from 0 to 180 degrees and back continuously. The servo motor is powered by a 5V power supply, which also provides power to the Arduino UNO. The ground connections are shared among all components to complete the circuit.

Component List

Arduino UNO

Servo

Power Supply

Wiring Details

Arduino UNO

Servo

Power Supply

Documented Code

/*
 * This Arduino sketch controls a servo motor connected to pin D3.
 * The servo is powered by a 5V power supply and shares a common ground.
 * The servo will continuously sweep from 0 to 180 degrees and back.
 */

#include <Servo.h>

Servo myServo;  // create servo object to control a servo

void setup() {
  myServo.attach(3);  // attaches the servo on pin D3 to the servo object
}

void loop() {
  for (int pos = 0; pos <= 180; pos += 1) { // goes from 0 to 180 degrees
    myServo.write(pos);  // tell servo to go to position in variable 'pos'
    delay(15);  // waits 15ms for the servo to reach the position
  }
  for (int pos = 180; pos >= 0; pos -= 1) { // goes from 180 to 0 degrees
    myServo.write(pos);  // tell servo to go to position in variable 'pos'
    delay(15);  // waits 15ms for the servo to reach the position
  }
}

Filename: sketch.ino

This code is designed to run on an Arduino UNO microcontroller. It initializes a Servo object and attaches it to pin D3. In the main loop, the servo is instructed to move between 0 and 180 degrees in a sweeping motion. The delay(15) function call ensures that the servo has enough time to reach the desired position before moving to the next one.