Introduction: Joystick Controlled PC Mouse Using Arduino UNO

About: Engineering Student in India

In This Tutorial We are going to see how to make joystick controlled pc mouse by using Arduino Uno

Step 1: Required Components:

For this we need arduino board (*You Can Use Any Arduino Board)

joystick Module

Potentiometer (If you don't have joystick Module)

Push Buttons

few jumper (male to female)

Step 2: Circuit Connection

1) First make the circuit as per the schematics

if you don't have joystick use the circuit that have potentionmeter

Connection For joystick Module to Arduino

Joystick Module Arduino Code

GND GND

Vcc 5V

VRx A0

VRy A1

Sw D8

Connection For Potentiometer to Arduino

  1. Connect the two potentiometer 3rd pin to 5v of Arduino
  2. Connect the two potentiometer 1st pin to GND of Arduino
  3. Connect one potentiometer center pin that is (wiper) to Analog Pin A0 in Arduino
  4. Connect another potentiometer center pin to Analog Pin A1 in Arduino
  5. Connect the push button to Digital Pin D8 (for using as left click of mouse)

Step 3: Upload Arduino Code

Program LINK

First Upload the Arduino Code To your microcontroller

Before uploading check the port number and board type

Step 4: Execute Python Code

Program LINKNow Run the python script . This script make the serial communication with arduino

Before executing the program

Install the Required modules Like Pyserial and Pyautogui

pip command for pyserial : pip install pyserial
pip command for pyautogui : pip install PyAutoGUI

Run this above command in Terminal By run as adminstrator mode

And Don't forgot to enter your arduino port number

Now Run the code

Step 5: Final Output