LQR Self-Balancing Two-Wheel Robot
A two-wheeled self-balancing robot controlled by an LQR algorithm on an STM32F103C8T6, with a custom-drawn control board and mechanical structure.
- Wheeled
- No license: all rights reserved by the creator
Suggested by Robotheca, created by @Hawking-z (opens in a new tab), from github.com/Hawking-z/LQR_phc (opens in a new tab). Pinned to commit e433946 (opens in a new tab).
- Hardware license
- No license
- Software license
- No license
- Commercial use
- Unknown
No license is stated for part of this robot.
The creator chose the hardware and software licenses on Robotheca; the repository has no license file for them yet.
Some folders have their own license: MyPHC_F103C8T6/Drivers/CMSIS/ (Apache-2.0), MyPHC_F103C8T6/Drivers/STM32F1xx_HAL_Driver/ (BSD-3-Clause).
Photo
- Power
- 12 V
What it can do
Written by Robotheca from the project's documents.
- Balances upright as a two-wheeled self-balancing car using an LQR state-feedback controller
- Controlled by a phone over Bluetooth to move and steer
- Holds balance in place but tends to sway slightly due to gearbox backlash
- Gyroscope and encoder feedback are used to keep balance and control steering
Bill of materials
This repository has no parts list Robotheca can read yet.
Build guide
The creator's steps, each with its instructions.
- 1Model and assemble the mechanical structure (SolidWorks files) to mount the boar
- 2Fabricate and solder the custom driver PCB (Altium Designer files)
- 3Connect MPU6050 gyroscope, motor encoders, HC-08 Bluetooth and OLED display
- 4Compute the feedback matrix with MATLAB lqr() from the linearized inverted pendu
- 5Flash the MyPHC_F103C8T6 code and tune Q and R for balance and steering control
The creator's guide is written in Chinese. It has no license, so all rights stay with the creator: Robotheca doesn't show it here or translate it, and gives its own notes about the robot instead.
Read the creator's guideAsk the creator on GitHub (opens in a new tab)Wiring and electronics
Notes written by Robotheca from the project's documents.
Main parts
- STM32F103C8T6 microcontroller as the main controller
- Custom-designed motor driver and voltage conversion board
- MG513P3012V DC gear motors with optical quadrature encoders
- MPU6050 gyroscope/accelerometer module
- HC-08 Bluetooth module
- 0.96-inch OLED display
- 12V 2800mAh lithium battery
Connections
- Bluetooth module TX and RX pins are not matched to the board, so they must be connected with jumper wires crossing RX and TX
- The main board integrates the voltage converter, motor driver, MCU and peripheral connectors
- Motor encoders and the MPU6050 feed back to the microcontroller