🔗 DIY Self-Balancing Robot using Arduino
- Two-wheel self-balancing robot powered by Arduino UNO.
- Uses MPU6050 Gyroscope + Accelerometer for orientation sensing.
- Implements PID algorithm for real-time stability correction.
- Controlled via L298N motor driver with geared DC motors.
- Lightweight design powered by a 7.4V Li-ion battery.
- Fully 3D-printed chassis for durability and customization.
| Component | Quantity | Description |
|---|---|---|
| Arduino UNO | 1 | Main controller board |
| MPU6050 | 1 | 6-axis accelerometer + gyroscope sensor |
| L298N Motor Driver | 1 | Dual H-bridge motor driver |
| Geared DC Motors | 2 | Yellow 12V DC gear motors |
| Wheels | 2 | Matched to DC motors |
| 7.4V Li-ion Battery | 1 | Power source |
| 3D Printed Chassis | 1 | Custom robot frame |
| Connecting Wires | As req. | For circuit connections |
| Nuts & Bolts | As req. | For motor & board mounting |
- Orientation Detection: The MPU6050 continuously measures tilt (pitch and roll).
- Data Processing: Arduino reads sensor data via I²C and calculates the current angle.
- PID Control: The PID algorithm computes corrective motor actions based on tilt deviation.
- Motor Control: L298N motor driver receives PWM signals from Arduino to adjust motor direction and speed.
- Balancing Act:
- If robot leans forward → wheels move forward.
- If robot leans backward → wheels move backward.
- If balanced → motors stop.
| Component Pin | Arduino Pin |
|---|---|
| MPU6050 Vcc | 5V |
| MPU6050 GND | GND |
| MPU6050 SCL | A5 |
| MPU6050 SDA | A4 |
| MPU6050 INT | D2 |
| L298N IN1 | D6 |
| L298N IN2 | D9 |
| L298N IN3 | D10 |
| L298N IN4 | D11 |
| Issue | Possible Cause | Solution |
|---|---|---|
| Robot not balancing | Incorrect PID values | Re-tune Kp, Ki, Kd via Serial Monitor |
| Motors not running | Wrong motor driver wiring | Check IN1–IN4 connections |
| Robot works via USB but not battery | Power supply insufficient | Ensure 7.4V Li-ion can supply enough current |
| MPU6050 not detected | Loose I²C connections | Recheck SDA/SCL wiring |
| Robot keeps skidding | Poor wheel grip | Replace with better traction wheels |
- Educational project for understanding PID control systems.
- Foundation for self-balancing scooters & robots.
- Robotics competitions and academic demonstrations.
- Research prototype for control system experiments.
- Add Bluetooth/Wi-Fi module for remote control.
- Upgrade to stepper motors for smoother balance.
- Use better Li-Po batteries for longer runtime.
- Implement mobile app interface for PID tuning.
- Expand to ball-balancing robot version.
| Parameter | Value |
|---|---|
| Controller | Arduino UNO (ATmega328P) |
| Sensor | MPU6050 (6-axis Gyroscope + Accelerometer) |
| Motor Driver | L298N Dual H-Bridge |
| Motors | 12V DC Geared Motors |
| Power Supply | 7.4V Li-ion Battery |
| Algorithm | PID Control |
| Communication | I²C for MPU6050, PWM for motors |
- 📘 DIY Self-Balancing Robot using Arduino
- ⚡ Arduino IDE Download
- 📑 Arduino Wire (I²C) Library Reference
- 🔧 L298N Motor Driver with Arduino
- 🔧 Arduino MPU6050 Sensor Module
- 📂 Arduino PID Library
- 📂 MPU6050 Arduino Library
If you found this project useful, consider supporting CircuitDigest by exploring more tutorials and sharing this project with others.
💡 CircuitDigest – Open Source Electronics Projects & Tutorials for Makers, Engineers & Students.
Arduino UNO Self Balancing Robot MPU6050 L298N Motor Driver PID Algorithm Arduino Project Gyroscope Accelerometer Two-Wheel Robot

