Desktop Reaction-Wheel Satellite
This desktop satellite turns about a vertical axis. A bearing connects the body to its base, and a motor inside the body spins a weighted flywheel. As the motor accelerates the flywheel, the opposite torque turns the body the other way.
How the reaction wheel turns the body
Let be the moment of inertia of the body and everything fixed to it, that of the flywheel and the parts rotating with it, the body’s angular velocity, and the flywheel’s angular velocity relative to the body. With zero initial angular momentum and negligible external torque from the bearing and cables,
The AS5600 reads the flywheel’s angle relative to the body. Estimating the body’s heading requires the separate MPU6050 and QMC5883P sensors mounted on the body.
Heading estimation under motor magnetic interference
During testing, moving the motor relative to the QMC5883P changed the heading reading. The magnetometer measures the local field, so the motor’s permanent magnets and energized windings can deflect the measured field away from the Earth’s field. The firmware tracks turns with the gyroscope and uses accepted magnetometer samples to correct heading drift slowly.
- Calibrate before alignment. With the motor unpowered, rotate the body through several orientations. The range measured on each axis provides an estimate of its offset and scale. At startup or realignment, the body stays still while the field remains stable for about 2 seconds, establishing the initial heading and reference field strength and inclination.
- Track rapid rotations with the gyroscope. A six-axis Madgwick filter estimates attitude from the MPU6050’s gyroscope and accelerometer. Tilt-compensated magnetic readings correct heading only. Roll and pitch remain the outputs of the six-axis filter.
- Reject abnormal readings and limit correction speed. The firmware checks magnetic field strength and inclination against the reference, and compares the magnetic heading with the current estimate. The default limits are 20%, 10°, and 20°, respectively. If any limit is exceeded, the firmware pauses magnetic correction, continues tracking with the gyroscope, and retains the original magnetic reference. When readings pass the checks, correction is capped at 0.2° per second to avoid sudden jumps in heading.
The method is intended for short disturbances. Gyroscope drift can accumulate while magnetic correction is suspended, so the magnetometer should be mounted away from the motor and high-current wiring.
Structure and control
- Mechanics: The body, base, flywheel, motor mount, side panels, and antenna are 3D printed.
- Motor and attitude control: An ESP32-S3 uses SimpleFOC to drive a 2804 brushless motor. The firmware supports body heading, angular velocity, and sinusoidal heading commands.
- Tuning and logging: A desktop tool receives nominal 50 Hz UDP telemetry over Wi-Fi. It plots data, logs CSV files, and sends commands.
Bearing friction and external cables can still apply torque to this single-axis demonstrator.
Build files
The print archive contains 18 individual STL files. The code archive contains the final firmware and its matching desktop tuning tool. The build guide covers wiring, compilation, flashing, and initial testing.