Arduino Projects

Servo Motor Arduino, Joystick servo motor control

Servo Motor Arduino:

 

Servo Motor Arduino- In this article, you are going to learn how to control Servo Motors using Arduino and a 2-axis Analog Joystick.  It’s a complete guide for beginners explaining how to wire up the Joystick and different servos and how to take care of the power supply needs. In this tutorial, we will using a micro servo motor, 10Kg torque servo motor, and a 25Kg torque servo motor. I also have a detailed article on how to control multiple servos at the same time using an Ultrasonic Sensor.




allpcb circuit

Amazon Links:

Arduino Nano USB-C Type (Recommended)

2-axis Analog Joystick

25Kg Torque Servo

10Kg Torque Servo

Small Servo

*Disclosure: These are affiliate links. As an Amazon Associate I earn from qualifying purchases.



MG996R Servo:

MG996R Metal Gear Micro Servo Motor with a maximum torque of 11 kg/cm rotates from 0 to 180 degree based on the duty cycle of the PWM. The MG996R is a metal gear servo motor with a maximum stall torque of 11 kg/cm. Like other RC servos the motor rotates from 0 to 180 degree based on the duty cycle of the PWM wave supplied to its signal pin.

Servo Motor Arduino

 

Wire Number Wire Colour Description
1 Brown Ground wire connected to the ground of system
2 Red Powers the motor typically +5V is used
3 Yellow PWM signal is given in through this wire to drive the motor



Specification:

  • Operating Voltage is +5V typically
  • Current: 2.5A (6V)
  • Stall Torque: 9.4 kg/cm (at 4.8V)
  • Maximum Stall Torque: 11 kg/cm (6V)
  • Operating speed is 0.17 s/60°
  • Gear Type: Metal
  • Rotation : 0°- 180°
  • Weight of motor : 55gm
  • Package includes gear horns and screws



Analog Joystick:

Servo Motor Arduino

This is a JoyStick Module PS2 Breakout Sensor very similar to the ‘analog’ joysticks on PS2 (PlayStation 2) controllers. Directional movements are simply two potentiometers – one for each axis. Pots are ~10k each. This joystick also has a select button that is actuated when the joystick is press down. With the help of this Joystick Module, you can measure position coordinates on the X and Y axis by moving the “hat”. It also contains a switch that is press-able by pushing the “hat”.It also contains a switch that is press-able by pushing the “hat” down. Similar to the XBOX controller.

The X and Y axes are two 10k potentiometers which control 2D movement by generating analog signals. When the module is in working mode, it will output two analog values, representing two directions. This module uses the 5V power supply, and value, when reading through analog input, would be about 2.5V, a value will increase with joystick movement and will go up till maximum 5V; the value will decrease when the joystick is moved in other direction till 0V.

Servo Motor Arduino



Pins:

GND: Ground (0V)
Vcc: Power (+5V)
VRx: X-axis potentiometer.
VRy: Y-axis potentiometer.
SW: Push-button.

Specification:

  • Operating Voltage: 5V.
  • Dimensions: 40 x 27 x 15 (LxWxH) mm
  • Weight: 10gm (without Hat).
  • Interface: 2.54mm pin interface leads
  • Long service life and stable performance
  • Cross rocker as a two-way 10K resistor, with the rocker in a different direction.



Servo Motor Arduino Circuit Diagram:

Servo Motor Arduino

These connections are same for all the Servo motors except the power supply.

  • Connect the VCC pin of the JoyStick with Vin of the Arduino nano
  • Connect the Ground pin of the JoyStick with Ground pin of the Arduino nano
  • Connect the Vrx pin of the JoyStick with A0 pin of the Arduino nano
  • Connect the Vry pin of the JoyStick with A1 pin of the Arduino nano
  • Connect the signal wire of the Servo motor with D9 pin of the Arduino nano
  • Connect the VCC pin of the Servo motor with Vin pin of the Arduino nano
  • Connect the Ground pin of the Servo motor with Ground pin of the Arduino nano

If you are using a Micro Servo motor then there is no need to connect an external 5V power supply. You can simply use the Arduino Uno or Arduino Nano onboard power supply to power up the Servo. But if in case you are planning on using large Servo Motors then you will need to connect the Vin and GND pins of the Arduino to the external 5V power supply.

Servo Motor Arduino

On my designed Arduino development board I have added the 5V and 3A power supply. But if it’s hard for you to make this development board then you can follow the circuit diagram given below.

Servo Motor Arduino



Servo Motor Arduino Programming:

Practical Demonstration:

I was able to control all the three Servo Motors.

Joystick + Micro Servo Motor:

As I said earlier, you can power up the Micro Servo Motors using the Arduino onboard 5V power supply. But if you are using multiple of these servos then use an external power supply.

Servo Motor Arduino



Joystick + 10Kg Torque Servo Motor:

For 10Kg and High Torque Servos use an external power supply as I explained.

Servo Motor Arduino

Joystick + 25Kg Servo Motor:

Servo Motor Arduino




Watch Video Tutorial:

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button