This repo contains the Arduino code for a highschool computer engineering project. The goal is to create a USB mouse controlled via gyroscopic rotation with an Arduino Leonardo and an MPU 6050 gyroscope/accelerometer
Arduino Mouse/Keyboard Reference
The goal is to create a USB mouse whose pointer has a velocity that is controlled via the tilt of the device. So, when the mouse is held flat in the air, the cursor should be stationary. If it is tilted to the left, the cursor should start to move the left of the screen proportional to the tilt.
We aim to include 2 left/right mouse buttons, a "scroll button" that, when depressed, causes the orientation of mouse to control scrolling the mouse wheel up/down (basically a tilt scroll wheel), and potentially another button for calibration, setting what physical orientation of the mouse has a zero x/y pointer velocity.
The mouse shell will be 3D-printed, and the device will be attached to the computer via a USB cable.
The MPU-6050 seems to return values corresponding to the orientation of the device relative to it's previous sampling state (can this be configured?). When motionless, it returns values for x/y/z ranging between about negative 500 to positive 500. When rotated sharply, it returns much larger values (~10-100 times greater). We need to find the range of values we can safely ignore due to, for example, natural disturbances or slight wrist/arm shaking.
The main loop will involve fetching and processing the gyroscope's values, updating the x/y internal velocity variables, and finally updating the mouse's position with Mouse.move().
- The mouse should be comfortable to hold in the air
- We should consider making a brace / wrist mount to reduce tension from holding the mouse
- The buttons should be comfortable to reach from rest position (left/right and top buttons)
The mouse shell will need slots to support our switches. I have 3 of the thick/clicky push switches, and a bunch of slide-switches. We can probably harvest any extra parts we need from scrap in the compeng room.
- Let's add some branding! so we can make mouse better ! -Jasper-
- LED at bottom of the shell