Skip to content

mbyx/imu_rat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

imu_rat

A Blueooth Air (Mouse) Gun powered by an ESP32 and an MPU6500 IMU.

License: MIT

Hardware

The hardware consists of an ESP32 connected via I2C to an MPU6500. This is embedded into an old lightgun that was used by a clone NES console. The ESP32 is powered via the USB port that acts as the only wire in this setup.

Hardware

Software

The software is a single file meant to be uploaded from the Arduino IDE. To upload, you must:

  1. Connect an ESP32 with the IMU on pins SDA = 21, SCL = 22.
  2. COnnect the ESP32 to the computer via a USB cable.
  3. Make sure you have the Espressif core for the Arduino, and select the ESP32 Dev Module board.
  4. From the board settings, choose Partition Scheme, and choose the Minimal Scheme, with 1.9MB for the app parititon as well as an OTA partition. This is required as the default partition scheme is not sufficient for this application.
  5. Make sure you have: https://github.com/tzapu/wifimanager, https://github.com/ayushsharma82/ElegantOTA.
  6. Click upload.

Implementation

The code makes use of a simple state machine that switches between two states. The default state is that of a BLE transmitter that advertises itself as a BLE HID Mouse. When connected, it maps the gyroscope readings of the IMU to the mouse position.

The other state is for updating the code via Wifi. As it is quite difficult to use both Bluetooth and Wifi at the same time on an ESP32, the state is switched using the BOOT button.

A demo video is given below (it may be desynced by a second or two as I'm not good at editing videos):

About

A Blueooth Air (Mouse) Gun powered by an ESP32 and an MPU6500 IMU.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages