Inspiration

The Cubli Project by ETH Zurich link

What it does

Our implementation only seeks to balance on one of the edges.

How we built it

Hardware

Frame is laser-cut and joined by standoff fasteners. Reaction wheel is also laser-cut, with screws attached for larger weight. A geared DC motor rotates the reaction wheel. DC motor driven through L298N motor driver. MPU 6050 is mounted onto the frame with screws.

Software

The program runs on an Arduino Uno and is written entirely in bare metal C. The Uno communicates with the MPU 6050 sensor via I2C. After a reading is made, a PWM duty cycle is computed via a PID controller. PWM signal is then sent to the L298N to drive the motor. The torque generated by the reaction wheel keeps the cube balanced.

Challenges we ran into

Driving BLDC Motor

Initially we planned using a Brushless DC motor for its superior power and speed. However it cannot be driven without a specialized driver board and library. The requirements of the project stipulated bare metal C. A change had to be made to use a readily available DC motor at hand.

PID Tuning

Significant efforts were put into tuning and optimizing the PID parameters. Self-induced oscillations were very prominent with certain values

Sensor

MPU 6050 provides angular velocity and linear acceleration readings in all three axes. Tilt angle measured via acceleration is incredibly noisy. Angle measured via angular velocity is prone to drift. We attempted to implement a complementary filter to fuse the two measurements to give better readings but were unsuccessful. An alternative moving-average filter was implemented instead.

Control

The ETH Zurich Cubli was controlled with LQR running on a higher-level microcontroller, as well as much better BLDC motors and Lipo batteries. Due to the project requirements, an LQR controller is very hard to implement using C alone.

Accomplishments that we're proud of

Partial stability can be achieved for a short period.

What we learned

Drive DC motor with PWM signal; Estimate DC motor rotation speed with encoder and external interrupts; Control DC motor speed with PID to reach desired speed; Print measurement data to computer via UART communication; Read MPU 6050 data via I2C communication; Calculate PWM duty cycle from sensor reading to keep the cube balanced; Sensor filtering for noise reduction.

What's next for Self Balancing Cube

Better system integration and potentially the use of BLDC motor.

Built With

  • atmelstudio
  • c
  • dcmotor
  • i2c
  • l298n
  • laser-cutting
  • mpu6050
  • onshape
  • pid
Share this project:

Updates