https://github.com/inhald/self_balancing_robot
Self-Balancing Robot using Multithreaded PID-Control.
https://github.com/inhald/self_balancing_robot
mbed-os multithreading pid-control self-balancing-robot
Last synced: 7 months ago
JSON representation
Self-Balancing Robot using Multithreaded PID-Control.
- Host: GitHub
- URL: https://github.com/inhald/self_balancing_robot
- Owner: inhald
- License: mit
- Created: 2024-09-27T02:59:28.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-10T22:12:48.000Z (8 months ago)
- Last Synced: 2025-06-06T01:26:25.752Z (7 months ago)
- Topics: mbed-os, multithreading, pid-control, self-balancing-robot
- Language: C++
- Homepage:
- Size: 2.59 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Self-Balancing Robot
A real-time self-balancing two-wheeled robot powered by an STM32 microcontroller. The robot actively corrects its tilt using feedback from inertial sensors and a cascaded PID controller, restoring its upright posture within milliseconds of disturbance.
## Hardware Overview
- **Microcontroller:** STM32 DISCO Board
- **Sensors:**
- On-board IMU (gyroscope + accelerometer)
- External ADXL345 accelerometer (for redundancy/testing)
- **Actuators:**
- Two DC motors (differential drive)
- **Motor Drivers:** H-Bridge motor driver (not shown in schematic)
## Control System
The robot uses a **cascaded PID controller** implemented in C++ with Mbed RTOS:
1. **Angle Estimation:**
Sensor fusion combines gyroscope and accelerometer data to compute pitch angle via complementary filtering.
2. **Inner Loop:**
A fast-acting PID controller adjusts motor torque to correct tilt angle in real time.
## Performance
- Stabilizes from ±15° tilt in < 100 ms
- Maintains balance on flat and mildly uneven surfaces
- Real-time operation under Mbed RTOS on bare-metal STM32