Reaction Wheel Attitude Control

Electronics - 28-11-2019

Reaction Wheel principles and usages

In the past, I made a system to experiment with a satellite attitude control mechanism for cubesats: magnetic torquers (also known as magnetorquers). These use an existing magnetic field, such as the Geomagnetic (Earth's) field, to apply torque on the spacecraft and achieve stability. I made Helmholtz coils to simulate the changing electromagnetic environnement: see article here...

In this project, I want to explore another way for spacecrafts to get active attitude stability and control: reaction wheels.

Hubble's reaction wheels During Servicing Mission 3B in March 2002, astronauts Michael Massimino (left) and James Newman (right) replaced one of Hubble’s four Reaction Wheel Assemblies, which help turn the spacecraft. Credits: NASA

The math backing reaction wheels is very simple. It is based on the conservation of angular momentum. An electric motor is attached to a flywheel which, when its rotation speed is changed, causes the spacecraft to begin to counter-rotate proportionately, following this equation:

$I_{flywheel}\cdot \omega_{flywheel} + I_{sat}\cdot \omega_{sat} = k \text{ (constant)}$

$\implies \Delta \omega_{sat} = -\frac{I_{flywheel}}{I_{sat}} \cdot\Delta\omega_{flywheel}$

ω is the angular speed. The I factor is the moment of inertia, which describes the opposition that the body exhibits to having its speed of rotation about an axis altered by the application of a torque (turning force). It's mathematical expression is:

$I=\iiint\limits _{Q}{\rho(x,y,y)\left\|r\right\|^2 \mathrm {d}V}$

For instance, for a solid cylinder of radius R about its central diameter with constant, this expression becomes:

$I = \frac{1}{2}mR^2$

For more complicated geometries (such as a spacecraft), it can be computed using advanced CAD software.

Spacecraft use this effect by storing a large amount of angular momentum in at least 3 flywheels (for 3 axes control), and change their own angular speed and attitude by slowing/accelerating the flywheel.

Diagram of a satellite with reaction wheels

This provides a high pointing accuracy which is required, for instance, to capture the breathtaking observations of the Hubble Space Telescope.

The model

To experiment with reaction wheel control, I made a one-axis model of a "satellite" capable of active detumbling and attitude control.

Physical build

The body of the satellite is depicted by a wooden disk. To get the free-spinning ability that the satellite would have in microgravity, it is attached to a vertical axis with 608ZZ ball bearings. The motor is coaxial, turning the flywheel.

Render of the 3D model from SolidWorks Render of the 3D model from SolidWorks

The main design consideration for the design of the flywheel is that the motor has a minimum and a maximum angular speed. When we reach one of these extremes, we lose the ability to compensate for additional motion in this direction. This state is called saturation, and to avoid it, satellites often thrusters to create an opposite angular speed, so that the motor can speed up or slow down to an adequate regime (desaturation). Another way of reducing the occurrence of saturations is to make the moment of inertia of the flywheel (I factor) as big as we can. However, because the motor has a limited torque/max. load, there is a balance to be found. Hence, to keep a lot of flexibility during the test phase, I 3D-printed a light wheel with 6 and 8mm holes:

Photo of the flywheel

By placing M6 or M8 screws, nuts and washers around the flywheel, we can fine-tune its moment of inertia. For instance, with 3 M6×35mm screws and 6 M6 nuts, my flywheel as a moment of inertia of about:

$I_{flywheel}=MR^2=0.06\times0.055^2=1.815\times10^{-4}\text{ kg}\cdot\text{m}^2$

The "satellite" disk itself is 180g:

$I_{sat}=\frac{1}{2}MR^2=\frac{1}{2}0.18\times0.075^2=5\times10^{-4}\text{ kg}\cdot\text{m}^2$

This means that he moment of inertia factor is about 0.4, hence, to detumble the satellite from 1 RPM to 0 RPM, the flywheel must change its own angular speed by 2.5 RPM in the opposite direction through the help of the motor.


To make the model work, we need:

  • Some way to measure angular speed and position: the MPU6050 gyroscope/accelerometer MEMS chip,
  • Some way to actuate the flywheel: a 920kv A2212 brushless DC motor, controlled by a 30A RC aircraft electronic speed controller (ESC),
  • A controller: the ATmega328 microcontroller, on an Arduino Nano board.

The full wiring diagram is:

Wiring diagram

The Arduino is powered by the 5V BEC (battery eliminator circuit) included on the ESC. Additionally, because the MPU6050 is 3.3V logic, I had to use a MOSFET-based bi-directional level converter board.

I soldered everything directly on the disk with minimal length of wire.

Photo of the electronic circuit.

The electrolytic decoupling capacitor smooths the 3.3V supply of the MPU6050.


This contraption is a fairly basic one-axis closed loop system: the speed/position of the disk is read by the gyro, and controlled by the rotation rate of the flywheel. I chose to use a simple PID (proportional–integral–derivative) controller as a control algorithm.

The tricky part is that the ESC I used can quickly accelerate the flywheel, but has no active braking. This means that the systems reacts very differently depending on the direction of the error it tries to compensate. The workaround I implemented is to use two PIDs: one for positive error and one for negative error. This is known as an asymmetric PID controller.

This block diagram represents my control loop:

Control loop block diagram

The PID controllers where tuned empirically. Their gain are somewhat interdependent, which makes the tuning process less obvious and prone to oscillations. A better solution would be to use a purpose-designed controller, especially as the physical parameters and relation are known and repeatable.

This is implemented in Arduino (C++) code.


This video shows how the different parts of this model move in relation to each other (no power is applied).


The controller's default behavior is to keep the satellite's angular position around 0° (the angle is was powered at).

It mostly manages to keep stability around its set point. There is however some drift in the gyro measurements which result in drift on the set point over the course of tens of seconds.


In the next video clip, instead of receiving a simple "stability around 0°" order the controller is instructed to:

  • When the red LED on the Arduino is lit, the target angle is 45° to the left (clockwise),
  • When the green LED on the Arduino is lit, the target angle is 0°.

The order changes every 2 seconds.

The clockwise "bouncy" behavior is the result of a too high derivative (D) coefficient of the PID controller, which was required to get good angular stability. This issue does not arise in the counter-clockwise direction (the direction of the flywheel).


This model shows really well the effect of reaction wheels. As captured in tests, it is fully able to stabilize and control its attitude. However, because the minimum speed of the A2212 motor is so high, the satellite is actually very unstable without the help of the controller. Indeed, because of the air movement the flywheel generates, it always wants to spin in the opposite direction. I plan to make a Mark2 of this project using a NEMA 17 stepper motor instead of the A2212, and try to get high stability and angular accuracy with a much lower flywheel RPM.

In the future, I also want to experiment with more attitude control systems with:

  • A model rocket with a gimbaled thruster. I already started experimenting with this through a physics engine simulator, see article here...
  • A model rocket with several cold gaz thrusters actuators powered by compressed air.

Author: Charles Grassin

What is on your mind?

  • #1 Sanasar

    Hello. Can I have some sample code?

    on July 11 2020, 7:39

  Back to projects

Related articles