Skip to content

PID Self-Balancing Car

A self-balancing robot car that uses PID control and features ultrasonic obstacle avoidance, ultrasonic following, and Bluetooth remote control.

  • Wheeled
  • No license: all rights reserved by the creator
  • 3D printable

Suggested by Robotheca, created by @KeyL-SJ (opens in a new tab), from github.com/KeyL-SJ/BalanceCar (opens in a new tab). Pinned to commit 39c854d (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.

Photo

This repository has no photo of the robot yet.
Power
12 V

What it can do

Written by Robotheca from the project's documents.

  • Balances upright on two wheels
  • Moves forward and backward by tilting
  • Stops when picked up or tilted too far
  • Supports ultrasonic follow and obstacle avoidance modes
  • Shows status on an OLED display
  • Uses dual-loop PID control (balance and speed)
  • Detects low battery voltage

Bill of materials

This repository has no parts list Robotheca can read yet.

Build guide

The creator's steps, each with its instructions.

  1. 1Assemble the chassis and motors
  2. 2Install the control board and sensors
  3. 3Connect and solder electronic components
  4. 4Upload the firmware to the STM32
  5. 5Calibrate the PID parameters
  6. 6Test balancing, obstacle avoidance, and remote control functions

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
  • MPU6050 IMU (accelerometer and gyroscope)
  • TB6612 motor driver
  • Two DC motors with encoders
  • 12 V to 5 V buck converter module
  • 0.96-inch OLED display
  • Ultrasonic sensor
  • 12 V 1900 mAh lithium battery

Connections

  • STM32 I2C pins emulate I2C to read MPU6050 data
  • MPU6050 INT pin wired to STM32 external interrupt pin for 5 ms control loop timing
  • TB6612 motor driver connected to STM32 GPIO and PWM outputs
  • Encoders wired to STM32 TIM2 and TIM4 timer inputs
  • OLED connected via GPIO pins
  • Ultrasonic sensor connected to STM32 GPIO
  • Buck converter provides 5 V from 12 V battery to electronics