Hello! Welcome to Embedic!
This website uses cookies. By using this site, you consent to the use of cookies. For more information, please take a look at our Privacy Policy.
Home > Embedded Events > RT-Thread and STM32F407 Arduino realize the robot drive control model algorithm

RT-Thread and STM32F407 Arduino realize the robot drive control model algorithm

Date: 12-01-2021 ClickCount: 874

In December last year, embedic wrote an article about STM32F407 Arduino Chip Interpretation. Many people left messages saying that they want to know more about STM32F407. Today, embedic will continue to discuss STM32F407 discovery with you.

Overview

The robot motion system is a non-linear system with high complexity, high coupling, and driving force less than the physical freedom of the body. In order to realize the stable motion attitude control of the robot in space, the STM32F407 board is designed to move the robot motion system in space. The form is equivalent to a rotating inverted pendulum model. Based on the movement characteristics of the model, a speed closed-loop control algorithm and an angle closed-loop control algorithm are designed respectively. The double closed-loop control algorithm is used to achieve stable control of the rotating inverted pendulum in space.

Development environment

Hardware: The design hardware is based on the ART-PI development platform. The main control chip adopts STM32F407 evaluation board high-performance single-chip microcomputer. At the same time, it adopts the TB6612 chip as the core power drive of the rotating inverted pendulum. It adopts Hall sensor as speed acquisition and high-precision potentiometer. As the swing arm angle acquisition sensor, an OLED screen is used for parameter display and real-time adjustment.

RT-Thread version: RT-Thread version adopts 4.0.2

Development tools and version: mdk5.32 version

To learn more about STM32F407, please click here.

Overview of RT-Thread usage

This design uses the rt-thread4.0.2master version, uses the full core of the operating system, FinSH console interaction, SPI driver, ADC driver, encoder driver, PWM driver and other related system drivers, and writes a double closed-loop PID control algorithm .

Software framework description

The hardware platform of this design is based on ART-PI, and the core part has been fixed. For the mechanical part of the rotating inverted pendulum, its structure is shown in the figure below:

STM32F407

Software module description

The most critical part of the STM32F407 i2c design is the realization of the PID algorithm, which is optimized and adjusted for the movement characteristics of the inverted pendulum. The realization of the PID algorithm is based on the theoretical basis of linear control in the classic control theory.

In engineering practice, the most widely used regulator control law is proportional, integral, and derivative control, referred to as PID control, also known as PID regulation [6]. The PID controller has a history of nearly 70 years since it came out. It has become one of the main technologies of industrial control because of its simple structure, good stability, reliable work and convenient adjustment. When the structure and parameters of the controlled object cannot be fully grasped, or an accurate mathematical model cannot be obtained, and other techniques of control theory are difficult to adopt, the structure and parameters of the system controller must be determined by experience and on-site debugging.

In integral control, the output of the STM32F407 development board controller is proportional to the integral of the input error signal. For an automatic control system, if there is a steady-state error after entering the steady state, it is said that the control system has a steady-state error or a system with a difference in short. In order to eliminate the steady-state error, an "integral term" must be introduced in the controller. The error of the integral term depends on the integration of time. As time increases, the integral term will increase. In this way, even if the error is small, the integral term will increase with the increase of time, which pushes the output of the controller to increase, so that the steady-state error is further reduced until it equals zero. Therefore, the proportional plus integral (PI) controller can make the system without steady-state error after entering the steady state. 

Differential (D) control

In the differential control, the output of the STM32F407 Micropython controller is proportional to the differential of the input error signal (that is, the rate of change of error). The automatic control system may oscillate or even lose stability during the adjustment process to overcome the error. The reason is that there are larger inertial components (links) or hysteresis components, which have the effect of suppressing errors, and their changes always lag behind the changes in errors. The solution is to make the change of the effect of suppressing the error "leading", that is, when the error is close to zero, the effect of suppressing the error should be zero.

That is to say, it is often not enough to introduce only the “proportional” term in the controller. The function of the proportional term is only to amplify the magnitude of the error. At present, the “differential term” needs to be added, which can predict the trend of error changes. In this way, the controller with proportional differentiation can make the control effect of suppressing error equal to zero or even negative in advance, thereby avoiding serious overshoot of the controlled quantity. Therefore, for the controlled object with greater inertia or lag, the proportional derivative (PD) controller can improve the dynamic characteristics of the system during the adjustment process.

Demo effect

STM32F407

conclusion

The main of the Arduino STM32F407 robot motion system is the underlying configuration of the chip, but it can be solved initially by comparing the manual introduction and simulation. Thanks to the perfect kernel management, debugging interaction, and driver design of the RT-Thread operating system, many detours are avoided in the design, and the development speed is accelerated. It is recommended that everyone try to use the system. STM32F407 arduino is really good.

  • ATMEGA328P-PU Microchip Core piece Arduino minimum system
  • Introduction to Arduino ATMEGA2560 Microchip Microcontroller

Hot Products

  • ADSP-21060LCBZ-133

    Manufacturer: Analog Devices

    IC DSP CONTROLLER 32BIT 225BGA

    Product Categories: 32bit DSP

    Lifecycle:

    RoHS:

  • DM355SCZCEA216

    Manufacturer: Texas Instruments

    IC DGTL MEDIA PROCESSOR 337NFBGA

    Product Categories: DSP

    Lifecycle:

    RoHS:

  • PIC16F1934-I/ML

    Manufacturer: Microchip

    IC MCU 8BIT 7KB FLASH 44QFN

    Product Categories: 8bit MCU

    Lifecycle:

    RoHS:

  • TMS320C6474FZUNA2

    Manufacturer: Texas Instruments

    IC DSP MILTICORE 561FCBGA

    Product Categories: DSP

    Lifecycle:

    RoHS:

Customer Comments

  • Looking forward to your comment

  • Comment

    Verification Code * 

Compare products

Compare Empty