Single axis self-balancing reaction wheel inverted pendulum.
This thing is inherently unstable and a common challenge in control theory.
The mechanical structure is built using only Lego parts.
Motor is also Lego. Angle sensor and electronics are not Lego.
00:27 inertial measurement unit
02:39 motor driver
04:08 PID controller
10:26 rise up sequence
10:57 the final result
13:06 change parts and parameters to see how they affect performance
18:32 specs (including python code)
Raspberry Pi Zero 2 W
OKYSTAR TB6612FNG motor driver
Elecrow SM9250MPU 9DOF IMU
Lego EV3 Medium Servo motor 
Lego PF Rechargeable Battery Box 
Lego Gear Rack 11 x 11 Curved