In the late 90's early 2000's, I bought a Forte VFX1 headgear VR headset. This came with a hand device they called a Cyberpuck. Both the VFX1 and the Cyberpuck used the Earths magnetic field to determine movement. In the VFX1 this determined where the wearer was looking and in the case of the Cyberpuck, what hand movements the user was making.

This is my version of the Cyberpuck, upgraded to be wireless. I was inspired to develop this based on an Element14 video I watched where Clem tries to make a mouse using an IMU sensor but ends up with something you have to twist and tilt to get working. I though, that is like the old Cyberpuck I used to have.
The Cyberpuck is a 2DOF mouse that uses pitch to move the mouse pointer up and down the screen and roll to move it left and right. I can't remember how I used the original version but for this one, the mouse only moves if the lower button (GPIO2) is pressed. This is so you can set it down with the mouse pointer moving unintentionally. The top button (GPIO4) provides the left mouse button functionality while the middle button (GPIO3) is the right mouse button.
Parts List:
Wiring Diagram:

I bought all the parts except the battery from Amazon. The battery I bought from eBay.
I chose the XIAO ESP32C3 microcontroller because it was being advertised in my Google news feed at the time and I liked the small size. It has a hardware UART (serial interface) which means that it can't simulate a mouse over the USB cable so Bluetooth has to be used. If you don't want to use the battery, it can be powered over USB but you still need to use Bluetooth to use it as a mouse. Other XIAO size micro controllers can be used but you'll need to modify the code if the pinouts are different.

Keep the wires short when wiring things up so that everything fits inside the case.

There is a lip to the right hand side of the bottom case where the battery is. The top lid has a matching part which slips below this lip and using the USB access hole as a guide to ensure the two halves aren't twisted fold the two halves together. There are protrusions on the top half of the case that fit down the side of the switches and hold it closed.
Once built download the sketch from it's GitHub page. https://github.com/ChromeBee/Cyberpuck-Compass-Mouse
You can also find the Fusion 360 design and a STEP file there.
The code uses two libraries. The QMC5883LCompass library so that the microcontroller can use the GT-271 sensor and a BLEMouse library so it can act as a Bluetooth mouse. Download the one at https://github.com/sirfragles/ESP32-BLE-Mouse/tree/dev The official BLEMouse library fails to compile but this version has a fix installed.
To minimise battery drain when the mouse isn't being used, the ESP32C3 will go into a deep sleep state after 2 minutes of non use. Pressing any of the buttons will wake it up again. The battery is recharged by plugging in the microcontrollers USB port into any 5v USB power source such as a computer or power bank .
With the Cyberpuck mouse awake, Open the Bluetooth settings on whatever device you want to use it with and scan for new devices. “Cyberpuck mouse” should appear in the list as a mouse device. Connect to it, and holding the device in your hand with the middle buttons pointing forward and the USB connector below, press the button connected to GPIO2 (the bottom button in my case and the bottom button in the wiring diagram), and move your arm up, tilting from the elbow and the mouse pointer should go up, tilting the device to the side should move the pointer to the left or right depending on the direction of the tilt.
Here is a short demonstration followed by the device being assembled.
I don't see this replacing the traditional mouse for word processing or spreadsheet work but more as a gaming or presentation control device. I think it would be good in a simple flight simulator or as a weapon in a simple first person shooter. I have had fun playing online mouse games, but I keep losing to people using a traditional mouse. Maybe it is because I need more practice (or maybe I'm crap at the games).
The author marked this model as their own original creation.