Skip to content

keliaa1/Servo-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Servo + Joystick Control Project

This project demonstrates how to control a servo motor using a joystick module. By moving the joystick, the servo rotates smoothly based on the input value. Itโ€™s a simple and fun introduction to analog input, PWM, and hardware control.

๐Ÿ› ๏ธ Components Used

Arduino Uno / Nano (or any microcontroller)

Servo motor (SG90 / MG996R)

Joystick module

Jumper wires

5V power source

๐Ÿ”Œ Wiring Joystick VRx โ†’ A0
VCC โ†’ 5V
GND โ†’ GND

Servo Signal โ†’ Pin 9
VCC โ†’ 5V
GND โ†’ GND

Make sure all grounds are connected together.

๐Ÿ’ป Code #include <Servo.h>

Servo myServo;

int joyX = A0;

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

void loop() { int raw = analogRead(joyX); // 0โ€“1023 int angle = map(raw, 0, 1023, 0, 180); myServo.write(angle); delay(10); }

๐Ÿ“Œ How It Works

The joystick outputs an analog value depending on how far you push it.

The microcontroller reads this value (0โ€“1023).

That value is mapped to a servo angle (0โ€“180ยฐ).

The servo rotates in real time as you move the joystick.

๐ŸŽฏ Project Purpose

This project helps beginners understand:

Analog input reading

Mapping sensor values

PWM-driven servo movement

Basic robotics control

๐Ÿš€ Future Enhancements (Optional)

Add Y-axis to control a second servo

Use a pan/tilt mount

Add smoothing/filters to reduce jitter

Add a display showing angle value

๐Ÿ“„ License

MIT License

About

Project made to demonstrate working of servo joystick

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages