Menu Close

Thumb Joy Stick with Arduino

Learn how to use Robo India’s Joystick breakout board with arduino. This Step by step tutorial explains all you need about Joystick, This tutorial will help to embed your projects with joystick.

1. Introduction:

This is a 2 axis analog Joystick offered by Robo India.

This is very helpful for the precise movement of manual machines or robots. We will use it with Arduino ADC i.e. 10 Bit ADC. So we have a range from 0 to 1023 for both X and Y axis.

Thus every position of the joystick can be marked here and each will have distinct/distinguishable value. Such values can be associated with set of actions e.g. movement of robot.

2. Hardware Required

S.No.ItemQuantity
1.R-Board with FTDI or Arduino Board1
2.Thumb Joy Stick Breakout Board1
3.Male to female Jumpers 4

Make the following arrangemet-

or

3. Programming

Copy and paste the following programme to the Arduino IDE, Upload the same to the R-Board/ Arduino.

You may download this code (Arduino Sketch) from here.

// Robo India Tutorial on using Analog Thumb Joystick. 
// www.roboindia.com

  
int sensorPinX = A0;    // select the input pin for X Axis values     
int sensorValueX = 0;   // variable to store the value of X Axis.
int sensorPinY = A1;    // select the input pin for Y Axis.     
int sensorValueY = 0;  // variable to store the value of Y Axis.

 
void setup(){ 
  Serial.begin(9600);   // Setup Serial Communication.               
  Serial.print("ROBO INDIA\n");  
  Serial.print("roboindia.com\n");
}

void loop(){
  sensorValueX = analogRead(sensorPinX);   // Reading Values of X Axis.
  sensorValueY = analogRead(sensorPinY);   // Reading Values of Y Axis.
  Serial.print("X Axis-");
  Serial.print(sensorValueX);              // Printing Values of X Axis. 
  Serial.print("\nY Axis-");
  Serial.print(sensorValueY);              // Printing Values of Y Axis. 
  Serial.print("\n"); 
  delay(700);                              // Waiting for a while.
  

  
}


4. Output

Here is the output –

or


So you can see in the video, After uploading above mentioned code, open serial monitor and you can see the changes in value for both of the axis as you change the thumb joy stick. Add conditions and set of action you want for the condition. Your project is ready with thumb joystick.

thumb Joystick is pressed down the switch pin gets connected to ground. This features may be used in projects as well.

if you have any query please write us at: support@roboindia.com

Thanks and Regards
Content Development Team 
Robo India
http://roboindia.com

Leave a Reply