Joystick Controlled Servo Using Arduino(with Programming)

About: i am an electronics hobbyist.

In this tutorial we will make a joystick control servo using Arduino Uno.Servo will move according to joystick motion.

Step 1: Components Required:

  1. Arduino Uno
  2. Joystick
  3. Servo motor
  4. Breadboard
  5. wires

Step 2: Connection:

Connect the all components according to circuit diagram:

  1. Joystick Connection:
    1. joystick VCC --> Arduino 5V
    2. joystick GND --> Arduino GND
    3. joystick x_axis --> Arduino pin A0
  2. Servo Connection:
    1. servo VCC --> Arduino 5V
    2. servo GND --> Arduino GND
    3. Servo data_pins --> Arduino pin 10

Step 3: Programming:

Upload the following program in Arduino Uno board:

#include<Servo.h>
Servo servo;

int x_axis;

int servo_val;

void setup()

{

pinMode(A0,INPUT);

servo.attach(10);

}

void loop()

{

x_axis=analogRead(A0);

servo_val=map(x_axis,0,1023,0,180);

servo.write(servo_val);

}

Step 4: Source Code:

code :Source code(click here)

Share

    Recommendations

    • Remix Contest

      Remix Contest
    • Epilog X Contest

      Epilog X Contest
    • Sweet Treats Challenge

      Sweet Treats Challenge

    Discussions