Ever heard of a joystick? The answer would be obviously yes for people who like playing video games and also who are tech-savvy. What if I mention a thumb joystick, the first thing that comes to your mind eventually is game controllers. Definitely, it is used for playing games but it also acts as a great addition in DIY Electronics, and there are a lot of fun things that one can do with it.
This article covers the working and configuration of servo motor controlled by thumb joystick using Arduino in detail.
List Of Components Used
1. Servo motor
A servo motor is actually a rotary actuator that gives precise control in terms of its angular position, acceleration, and velocity. A servo motor works on the principle of PWM (Pulse width modulation). This implies that depending on the width of the pulse that is applied the rotor will turn in the desire position. For this interfacing, an SG90 servo motor is used. The white piece in the picture is a rotor and is controlled by a bunch of gears inside. If a DC source powers the motor then it is called a DC servo motor and if powered by an AC source then it is called an AC servo motor.
Buy SG90- Servo Motor from here.
2. Arduino Board
Arduino Board can read inputs such as light on a sensor, a finger on a button, or a Twitter message and convert it to an output such as activating a motor, turning on an LED, publishing something online. All of this can be done by sending a set of instructions to the microcontroller on the board by the use of the Arduino programming language.
Buy Arduino UNO from here.
3. Thumb Joystick
A #thumb joystick also called an analog joystick that has two potentiometers in it, one on the x-axis and the other on the y-axis, which separates the horizontal and the vertical movements respectively. So when we move this #joystick in the x-y plane the variable resistances of the potentiometer will vary and the Arduino will read this as an analog input. The rotatory head of the servo motor is controlled by the joystick.
Buy Thumb Joystick from here.
Circuit Diagram
The circuit below shows the connection of an #SG90 servo motor with the Arduino board and thumb joystick. There are three wires of the servo motor. The brown wire is the ground wire, the red one goes to the 5 volts, and the orange one is called the #PWM wire which is connected to the digital line of the servo motor and the yellow one of the joystick is connected to the analog pin of the Arduino board.
Note: We are using only 3 pins out of the 5 of the thumb joystick in this project.
The hardware arrangement of this project is very simple to make. First and foremost, connect the thumb joystick with the Arduino board. The connections for the thumb joystick and the Arduino board are given as:
Joystick Connection:
Joystick VCC (red wire) --> Arduino 5Volts
Joystick GND (brown wire) --> Arduino GND (grounded)
Joystick x_axis pin (yellow wire) --> #Arduino analog input pin A0
Subsequently, connect the servo motor with the Arduino board. The connections for servo motors with Arduino board are given as:
Servo Connection:
Servo VCC (red wire) --> Arduino 5Volts
Servo GND (brown wire) --> Arduino GND (grounded)
Servo signal pin (orange wire) --> Arduino pin 3
Code :
Note: Please change the file extension to .ino(Arduino IDE) file format before you upload the code to Arduino Board.
Working
When the thumb joystick moves along the axis, it gives us values from 0 to 1023, but as servo motor can take only values from 0 to 180 and it is the maximum angle that it can rotate to.
So we are simply converting the x_axis value which is in between 0 and 1023 to 0 and 180. Then by moving the joystick we see the servo motor moves accordingly. When the joystick is moved along the axis, the servo will move towards the right or left.
By changing the mapping value which is now from 0 to 180 to 0 to 90, we check out the results. Then we observe that the servo motor sets itself to a mean position of 45 degrees and moves accordingly from there as we move the joystick around.
Video By - Aishwarya Balajee
Video explanation of the whole working process for a better understanding.
The article depicts how the Arduino Joystick Interface can be implemented and one can understand the use of the Arduino Joystick in an application where we will control a Servo Motor. The joystick can be used in various applications like controlling DC Motors and Servo Motors, controlling LEDs, Remote-controlled Cars, Robotic Control, etc.
See also:
Order Electronics Projects
Want us to guide you through your project or make the project for you? Click on the button below or reach out to us via Call/WhatsApp at (+91) - 7600948607
You can -
Order Basic Electronics Projects
Order Embedded Systems Projects
Order IoT Projects
Order FPGA Projects
Order VLSI Projects
Order Image Processing Projects
Order Matlab Projects
Order TinkerCAD Projects
Order Proteus Projects
Click on the button below to fill out the project inquiry form -
Create Various Projects
Check out our Free Arduino Projects Playlist - Arduino Projects
Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects
Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects
Check out our Free IoT Projects Playlist - IoT Projects
Check out our Free Home Automation Projects Playlist - Home Automation Projects
Check out our Free NodeMCu Projects Playlist - NodeMCu Projects
Follow us -
Please do follow us i.e. #learnelectronicsindia to get daily updates about new blogs, videos, courses, products, offers, competitions, quizzes, and Internship Opportunities.
LearnElectronics India simplifies complex concepts beautifully. Thank you!
As an electronics enthusiast, I can't thank Learn Electronics India enough for this fantastic blog! The way they explained the concept of servo motor control using a joystick was nothing short of brilliant. The practical examples and diagrams made the learning experience enjoyable and engaging.