https://github.com/achyuth-2308/equibot-self-balancing-bot
This repository contains the code and schematics for my Self-Balancing Bot, built using Arduino IDE and powered by ESP32 Wroom, MPU6050 Sensor, motor drivers, & control algorithms. The bot uses PID control to maintain balance & respond to external disturbances. ⚙️ Tech Stack: Arduino IDE, C Programming Language, MPU6050 & L293D Motor Driver.
https://github.com/achyuth-2308/equibot-self-balancing-bot
2-wheeled-robot accelerometer arduino-ide cprogramming-language equibot esp32 internet-of-things inverted-pendulum motor-driver mpu6050 pid-control robotics self-balancing-robot
Last synced: 7 months ago
JSON representation
This repository contains the code and schematics for my Self-Balancing Bot, built using Arduino IDE and powered by ESP32 Wroom, MPU6050 Sensor, motor drivers, & control algorithms. The bot uses PID control to maintain balance & respond to external disturbances. ⚙️ Tech Stack: Arduino IDE, C Programming Language, MPU6050 & L293D Motor Driver.
- Host: GitHub
- URL: https://github.com/achyuth-2308/equibot-self-balancing-bot
- Owner: achyuth-2308
- License: mit
- Created: 2025-03-04T03:30:20.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-03-22T20:00:51.000Z (7 months ago)
- Last Synced: 2025-03-22T20:28:59.622Z (7 months ago)
- Topics: 2-wheeled-robot, accelerometer, arduino-ide, cprogramming-language, equibot, esp32, internet-of-things, inverted-pendulum, motor-driver, mpu6050, pid-control, robotics, self-balancing-robot
- Language: C
- Homepage:
- Size: 381 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# EquiBot: Self-Balancing-Bot 🤖ིྀ
A self-balancing bot using **ESP32**, **MPU6050**, **L293D Motor Driver** and a **PID controller** to maintain dynamic stability. This project implements an **inverted pendulum model** to keep the bot upright.
---
## 📌 Features
- **Real-time tilt correction** using MPU6050 sensor data.
- **PID control algorithm** for precise motor adjustments.
- **ESP32-based** implementation with efficient processing.
- **DC motor control** via motor driver for smooth balancing.
- **Expandable** for Bluetooth/WiFi remote control and advanced tuning.---
## 🛠 Components Used
| Component | Description |
|---------------|------------|
| **ESP32** | Microcontroller for processing Sensor Data |
| **MPU6050** | 6-axis Motion Sensor (Accelerometer + Gyroscope) |
| **Motor Driver** | Controls the direction and speed of motors |
| **DC Motors** | Provides motion and balance adjustments |
| **Battery** | Power source for ESP32, motors, and sensors |
| **Chassis & Wheels** | Physical structure of the bot |---
## ⚙️ Circuit Connections
### **MPU6050 to ESP32:**
- **VCC** → 3.3V (ESP32)
- **GND** → GND (ESP32)
- **SDA** → GPIO21 (ESP32)
- **SCL** → GPIO22 (ESP32)### **Motor Driver to ESP32:**
- **IN1, IN2** → GPIO26, GPIO27 (ESP32)
- **IN3, IN4** → GPIO14, GPIO12 (ESP32)
- **Enable Pins (PWM)** → GPIO33, GPIO32 (ESP32)---
## 🔢 PID Control Implementation
The **PID (Proportional-Integral-Derivative) controller** ensures smooth and stable balancing by adjusting motor speed based on tilt error.
```cpp
float Kp = 35.0, Ki = 0.1, Kd = 1.0;
float error, previousError, integral, derivative;void loop() {
int16_t ax, ay, az, gx, gy, gz;
mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
float angle = atan2(ax, az) * 180 / PI;
error = angle;
integral += error;
derivative = error - previousError;
int motorSpeed = Kp * error + Ki * integral + Kd * derivative;
controlMotors(motorSpeed);
previousError = error;
delay(10);
}
```---
## 🛠 Setup & Installation
1. Clone the repository:
```sh
git clone https://github.com/achyuth-2308/EquiBot-Self-Balancing-Bot.git
```
2. Open the code in **Arduino IDE** or **PlatformIO**.
3. Install the required libraries:
- `Wire.h`
- `MPU6050.h`
4. Upload the code to ESP32 and power up the bot!---
## 🚀 Future Enhancements
- Implementing a **Kalman Filter** for improved sensor fusion.
- Adding **Bluetooth control** for remote tuning.
- Integrating an **OLED display** for real-time sensor data.---
## 🤝 Contributions
Feel free to fork, enhance, and create pull requests! Contributions are always welcome.---
## 📝 License
This project is **open-source** under the MIT License.---
### 📧 Contact
For any queries, reach out to me on **[LinkedIn](https://www.linkedin.com/in/achyuth-mukund)** or via email at **achyuth2004@gmail.com**.