About the project
# Two-Wheel Self-Balancing Robot with Real-Time PID Stabilization
## What I Built
A two-wheeled self-balancing robot built using an Arduino Uno, MPU6050 IMU, and L298N motor driver.
The robot stabilizes itself in real time using a PID controller and continuously corrects its tilt angle through motor speed adjustment.
This project explores embedded systems, control theory, sensor feedback, and real-time motor control.
---
## Components Used
* Arduino Uno
* MPU6050 IMU
* L298N Motor Driver
* DC geared motors
* Li-ion batteries
---
## Control System
The robot behaves similarly to an inverted pendulum system where balance must be continuously maintained through feedback correction.
The PID controller computes:
```text
error = setpoint - angle
```
and generates a correction output using:
```text
U = Kp·e + Ki·∑e + Kd·(de/dt)
```
The output determines motor direction and PWM speed.
---
## PID Values
```cpp
kp = 30;
ki = 0;
kd = 6;
```
---
## Challenges Faced
* PID tuning instability
* Motor response inconsistencies
* Sensor noise and drift
* One-sided balancing behavior
* Calibration issues