
Photo
LQR Self-Balancing Two-Wheel Robot
Wheeled
A two-wheeled self-balancing robot controlled by an LQR algorithm on an STM32F103C8T6, with a custom-drawn control board and mechanical structure.
Before you build
- Tools
- soldering iron
- Level
- Intermediate
- Licence
- No license, hardware and softwareCommercial use: Unknown
Not stated in the creator's files: total cost, shop links, time.
Read from the repository at commit e433946. Something out of date? Tell us
Project information
- Buildability
- 38/100Incomplete documentation
- Parts
- Not listed
- Sensors
- IMU
- Power
- 12 V
No license: all rights reserved by the creator.
No license is stated for part of this robot.
Some folders have their own license: MyPHC_F103C8T6/Drivers/CMSIS/ (Apache-2.0), MyPHC_F103C8T6/Drivers/STM32F1xx_HAL_Driver/ (BSD-3-Clause).
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). You buy the parts yourself; Robotheca doesn't sell robots. Last checked on GitHub on 2 December 2026; its last change there was on 8 September 2022.
Build it
- Model and assemble the SolidWorks frame holding the board and motors
- Fabricate and solder the custom driver PCB (Altium Designer files)
- Connect MPU6050 gyroscope, motor encoders, HC-08 Bluetooth and OLED display
- Compute the feedback matrix with MATLAB lqr() from the pendulum model
- Flash 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)What to buy
This repository has no parts list Robotheca can read yet.
Why it scores 38
38/100
Incomplete documentation
How complete the published files are for rebuilding this robot, measured by Robotheca at commit e433946. It isn't a rating of the robot. Counted out of 80 points and scaled to 100: the parts that don't apply to this robot are left out.
- 13D and CAD files6 CAD source files.Add the parts to print (STL or 3MF files).10/20
- 2Parts listNo parts list in the repository or linked.Most points to gain: Link to your parts list, or add it to the repository (a CSV or a Markdown table) with quantities, prices and where to buy each part.0/20
- 3SoftwareCode in this repository, instructions to install or run it.Say which software framework it uses (ROS 2, LeRobot, Arduino…).10/15
- 4DocumentationREADME of 999 characters with 7 pictures; 5 build steps.Write a README of at least 1,500 characters: what the robot does and how to build it.10/15
- 5LicensesHardware: no license; software: no license.Add a license for the hardware (e.g. CERN-OHL-S-2.0 or CC-BY-SA-4.0). Add a license for the software (e.g. MIT or Apache-2.0).0/10
Not counted
- –Robot descriptionNo URDF. Not counted: the score is made of the parts that apply.Optional: add a URDF, and the robot can be seen in 3D and tried in the browser.Not counted
- –SimulationNo simulation files. Not counted: the score is made of the parts that apply.Optional: add a simulation model (MuJoCo, Gazebo, Webots or Isaac).Not counted
Wiring and electronics
Main parts: Robotheca's summary
- 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: Robotheca's summary
- 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
Schematics, boards and diagrams
What it can do: Robotheca's summary
- 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
Software
- Framework
- Not stated
- Languages
- C, Assembly, MATLAB / Objective-C
- License
- NONE
Robotheca doesn't review code. Read it before running it.
How to run it: Robotheca's summary
Written by Robotheca from the project's documents, not by its creator.
- 1Open the MyPHC_F103C8T6 project containing the C and assembly source code
- 2Compute the state-feedback gain matrix with the LQR function in the matlab_source MATLAB script, tuning the Q and R matrices
- 3Enter the resulting feedback gains into the firmware
- 4Build the project and flash it onto the STM32F103C8T6 board
Software that runs on this robot
No software from Robotheca's catalogue found in this robot's files yet. Links come from its robotheca.yaml, its dependency files read as text, or Robotheca's editors.
The code
Free files
Every file of the project, at commit e433946.
Community
- Issues on GitHub (opens in a new tab)
- Pull requests on GitHub (opens in a new tab)
- Are you the creator? Manage this robot
- Report outdated info
- Report this robot
Questions and improvements go to the creator's repository.
Add a badge to your README
For the creator: two badges that link back here. The second always shows this page's current label and score.
Markdown (one click selects it)
[](https://robotheca.org/robots/lqr-self-balancing-two-wheel-robot) [](https://robotheca.org/robots/lqr-self-balancing-two-wheel-robot)
Licence and credits
Robot ID
RobothecaLQR 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.
- Type
- Wheeled
- Level
- Intermediate
Licence: NONE, hardware and softwareCommercial use: Unknown
Buildability: 38/100, Incomplete documentation
Licences read from the files at commit e433946
- Licenses
- No license, hardware and software
- Commercial use
- Unknown
- Made by
@Hawking-z (opens in a new tab), in github.com/Hawking-z/LQR_phc (opens in a new tab) at commit e433946
Other wheeled robots
All 95 wheeled robots- Ready to build

- Ready to build

Open source · free files
JPL Open Source Rover
Wheeled · Intermediate
- Score
- Buildability 94 out of 100
- Cost
- $1,600≈ €1,467
- Ready to build

- Ready to build

Open source · free files
Sawppy the Rover
Wheeled · Intermediate
- Score
- Buildability 94 out of 100
- Cost
- $500≈ €458
- Ready to build

Open source · free files
Agrofelis Agricultural Robot
Wheeled · Advanced
- Score
- Buildability 88 out of 100
- Cost
- €3,729.58
≈ € values are approximate, converted at the ECB euro reference rate of 1 Dec 2026. The creator's original price always comes first.