Yato-tech / OneHand-Controller

One hand controller, using an Esp32 and multiple sensors
1 stars 0 forks source link

One-Handed Controller with IMU and Joystick

This project implements a one-handed controller using an ESP32, a joystick, buttons, and an IMU (Inertial Measurement Unit). The controller is designed to work as a Bluetooth gamepad, using the ESP32 BLE capabilities.

Components

Features

My Wiring

Installation

  1. Install the Arduino IDE.
  2. Install the ESP32 core for Arduino from the Boards Manager.
  3. Install the required libraries:
    • Adafruit_BNO055
    • Adafruit_Sensor
    • imumaths
    • ESP32-BLE-Gamepad
  4. Clone this repository or download the ZIP file and extract it.
git clone https://github.com/Yato-tech/OneHand-Controller.git
  1. Open the MyProject.ino file in the Arduino IDE.
  2. Select your board as ESP32-WROOM-DA Module in the Arduino IDE.
  3. Compile and upload the code to your ESP32.

Usage

Power on the ESP32. The device will start in Bluetooth mode and will be discoverable as a gamepad. Connect to the gamepad from your PC, smartphone, or any compatible device. Use the joystick to control the X and Y axes. The IMU sensor will control additional axes (Yaw, Pitch, and Roll). The buttons can be used to simulate gamepad buttons.

Code Structure

MyProject.ino: The main entry point of the project. Initializes all components and handles the main loop. Joystick.h/cpp: Handles the joystick inputs and converts them into gamepad axis values. IMU.h/cpp: Manages the IMU sensor data (Yaw, Pitch, Roll) and converts it into usable gamepad axis values. Button.h/cpp: Handles button inputs. BLEManager.h/cpp: Manages Bluetooth communication and sets up the BLE Gamepad.

Troubleshooting

IMU Not Detected: Ensure that the BNO055 IMU is connected correctly via I2C. Check the wiring for any loose connections. Bluetooth Connection Issues: Make sure that the ESP32 is properly configured for BLE. If you're having trouble pairing, try resetting the device or clearing the Bluetooth cache on your phone/PC. Joystick/Buttons Not Responding: Verify that all GPIO pins are correctly assigned and wired. Ensure that the ESP32 is receiving analog inputs from the joystick. Contributing Feel free to open an issue or submit a pull request for any improvements or bug fixes.

Future Plans

License

This project is licensed under the MIT License. See the LICENSE file for more details.