Skip to content

How to simply interface the Joystick module with Arduino board

 

Hello there,

In this tutorial we gonna try to interface a Joystick module with an Arduino board, here as usual I’m using an Arduino Uno board. This module permit you to control robots, robots arms, motors… for example: control the motion of a robot (speed, direction), control robot arms positions….

You can check this project where I used this module to control an Arduino camera crane: Control dual axis FPV camera cradle with Joystick module

Learning how to use this module will help you using the PS2 wireless controller which I used for a simple project and for a robot:

The module I’m using has 5 pins (Vcc, GND, Xaxis,Yaxis and the push button pin):

Joysitck module

The joystick have 2 centered potentiometers, when powered they deliver an analog signal, and when used with Arduino it has these values: “0-1023”, and since they’re centered at standby they give the values around “512”, and for the button it has a digital output 0/1.

Wirings:

Wiring 1: no button problem

This normally the wiring, in case you don’t have the problem like me with the push button (check the video), it’s simple 5v and GND from the Arduino then we wire the pins X axis and Y axis with analog inputs here I used A0 and A1, and for last we wire the button pin with a Digital I/O here I used D2

 

Wiring 2: in case you got the same problem as me

 

Codes:

Here are “.ino” codes I used in the video, you can find X axis alone, Y axis alone and( X and Y), also the button alone, it’s simple to assemble them

Download codes here or:

Code 1: X axis simple reading

Code 2: Y axis simple reading

Code 3: Button reading

Code 4: X and Y axis reading

 

 

 

 

Yassine View All

Automation and Electrical Engineer, Electronics amateur trying to share my little projects.

2 thoughts on “How to simply interface the Joystick module with Arduino board Leave a comment

Leave a Reply

%d bloggers like this: