1. Blog>
  2. Learn basics with Arduino! Controlling servo using joystick with Arduino Uno R3. For robotic arms, RC Cars, pets and gimbals.

Learn basics with Arduino! Controlling servo using joystick with Arduino Uno R3. For robotic arms, RC Cars, pets and gimbals.

by: Aug 09,2025 3216 Views 3 Comments Posted in PCB Basic Information

Arduino PCBWAY PCB Joystick Servo motor

Summary:       This project shows how to control a servo motor with a joystick using an Arduino Uno R3. The joystick’s X-axis readings are mapped to servo angles for precise movement. It covers components, wiring, Arduino basics, code structure, and real-world uses such as robotic arms, pet toys, RC cars, and camera gimbals.

Project description:

Do not worry everything will be explained easily even the code and basic of an Arduino :).


The goal of this project is to learn how to control a servo motor using a joystick module and an Arduino—in our case, the Arduino Uno R3. (Code explanation included.)

The joystick measures the movement of its stick in different directions and transmits the position as values.

The servo motor adjusts its position to a specific angle based on the input signal.

Together, the joystick and servo allow for precise control of direction and position.


What Do I Need?

  • Arduino (Uno R3 or a compatible clone)
  • Joystick Module (QYF-860)
  • Servo Motor 180°
  • Wires 6 pieces (For Breadboard)
  • PCB or Breadboard (Optional)
  • Jack for power (Optional on PCB)

Image version:



Wiring

  • For the joystick module, we only use the X-axis (VRX).
  • Schematic below, can also be found in uploaded images or GitHub.


Code & Setup

  • In the Arduino IDE, enter the following (in attachments) code and upload it:


How Does This Code Work?

  • The Servo library is included so we can control the servo easily.
  • We create a Servo object (myServo) to communicate with the motor.
  • The joystick is connected to analog pin A0, the servo to digital pin 9.
  • The program reads the joystick position using analogRead().
  • The map() function converts joystick readings (0–1023) to servo angles (0–180°).
  • A tolerance is set so the servo doesn’t jitter when the joystick is centered.
  • The servo moves smoothly to match the joystick’s movement.


Arduino Basics (For Beginners)

  • Arduino Uno R3 is a small microcontroller board used to control electronics.
  • It is programmed in a language similar to C++.
  • Pins are connection points where you can attach sensors, motors, LEDs, etc.
  • Analog pins measure varying values (like joystick position).
  • Digital pins turn things ON/OFF or send control pulses to motors.
  • Programs for Arduino have two main parts:

setup() → runs once when powered on

loop() → runs continuously while powered


 Real-World Applications

By combining a joystick and servo control, you can create:

  • Robotic Arms

Control each joint with a joystick for precise movement.

Great for pick-and-place machines or DIY robots.

  • Pet Projects

Create moving toys for cats and dogs.

Control treat dispensers or small interactive gadgets.

  • RC Cars & Vehicles

Use the joystick to control steering (servo) and throttle (motor driver).

Perfect for remote-controlled boats, cars, or tanks.

  • Camera Gimbals

Smoothly aim a camera by controlling servo motors with a joystick.


Expected Result

➡ Right Movement | Center Position | ⬅ Left Movement

  • When we move with the joystick to the left the servo will also turn left, when we move with the joystick to the right the servo will also move to the right, if we do nothing the servo will stay in a Center Position.

The servo will precisely follow your joystick’s position, allowing smooth and accurate control—ready to be expanded into larger robotics or automation projects.


Gerbers, KiCad schematics, BOM, ZIP Files, Layouts all included here and on GitHub: Link: https://github.com/Ondrak-123/Arduino-basics



Code
Schematic and Layout
Join us
Wanna be a dedicated PCBWay writer? We definately look forward to having you with us.
  • Comments(3)
Upload photo
You can only upload 5 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
0 / 10000
    Back to top