Joystick Shield for Arduino & Raspberry Pi PS2 type

৳ 245

Here we have a Joystick shield that sits atop your Arduino and turns it into a simple controller. 5 momentary push buttons and a two-axis thumb joystick gives your Arduino functionality on the level of the old Nintendo

  • Can be used with Arduino and Raspberry Pie
  • Direct plug puzzle board, No soldering needed
  • Five momentary push buttons (4+ joystick select button, just like the PlayStation 3 analog stick push button)
  • two-axis thumb joystick, two-axis 4 push buttons
  • nRF24L01 RF interface
  • Bluetooth module interface
  • I2C communication interface
  • Option 3.3V or 5V, can use this model for other 3.3V microcontroller platforms, such as STM32.
  • Size: 8.7 x 5.5cm

In stock

SKU: A1B142 Categories: , Tags: , ,

Joystick Shield for Arduino & Raspberry Pi PS2 type

Here we have Joystick Shield for Arduino & Raspberry Pi PS2 type that sits atop your Arduino and turns it into a simple controller. Five momentary push buttons and a two-axis thumb joystick gives your Arduino functionality on the level of the old Nintendo. This product is highly recommended to anyone wanting a fun and simple user interface for their Arduino projects.

Features of Joystick Shield for Arduino & Raspberry Pi PS2 type

  • For all version of Arduino and Raspberry Pie
  • Direct plug puzzle board, No soldering needed
  • Five momentary push buttons (4+ joystick select button, just like the PlayStation 3 analog stick push button)
  • two-axis thumb joystick, two-axis 4 push buttons
  • nRF24L01 RF interface
  • Bluetooth module interface
  • I2C communication interface
  • Option 3.3V or 5V, can use this model for other 3.3V microcontroller platforms, such as STM32.
  • Size: 8.7 x 5.5cm

Sample Experiment 1: Read joystick values

The joystick has two potentiometers, which you connect to analog pins A0 and A1 on your Arduino. The value of A0 corresponds to the X position. The value of A1 corresponds to the Y position. To read these analog values, use the AnalogRead() function.

Hardware

1 x Arduino Uno
1 x Arduino Joystick Shield v2.4

Steps:

  1. Attach your joy stick shield to the Arduino board.
  2. Connect your Arduino board to your PC.
  3. The LED will light on your joystick shield, showing that it’s working properly.
  4. Write the sketch and compile it before uploading to your board; it’s good practice to compile your sketch before uploading.
  5. After the sketch is uploaded, run the serial monitor to observe the values.
  6. Move joystick in different directions and you will notice that the values on serial monitor will change.

You can move the joystick in 8 directions: up, right-up, right, right-down, down, down-left, left, left-up. If the values change on your serial monitor, your shield is working properly.

This code will display something like this if the shield is connected to 5 V.

Output of Joystick Shield for Arduino & Raspberry Pi PS2 type (Experiment 1)

Code

// define global variables for analog pins.
// X values will be read from pin 0 and Y from pin 1

#define PIN_ANALOG_X 0
#define PIN_ANALOG_Y 1

void setup() {

// Start serial because we will observe values at serial monitor

Serial.begin(9600);

}

void loop() {

// Print x axis values

Serial.print(“x: “);
Serial.println(analogRead(PIN_ANALOG_X));

// Print y axis values

Serial.print(“y: “);
Serial.println(analogRead(PIN_ANALOG_Y));

// Some delay to clearly observe your values on serial monitor.

delay(500);

}

Sample Experiment 2: Using the Joystick to Control Motion

To control motion along the X-axis, you first have to read the position of the X-axis potentiometer and determine if the user is pressing the the control to the right or the left, or not pressing it at all. When not being pressed either right or left, the value of A0 will typically be 523. In order to account for some variation in that reading between different shield units, we’ll set a tolerance of 30. That means that when we read a value of between 493 and 553, we will assume that the user is not pressing the joystick. A reading of less than 493 will mean that the user is pressing the joystick to the left and wants the object being controlled to move left. A reading of greater than 553 means that the user is pressing the joystick to the right and wants the object being controlled to move right.

This code will display something like this:

Output of Joystick Shield for Arduino & Raspberry Pi PS2 type (Experiment 2)

Steps

  1. Attach your joy stick shield over Arduino board.
  2. Connect your Arduino board to your PC.
  3. Led will turn on, on your joystick shield showing that it’s working properly.
  4. Write the sketch and compile it before uploading to your board, it is just a good practice to compile your sketch before uploading.
  5. After the sketch is uploaded run serial monitor to observe the values.
  6. As you move joystick, serial monitor will tell you the direction in which you move your joystick.

The code below that will display the direction that the user is pressing the joystick instead of displaying analog values.

Code

// define global variables for analog pins.

// X values will be read from pin 0 and Y from pin 1

#define PIN_ANALOG_X 0

#define PIN_ANALOG_Y 1

void setup() {

// Start serial because we will observe values at serial monitor

Serial.begin(9600);

}

void loop() {

// Print x axis values

Serial.print(“x: “);

Serial.println(analogRead(PIN_ANALOG_X));

// Print y axis values

Serial.print(“y: “);

Serial.println(analogRead(PIN_ANALOG_Y));

// Some delay to clearly observe your values on serial monitor.

delay(500);

}

 

Sample Experiment 3: Read Joystick Pushbutton Switches

The pushbutton switches are simply connected to Arduino digital I/O pins as shown in the table below:

Pin Connection of Joystick Shield for Arduino & Raspberry Pi PS2 type

When Key A is pressed a digital signal will be sent to D2 and so on. We will use the digitalRead() function to determine the state of the buttons.

Since there are no resistors connected to these buttons on joystick shield you have to enable pull up resistors on your Arduino. Below is the code to enable the pullup resistors and read the digital values.

Whenever a user presses a pushbutton, the Arduino will display the button value on the serial monitor.

Joystick Shield for Arduino & Raspberry Pi PS2 type sample code output (Experiment 3)

Steps

  1. Attach your joystick shield over Arduino board.
  2. Connect your Arduino board to your PC.
  3. Led will light on your joystick shield showing that it’s working properly.
  4. Write the sketch and compile it before uploading to your board (it’s good practice to compile your sketch before uploading).
  5. After the sketch is uploaded, run serial monitor to observe the values.
  6. Press any button on your joystick and it will display which button is pressed.

Code

#define BUTTON_UP 2

#define BUTTON_RIGHT 3

#define BUTTON_DOWN 4

#define BUTTON_LEFT 5

#define BUTTON_E 6

#define BUTTON_F 7

#define DELAY 500

void setup() {

Serial.begin(9600);

// to enable pull up resistors first write pin mode

// and then make that pin HIGH

pinMode(BUTTON_UP, INPUT);

digitalWrite(BUTTON_UP, HIGH);

pinMode(BUTTON_RIGHT, INPUT);

digitalWrite(BUTTON_RIGHT, HIGH);

pinMode(BUTTON_DOWN, INPUT);

digitalWrite(BUTTON_DOWN, HIGH);

pinMode(BUTTON_LEFT, INPUT);

digitalWrite(BUTTON_LEFT, HIGH);

pinMode(BUTTON_E, INPUT);

digitalWrite(BUTTON_E, HIGH);

pinMode(BUTTON_F, INPUT);

digitalWrite(BUTTON_F, HIGH);

}

void loop() {

if(digitalRead(BUTTON_UP) == LOW) {

Serial.println(“Button A is pressed”);

delay(DELAY);

}

else if(digitalRead(BUTTON_RIGHT) == LOW) {

Serial.println(“Button B is pressed”);

delay(DELAY);

}

else if(digitalRead(BUTTON_DOWN) == LOW) {

Serial.println(“Button C is pressed”);

delay(DELAY);

}

else if(digitalRead(BUTTON_LEFT) == LOW) {

Serial.println(“Button D is pressed”);

delay(DELAY);

}

else if(digitalRead(BUTTON_E) == LOW) {

Serial.println(“Button E is pressed”);

delay(DELAY);

}

else if(digitalRead(BUTTON_F) == LOW) {

Serial.println(“Button F is pressed”);

delay(DELAY);

}

}

 

Related video here

For other types of keypads, click Keypads

What is the price of Joystick Shield for Arduino & Raspberry Pi PS2 type in Bangladesh?

Please check out our price at the top of the page.

এখানে আমাদের কাছে Arduino এবং Raspberry Pi এর জন্য Joystick Shield for Arduino PS2 টাইপ রয়েছে যা Arduino এর উপরে বসে এবং এটিকে একটি সাধারণ কন্ট্রোলারে পরিণত করে। ৫টি পুশ বোতাম এবং একটি দুই-অক্ষের থাম্ব জয়স্টিক পুরানো নিন্টেন্ডোর স্তরে Arduino কার্যকারিতা দেয়।

Joystick Shield for Arduino best price in Bangladesh

Reviews

There are no reviews yet.

Be the first to review “Joystick Shield for Arduino & Raspberry Pi PS2 type”

0

TOP

X