Skip to content

About

2 Wheeled self balancing robot with transporter using ESP-32

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Balancer-robot

Controller

The controller used in this system is the ESP32‑DEVKIT V1. This board was chosen because it has specifications that are adequate for the needs of the application, with the following details:

Specification Detail
Processor Dual-core 32-bit Tensilica Xtensa LX6 (up to 240 MHz)
RAM 520 KB SRAM
Flash Memory ~4 MB
Pin Configuration 30 Pins

The selection of the ESP32-DEVKIT V1 is based on its capabilities and features that match the project requirements. This board has built-in Bluetooth that will be used for communication with the gamepad, as well as a dual-core processor that enables separation between the low-level control process and the gamepad control process. This architecture allows the system to run more stably and responsively.

Driver

The motor driver used in this system is the BTS7960, with a total of two units, each having the following technical specifications:

Specification Detail
Peak Current 43 A
PWM Capability 25 kHz
Input Voltage 6 – 27 VDC

The selection of the BTS7960 driver is based on its ability to handle high peak currents and its support for relatively high PWM frequencies, making it highly suitable for medium to high-power DC motor control applications.

This driver also provides smoother torque and speed control characteristics, along with a fast response to changes in control signals. In addition, the BTS7960 is equipped with internal protection features such as overcurrent protection and thermal shutdown, which improve operational safety, especially when the motor operates under varying load conditions.

With these advantages, the BTS7960 was chosen to ensure that the system achieves stable, responsive, and reliable actuation performance under various operating conditions.

Sensors

There are two types of sensors used as feedback in the balancing robot system:

1. MPU6050 (GY-521)

The MPU6050 (GY-521) is used as the main sensor to obtain the robot's tilt angle data.
This sensor is an IMU (Inertial Measurement Unit) module that combines a 3-axis accelerometer and a 3-axis gyroscope, allowing it to provide real-time orientation estimation.

The selection of the MPU6050 is based on several considerations:

  • Easy to obtain and widely available in the market.
  • Affordable price, making it suitable for research and prototyping applications.
  • Sufficient performance for balance control applications.

The angle data obtained from the MPU6050 is used as the primary input in the robot stabilization process to determine the tilt condition and the direction of correction that must be applied by the controller.

2. Encoder

Two encoders are installed on the right and left motors of the robot.
These encoders are used to obtain wheel rotational speed and robot linear velocity data.

The encoder used has the following specifications:

Specification Detail
Resolution 11 PPR (Pulses Per Revolution)
Operating Voltage 3.3V – 5V DC
Quantity 2 Units

The data obtained from the encoders is used to support the motion control of the robot and to provide additional feedback for the control system.

User Control

The user control system of the balancing robot utilizes a PS4 console controller (DualShock 4) as the primary input device. The controller functions to send commands such as throttle, steering, and grip to the robot in real-time.

The throttle command is used to control the forward and backward speed of the robot. The steering command is used to control the turning direction of the robot, while specific buttons are used as additional controls such as the grip function or other features depending on the system requirements.

The connection between the PS4 controller and the ESP32 is established through a Bluetooth network, allowing wireless communication between the user and the robot.

Software Design

1. Control Scheme

Control Block

In this control scheme, a cascade PID approach is used, where multiple PID loops are interconnected and operate sequentially to control the overall balancing robot system.

The Throttle PID functions to regulate the robot's translational speed based on the throttle value provided by the user.

Next, the Balancing PID is responsible for maintaining the robot's equilibrium by processing the tilt angle feedback obtained from the sensor.

The outputs from both the Throttle PID and Balancing PID serve as references for the Speed Control PID, which ensures that the rotational speed of each motor matches the desired values.

2. Program Block

Program Block

System Task Architecture

The system is divided into two main tasks that run on different processor cores of the ESP32 to ensure stable and efficient operation.

1. Low Level Control (Core 1)

This part functions as the main program responsible for controlling the robot’s fundamental movements.

Tasks executed in the low level control include:

  • Reading sensor feedback (IMU and encoder).
  • Performing PID control calculations for balancing, speed, and steering.
  • Generating motor PWM signals in real-time.
  • Continuously maintaining the robot's stability.

Since this part is time-critical, it is assigned to Core 1 to prevent interference from other processes.

2. Remote Control (Core 0)

This part handles the robot’s external communication, particularly user inputs.

The functions performed include:

  • Receiving throttle, steering, and mode commands from the PS4 controller.
  • Handling communication via Bluetooth.

Realization

Electronics Board

Electronics board assembled in 2 layer of matrix pcb top for main controler and bottom for driver, theese 2 PCB connected using pair of pin headers to create bus connection.

Electronics Board

Mechanical Parts

Most of mechanical parts is 3d printed using PLA fillament and acrylic cutted.

Mechanical Design

Real Result

Real Result

About

2 Wheeled self balancing robot with transporter using ESP-32

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages