0

members

Easy Basics: Project 015b Joystick PS2 module and LCD 1602 I2C module

of Acoptex.com in UNO

Basics: Project 015b

Project name: Joystick PS2 module and LCD 1602 I2C module

Attachments: libraries and program

In this project, you need these parts :

1.Aruduino Uno R3 (you can also use the other version of Arduino)

2.Arduino IDE ( you can download it from here  )

3.Jumper cables

4. Breadboard

5. Joystick PS2 module 1pc

6. LCD 1602 I2C module

 

General

We will learn how to use joystick PS2 module with LCD1602 I2C in this project.

Understanding LCD 1602 I2C module

You can see more information here.

Understanding joystick PS2 module

A joystick is an input device consisting of a stick that pivots on a base and reports its angle or direction to the device it is controlling. Joysticks are often used to control video games and robots.

The PS2 style joystick is a thumb operated device, that when put to creative use, offers a convenient way of getting operator input. Its fundamentally consists of two potentiometers and a push button switch. The two potentiometers indicate which direction the potentiometer is being pushed. The switch sends a low (or ground) when the joy stick knob is pressed.

As you can see in the schematic below, full deflection of a potentiometer in either direction will provide ground or the supply voltage as an output.

In order to put this thumb control to use,  you are going to want to understand which direction is X and which direction is Y.  You will also need to decipher the direction it is being pushed in either the X or the Y direction.

In this project we are using analog inputs to measure the joystick position. The analog inputs provided indications that range between 0 and 1023.

The graphic below shows the X and Y directions and also gives an indication of how the outputs will respond when the joystick is pushed in various directions.  Keep in mind,  the graphic you see is based on my model and may be different than yours.   In this case you need to experiment a little and draw your own sketch so that the orientations are clear.

Joytick PS2 module is used in our project. You can find the joystick PS2 module specification here.

Signals and contacts of LCD 1602 I2C module

As you can see on the back of LCD 1602 module there 4 connections: GND (-), VCC (+5V), Serial Data Line (SDA) and Serial Clock Line (SCL).

Signals and connections of joystick PS2 module

Joystick PS2 module has two analog outputs (corresponding to X and Y coordinates) and one digital output representing whether it is pressed on Z axis.

This input device interfaces to your Arduino via five pins.   Three of which are inputs to your Arduino, while the remaining two supply voltage (+5V) and ground (GND).

Build the circuit

The following picture shows the needed connections with the Arduino Uno 

Step by Step instruction

  1. Plug your Adruino Uno board into your PC and select the correct board and com port
  2. Open up serial monitor and set your baud to 9600 baud
  3. Find your I2C address. Each device has an I2C address that it uses to  accept commands or send messages. Load the sketch over at http://playground.arduino.cc/Main/I2cScanner and follow the instructions to use it.  By opening up the Serial monitor window after you upload the sketch, Arduino will scan the address range looking for a reply.  Even though the documentation said it was 0x27, this scanner can detect different (in my case 0x3F)
  4. Modify the sketch in attachments above (you can use the sketch below too): the line LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6,7, 3, POSITIVE) (See part marked bold)
  5. Verify and upload the the sketch to your Adruino Uno board
  6. Push the joystick and the coordinates of X and Y axes displayed on Serial Monitor will change; press down the joystick, and the coordinate of Z=0 will be displayed too.

Summary

We learnt how to use joystick PS2 module with LCD 1602 I2C module.

Libraries:

  • See attachments on the begining of this project description.
  • We have used the library - NewliquidCrystal_1.3.4.zip which we downloaded, unzipped, changed the name of folder to LiquidCristal and added to libraries in my PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC.
  • If you have LiquidCristal folder in this location already - delete this folder and copy folder, which was made by you, to this location.
  • Wire library included in Arduino IDE which is installed in your PC.

Program/Sketch

  • See attachment on the begining of this project description. 


Other projects of Acoptex.com
Easy Basics: Project 101a Ai Thinker A9G GPRS GPS development board of Acoptex.com, Not selected 23-11-2019
Easy Basics: Project 100a Ai Thinker A9 GSM GPRS development board of Acoptex.com, Not selected 22-11-2019

Published at 24-07-2017
Viewed: 2109 times