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

Arduino UNO Controlled Dual Servo Joystick Interface

View and Edit Project In Cirkit DesignerImage of Arduino UNO Controlled Dual Servo Joystick Interface

Circuit Documentation

Summary

The circuit consists of an Arduino UNO microcontroller interfaced with two Tower Pro SG90 servos and a joystick module. The servos are controlled by the Arduino, which reads the joystick's position to determine the servo angles. A 5V battery provides power to the system, ensuring that the servos and the joystick module have a stable voltage supply.

Component List

Arduino UNO

Tower Pro SG90 Servo (x2)

Joystick Module

5V Battery

Wiring Details

Arduino UNO

Tower Pro SG90 Servo

Joystick Module

5V Battery

Documented Code

// Code for controlling servos with a joystick using an Arduino UNO
const int xPin = A0, yPin = A1;
float xValue, yValue;

void setup() {
  pinMode(xPin, INPUT);
  pinMode(yPin, INPUT);
  Serial.begin(9600);
}

void loop() {
  xValue = analogRead(xPin);
  yValue = analogRead(yPin);

  Serial.print("Value of x-axis: ");
  Serial.println(xValue);
  Serial.print("Value of y-axis: ");
  Serial.println(yValue);

  delay(100);
}

This code initializes the Arduino to read the X and Y positions of the joystick and outputs the values to the serial monitor. The analog pins A0 and A1 are configured as inputs to read the voltage variations as the joystick is moved. The Serial.begin(9600); line sets up the serial communication at a baud rate of 9600. The loop() function continuously reads the joystick's position and prints the values to the serial monitor. The delay(100); line introduces a 100ms delay between each reading to make the output readable.