GithubHelp home page GithubHelp logo

krishna-13-cyber / bluetoothjoystick Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 3.0 85.08 MB

It is the project to make a joystick with the help of ESP-32 microcontroller using the Bluetooth connectivity...

License: GNU General Public License v3.0

CMake 0.55% Makefile 0.29% C 99.16%

bluetoothjoystick's Introduction

BluetoothJoystick

Bluetooth Joystick : A wireless joystick with ESP-32 microcontroller and Dual Axis Joystick Module using the Bluetooth connectivity.

Table of Contents

About The Project

Aim

The aim of this project is to make a Bluetooth Joystick using ESP32 which establishes Bluetooth Low Energy (BLE) Connection with the host device to provide controls by providing inputs. The ESP32 is capable of getting a unique signal for each key press. Accordingly it will transmit the signal information over bluetooth to the host device.

This image illustrates how our hardware looks like at the current stage

Hardware

Tech Stack

The following technologies have been used for the making of this project.

File Structure

.
├── main                    # Contains files used for building and flashing
├── docs                    # Documentation files (alternatively `doc`)
│   ├── report.pdf          # Project report
│   └── results             # Folder containing screenshots, gifs, videos of results
├── src                     # Source files (alternatively `lib` or `app`)
├── ...
├── test                    # Test files (alternatively `spec` or `tests`)
│   ├── benchmarks          # Load and stress tests
│   ├── integration         # End-to-end, integration tests (alternatively `e2e`)
│   └── unit                # Unit tests
├── ...
├── tools                   # Tools and utilities
├── LICENSE
├── README.md 
├── Setup.md                # If Installation instructions are lengthy

Getting Started

Prerequisites

To flash this project install ESP-IDF: https://github.com/espressif/esp-idf

Cloning the repository

Clone the project by typing the following command in your Terminal/CommandPrompt

git clone https://github.com/Krishna-13-cyber/BluetoothJoystick.git

cd BluetoothJoystick

Hardware

Connections

Connect the ESP32 to your desktop via USB to flash the code in it. And connect the Joystick to ESP32 as per the table given below. Connection Illustration

JoyStick Pin ESP32 Pin
5V 3V3
GND GND
VRx GPIO39
VRy GPIO34
SW GPIO25

You are all set to flash the code after completing the connections.

Usage

After following the above steps , use the following commands to: Build

idf.py build

Flash

idf.py -p (PORT) flash monitor

Configuration

idf.py menuconfig

Theory and Approach

Theory:

  • The main motto of the project is to make the setup wireless.This can be achieved by using the ability of ESP-32 to have BLE within it with which it can be connected over bluetooth to the Computer System and returns the value according to the movement of the joystick.
  • The esp-idf(Espressif's official IoT Development Framework)which was the main resource for our project, has all the information about the pinning system and channels present have to be read and their use have to studied from here.The framework tells us the about the channels which can be used,the usage of pins for different functions(ADC,DAC,GRD) and the channels which are more efficient in bluetooth connectivity are to be used,which is ChannelNo.1 in our case.
  • There is a dual-axis high quality JoyStick Module . It can be used to sense movements in 2 directions(axes). It also has an inbuilt switch which can be activated by pressing the stick.This is the joystick module which we are using in the project.
  • The values received from the ADC are the voltage values(raw values),as voltage values which are analog are first converted to binary and then to digital format,So it is obtained in the raw form.The ADC values are ranging from 0-4095 as it works on 12 bit,that is it has 4096 values.The values returned depend on the movement of joystick and returns extreme values for the end point movement. The joystick, depending on the requirement of the game or task,its use can be changed and modified in 2-D constraint(joystick supports 2-D movements only).

Approach:

  • The approach of the project is quite simple and understandable,first of all its aim is to make a bluetooth joystick.To take a look at the hardware stuff we need a joystick module(2-D module in this project),a ESP-32 microcontroller(according to the version kitc the pinout may vary),jumper wires for connection.
  • For the bluetooth establishment we tried by connecting our esp32 as a mouse.To understand when the connection is established,how does the mouse behave as in the cursor.Next we start to connect the proper pinout connection of the ESP-32 to the Joystick. So we want the system to know that if a joystick is moved the ESP-32 send or returns some value,for that we have the concept of ADC,this continuously sends the instant voltage values and when we move our joystick in different direction(2-D) it returns different values(extreme values are expected for end movements).
  • Then finally we have integrate both together that is the bluetooth part and joystick returned values(which will tell the movement respective to our code).According to the condition we want(the range of values), we can assign a function to send mouse the values(cursor speed,specifications).This will complete our project and can be modified to be used in games.This can be used in games where there is only a 2-D requirement as the joystick supports 2-D use only.

Code Flowchart

Flowchart

Results and Demo

These are the output obtained in initial stage as shown in the link attached to the below mentioned video.

These are the Output of the Games played with help of Joystick Module. Mouse-Game Mouse-Game2

Future Work

  • The following developments are yet to be achieved
  • Establishing BlueTooth Connection
  • Obtaining ADC Values
  • Moving the Cursor
  • Controlling a Game
  • Using it to send keyboard keys
  • Adding more buttons to it

Troubleshooting

While Configuring for the first time if you face any problem, check the ESP-IDF's Menu Configuration

idf.py menuconfig

Then go to components/bluetooth and enable bluetooth Press ctrl+s to save the configuration then

idf.py build

Contributors

Acknowledgements and Resources

License

The License Used for this Project.

bluetoothjoystick's People

Contributors

krishna-13-cyber avatar omsheladia avatar

Stargazers

 avatar  avatar Sagar Chotalia avatar Vedant Paranjape avatar Gautam Agrawal avatar Himanshu Chougule avatar Siddharth Sankhe avatar RISHIKESH DONADKAR avatar Siddesh Patil avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.