Introduction
An air mouse is a simple way to explore motion-based control without extra hardware like cameras or infrared tracking. This project uses GENESIS to show how motion data from an accelerometer can be turned into real-time cursor movement, with haptic feedback and physical inputs for navigation. It is a compact example of combining sensing, feedback, and user interaction in one build.

What You'll Need
- Axiometa GENESIS (Gen1 or Gen2)
- LRA Motor (DA7820)
- Rotary Encoder
- Two Pad
- Accelerometer (MPU6050)
- PC/Mac
- Arduino IDE


Assemble
Plug the modules into the genesis as shown bellow
- LRA Motor -> Port 4
- Accelerometer -> Port 3
- Two Pad -> Port 8
- Rotary Encoder -> Port 7


At the bottom of this page, you will find the code needed for this project. Copy and paste it into Arduino IDE and upload it to the GENESIS.

Understanding the Code and Usage
Core Components:
- Motion Detection: The MPU6050 accelerometer reads gyroscope data to detect rotational movement in 3D space
- Calibration: On startup, the device takes 1000 samples while stationary to establish baseline values and eliminate drift
- USB HID Protocol: The ESP32-S3's native USB capabilities allow it to appear as a mouse without requiring drivers
How Movement Works: The code converts angular velocity from the gyroscope into cursor movement. When you rotate the device:
- Pitch (forward/backward tilt) controls vertical cursor movement
- Yaw (left/right rotation) controls horizontal cursor movement
- Roll movement is ignored to prevent accidental cursor jumps
Sensitivity Control: Open the Serial Monitor in Arduino IDE (115200 baud rate) to adjust sensitivity in real-time:
- Type
s0.3for high precision (slower movement) - Type
s1.0for balanced sensitivity - Type
s2.0for faster movement - Type
helpto see all commands
Input Mapping:
- Left pad = Left mouse click
- Right pad = Right mouse click
- Rotary encoder = Scroll wheel (rotate to scroll up/down)
- All inputs provide haptic feedback through the LRA motor
Usage Tips:
- Hold the device comfortably and make smooth, deliberate movements
- Small wrist rotations work better than large arm movements
- The device works best when held horizontally
- If the cursor drifts, place the device flat and restart to recalibrate
After uploading the code make sure you reset the board. And leave it flat and still for a few seconds until you hear a vibration. This means the accelerometer has successfully calibrated itself.
Now you can pick up your mouse and browse away!
NOTE: Because the code enables HID functionality, once its running, it is no longer in programming mode. If you wish to upload code again, press and hold the user button, then press reset button and release both. Now you can upload code again.
