yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
520 Motor📖
1.About motor
  • About motor
2.ROS robot control board drive
  • 2.1 Control motor
  • 2.2 Timer captures encoder data
  • 2.3 PID control robot car
  • 2.4 Kinematic Analysis-Mecanum wheel structure
  • 2.5 Kinematic Analysis-Ackerman structure
  • 2.6 Kinematic Analysis-4WD structure
3.STM32 Self-balancing car tutorials
Get started quickly
  • 03.P, PI, PD controller theory
  • 01.Balancing car assembly
  • 02.Get started quicklyy
  • 03.Balance car interface description
  • 04.Common Problem Analysis
  • 05.Balance Car V2 Library Function Development Manual
Environment construction and development
  • 01.MDK-ARM installation
  • 02.STM32CubeIDE installation
  • 03.Common driver installation
  • 04.Download the program
  • 05.MDK-ARM project usage
  • 06.Program simulation
Robot car PID control course
  • 01.PID basic concept
  • 02.PID example analysis
  • 04.Position PID
  • 05.Incremental PID
  • 06.Cascade PID
  • 07.Balance principle of car
  • 08.Car upright control (PD)
  • 09.Car speed ​​control (PI)
  • 10.Car steering control (PD)
  • 11.Got angle and angular velocity (DMP algorithm)
  • 12.Got angle and angular velocity (Kalman filter algorithm)
  • 13.Got angle and angular velocity(Complementary filter algorithm)
Robot car basic course
  • 01.Car parameter adjustment
  • 02.Ultrasonic obstacle avoidance
  • 03.Ultrasonic follow
  • 04.Bluetooth remote control
  • 05.Load balance
Robot car LQR control
  • Robot car LQR control
Circuit design
  • 01.Overall circuit design
  • 02.STM32 minimum system
  • 03.Serial port circuit design
  • 04.Power circuit design
  • 05.MPU6050 Circuit Design
  • 06.Motor drive circuit design
Mathematical model
  • Balance car mathematical model
4.4-channel motor drive module
Introduction and Debug
  • 1.Introduction to 4-channel motor drive board
  • 2.Control command
  • 3.Motor introduction and usage
  • 4.PC host
IIC communication
  • For Arduino
  • For ESP32
  • For Jetson NANO
  • For MSPM0G3507
  • For MSPM0G3519new
  • For PICO2
  • For RDK X5
  • For RPi5
  • For STM32
USART communication
  • For Arduino
  • For ESP32
  • For Jetson NANO
  • For MSPM0G3507
  • For MSPM0G3519new
  • For PICO2
  • For RDK X5
  • For RPi5
  • For STM32
5.2-channel motor drive module
For MSPM0G3507
  • 1.AT8236 drive tutorials
  • 2.TB6612 drive tutorials
For MSPM0G3519
  • 1.AT8236 drive tutorialsnew
  • 2.TB6612 drive tutorialsnew
Download
  • Model File
  • Annex_ROS_robot_board
  • Annex_STM32_balancing_car
  • Annex_4channel_motor_drive
  • Annex_2channel_motor_drive
Download ZIP

Welcome to 520 Motor repository

Balance car mathematical model

Balance car mathematical model

Balance car mathematical modelClassic inverted pendulum mathematical modelBalance car mathematical modelWheel modelCar body modelForward motionSteering movement

 

Classic inverted pendulum mathematical model

The inverted pendulum system usually consists of a rotatable rod and a mass block, the mass block is located at one end of the rod, and the entire system is controlled by a motor or other driver.

xxxxxxxxxx
The goal of controlling the inverted pendulum system is to keep the mass block in a vertical position and be robust to external interference

Figure (a) is a simplified model diagram of the inverted pendulum system, and Figure (b) is a force analysis diagram of the inverted pendulum system

image-20240921145253686

Instructions

image-20240921145404245

Based on Newton's mechanics and theorem of motion, the process of deriving the dynamic equation of the linear inverted pendulum system is as follows: Analyze the force balance of the car in the horizontal direction

image-20240921145531686

Analyze the force balance of the pendulum in the horizontal direction, and we can get:

image-20240921145514168

(1) and (2) In the equations, N is the interaction force between the slider and the pendulum in the horizontal direction. Combining the two equations (1) and (2) eliminates N, we get the first nonlinear dynamics model equation of the first-order linear inverted pendulum:

image-20240921145611963

Analyzing the force balance of the pendulum in the vertical direction, we get:

image-20240921145635811

Analyzing the moment balance of the pendulum around its center of mass, we get:

image-20240921145656266

In equations (2), (4), and (5), N and P are the interaction forces between the slider and the pendulum in the horizontal and vertical directions. Combining equations (2), (4), and (5) eliminates P, N, we get the second nonlinear dynamic model equation of the first-order linear inverted pendulum:

image-20240921145751308

The inverted pendulum is stable when -0.3rad < Φ <0.3rad, and the swing angle Φ is very small, so:

image-20240921145818901

Therefore, the nonlinear dynamic equation (3) of the inverted pendulum system can be Linearize with (6) to obtain the linearized dynamic equation of the first-order linear inverted pendulum system:

image-20240921145850123

Remember the state vector:

image-20240921145927483

With u=F, according to equation group (7) The state space equation of the first-order linear inverted pendulum system is as follows:

image-20240921150027126

image-20240921150045738

Balance car mathematical model

The balance car is a small car that achieves self-balancing through two wheels. Its structure mainly consists of a car body and two wheels. The mathematical model can be regarded as a moving inverted pendulum.

xxxxxxxxxx
The MPU6050 detects its posture information, and after processing by the processor, it will control the robot's motor so that the robot can reach a stable state.

Wheel model

The force analysis diagram of the left and right wheels of the two-wheeled robot is shown in the figure. The horizontal force of the robot is the vector sum of the friction between the wheel and the ground and the horizontal force between the body and the wheel.

The movement of the balancing car is achieved by the rotation of the wheels. We choose a pair of coaxially installed wheels with the same parameters (mass, moment of inertia, radius).

Take the right wheel as an example for force analysis:

image-20240921141154399

The movement of the wheel can be decomposed into translation and rotation, and Newton's second law can be obtained:

image-20240825221517308

From the law of rigid body fixed axis rotation, it can be obtained:

image-20240825221535659

Explanation

image-20240825222110723

Combining (1) and (2), we get:

image-20240825222213573

When the wheel does not slip, the speed of the wheel is proportional to the speed of rotation, that is,

image-20240825222 238194

Combining (3) and (4), we get:

image-20240825222316354

Since the parameters of the left and right wheels are the same, the left wheel has a similar result, that is,

image-20240825222335244

Car body model

The movement of the car body can also be decomposed into forward movement (forward, pitch) and lateral movement (steering, yaw): yaw movement can be regarded as a special case of steering movement.

Forward motion

The forward motion of the car can be decomposed into forward motion and relative rotation (pitch) around the center of mass P of the car body:

image-20240921141426563

The horizontal displacement of the center O of the chassis of the car is:

image-20240825223350923

Add equations (5) and (6) together, and divide both sides of the equation by 2 to get:

image-20240825223450159

Apply Newton's second law to the car body, in the horizontal direction:

image-2024082 5223602940

Apply Newton's second law to the car body, in the vertical direction:

image-20240825223612137

Apply the law of rigid body fixed axis rotation to the car body and we get:

image-20240825223638158

Explanation

image-20240825223707991

The combined equations (9) and (10) yield:

image-20240825223846078

Among them:

image-20240825224005898

The equation contains nonlinear terms, so it is linearized. Considering that the inclination angle of the vehicle body is relatively small, it can be considered that:

image-20240825224317215

Therefore, equation (13):

image-20240825224343500

Substitute equations (10) and (11) into equation (12):

image-20240825224431803

Linearize equation (15):

image-20240825224509442

Substitute equation (16) into equation (14):

image- 20240825224544717

image-20240825224614937

In summary, for forward motion:

image-20240825224702844

Steering movement

image-20240921141547236

The steering movement is caused by the unequal magnitudes of the reaction forces HL and HR applied to the vehicle body by the left and right wheels in the horizontal direction. According to the law of rigid body fixed axis rotation, we can get:

image-20240825225038872

Explanation

image-20240825225058285

Subtract equations (5) and (6) to get:

image-20240825225134542

When the left and right wheels have different speeds, the vehicle body turns:

image-20240825225213278

According to the geometric relationship, we can get:

image-20240825225525566

From equations (19) and (25), we can get the state equation of the system:

image-20240825225632177

The state variables represent the displacement, forward speed, inclination angle, angular velocity, steering angle and steering speed of the car.

Since the magnitude of the motor output torque is difficult to control directly, it is converted into the acceleration of the two wheels through the law of rigid body fixed axis rotation:

image-20240825225719369

The left side of equation (27) is the magnitude of the linear velocity of the left/right wheel when there is no friction (in rad/s).

Therefore, the state space expression of the system becomes:

image-20240825230023208

Motor drive circuit design
Introduction to 4-channel motor drive board

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文