Design of gymnastics robot system based on STC89C52 single chip microcomputer

Publisher:清新生活Latest update time:2012-12-12 Source: 21IC Keywords:STC89C52 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction
Robots designed and manufactured to imitate human form and behavior can be called humanoid robots. They generally have limbs and heads similar to humans separately or simultaneously. The research on humanoid robots integrates multiple sciences such as mechanics, electronics, computers, materials, sensors, and control technology, representing the high-tech development level of a country. Therefore, developed countries in the world have invested heavily in research and development. Gymnastics robots have obvious humanoid characteristics, with two arms and two legs that can operate independently, of which the arm part has no less than 3 degrees of freedom and the leg part has no less than 2 degrees of freedom. It can realize more complex gymnastics movements such as double-handed push-ups, handstand splits, left and right single-handed push-ups, left and right side rolls 360°, front and back rolls 360°, etc., which is the basis for studying humanoid robot technology.

2 Control circuit design of gymnastics robot
The control part of the gymnastics robot designed in this paper mainly uses the STC89C52RC microcontroller system as the control core. This type of microcontroller is a new generation of super anti-interference/high-speed/low-power microcontroller launched by Hongjing Technology. The instruction code is fully compatible with the traditional 8051 microcontroller. Its performance is as follows:
① 12 clocks/machine cycle and 6 clocks/machine cycle can be selected at will.
② Operating frequency range: 0-40MHz, the actual operating frequency can reach 48MHz.
③ Operating voltage: 5V-3.4V (5V microcontroller)/3.8-2.0V (3V microcontroller).
④ 1280 bytes/512 bytes RAM integrated on the chip.
⑤ General I/O port (32/36). P0 port is an open-drain output. When used as a bus extension, no pull-up resistor is required. When used as an I/O port, a pull-up resistor is required.
⑥ ISP (In-System Programmable)/IAP (In-Application Programmable), no special programmer/emulator is required, user programs can be directly downloaded through the serial port (P3.0/P3.1).
⑦ Operating temperature: 0-75℃/-40-+85℃. ⑧ Package: PDIP-40, PLCC-44, PQFP-44.
The PCB board design of the gymnastics robot control system is shown in Figure 1:

The joint drive motor of this gymnastic robot uses Huisheng MG996 universal servo. MG996 servo is Huisheng's latest high-torque standard metal gear servo. The speed, tension and accuracy have been improved accordingly, and it is one of the most cost-effective high-torque universal servos on the market. Its performance is as follows:
① Product net weight: 55g.
② Product size: 40.7×19.7×42.9mm.
③ Product tension: 10.5kg/cm(4.8V), 13kg/cm(6V).
④ Response speed: 0.20sec/60degree(4.8v), 0.17sec/60degree(6.0v).
⑤ Working voltage: 4.8-7.2V.
⑥ Working temperature: 0℃-55℃.
The driving mode of the MG996 servo is also PWM. Therefore, considering the use condition of maximum output torque when the driving voltage is 6V, a driving voltage amplifier circuit using a TLP521 photocoupler is designed. The circuit is shown in Figure 2:

[page]

3 Mechanical structure design of gymnastics robot
The mechanical structure design of gymnastics robot mainly considers the feasibility of the robot to complete various gymnastic movements, such as: completing double-handed push-ups, single-handed push-ups, side rolls, forward rolls, etc. Since this robot does not walk, no more degrees of freedom are added to the design of the legs. In the structural design of this gymnastics robot, Siemens' UG structural model design software is used to design all the structural parts of the robot. As shown in Figure 3:

The actual picture of the humanoid robot after it is made is shown in Figure 4:

4 Control Program Design of Humanoid Robot
4.1 Pulse Width Difference Control Algorithm
The basic method of multi-channel servo control is to sequentially output pulses to different servos, and use the high processing speed of the single-chip microcomputer to achieve multi-channel control. However, this type of control algorithm has a limit on the number of controlled servos, because the typical period of the PWM wave required to control the servo is 20ms, and the maximum positive pulse width required for each servo is 2.5ms, so at most only 8 servos can be controlled. There are 10 servos that need to be controlled in this system, so an improved control algorithm, the pulse width difference method, is selected.
The pulse width difference method control is divided into the following steps:
(1) Group sorting. Divide the multi-channel servo control data into a group of 8 channels, and sort each group of data (control pulse length) in order from small to large.
(2) Calculate the difference. Calculate the difference of the servo control data and save it. Calculate the difference between two adjacent data in each group (the difference between the larger number and the smaller number) and save it in the difference array. The difference array has 8 storage units. The first unit stores the minimum value of the control data of the servo group, and the difference of the servo control data is stored from the second unit.
(3) Data conversion. The data in the difference array is converted into the timing time (i.e., the control pulse width difference), and then further converted into the timing initial value and saved in the pulse width difference array.
(4) Servo control. When controlling a group of servos, first set a high level to all servos in the group (start the servos), and then assign the first data in the pulse width difference array to the timing register. When the timing interrupt occurs, first turn off the servo corresponding to the first data in the pulse width difference array, and then fill the second data in the pulse width difference array into the timing register. And so on, the control of all servos in the group can be completed. In a control cycle (20ms), the timer output pulse is used to control each group of servos in turn. After the control of the third group of servos is completed, the timing continues to use a low level to make up the remaining time to complete 20ms. The principle of the pulse width difference method is shown in Figure 5.

4.2 Program implementation of pulse width difference method
The implementation method introduced here is written in C language based on STC89C52 single chip microcomputer. [page]
Method 1: Use a timer plus software delay to implement.
Use a timer to time the 20ms servo cycle. The positive pulse width of 0.5ms to 2.5ms required by each servo is not implemented by a timer, but by a delay program. Define an unsigned integer for each servo to represent the different turning angles of the servo. Each time a 20ms interrupt is entered, all ports are set to "1" first, and then count is started. When the count value is equal to the given value of the servo, the corresponding port output is set to "0". In this way, changing the given value can change the duty cycle of the PWM wave, thereby controlling the rotation of the servo. This method only uses one timer, saves resources, and uses integers to replace the different turning angles of the servo, which is convenient for program writing.
void timer0() interrupt 1 using 1 //20ms to an interrupt, timer interrupt T0
{
TH0=0x70;
TL0=0x00;
P0=0xFF;
P1=0xFF;
PWM();
}
void PWM()
{
uint counter = 0;
while(counter < 130)
{
if(counter == num[0])
P10 = 0;
if(counter == num[1])
P11 = 0;
......
if(counter == num[9])
P07 = 0;
counter++;
}
}
Method 2: Use two timers to implement.
The advantage of the previous method is that the program is simple and takes up less resources. However, the software delay time is related to the crystal oscillator frequency of the microcontroller and the number of statements in the loop program, that is, the steering angle represented by the same value is not certain. The second method uses a timer with a 20ms period and another timer with a 100us period (which can be changed) to replace the loop timing program. This enhances the versatility of the program.
void timer1()interrupt3 using 2
{
static count;
count = count%25;
Count++;
if(count == num[0])
P00 = 0;
......
if(counter == num[9])
P07 = 0;
}
The servo control program adopts a modular design approach to enhance the readability and portability of the program. The program flow chart is shown in Figure 6.

5 Conclusion
In the design of the gymnastics robot system in this paper, the STC89C52 single-chip microcomputer system is used. This small system has the characteristics of strong versatility, low price and stable operation. By writing an improved pulse width difference control program, 10 servos can be controlled. In the 2011 China Robot Competition and Robocup Open held in Lanzhou, this type of robot performed stably and won the first prize in the national gymnastics robot group.
References:
[1] Wang Zhiliang, Competition Robot Manufacturing Technology [M]. Beijing: Machinery Industry Press, 2007.5.
[2] Wang Liquan, Robot Innovation Design and Manufacturing [M]. Beijing: Tsinghua University Press, 2007.6.
[3] Zhang Tao, Introduction to Robotics [M]. Beijing: Machinery Industry Press, 2010.4
[4] Xiong Youlun, Basics of Robot Technology [M]. Wuhan: Huazhong University of Science and Technology Press, 1996.8.
[5] Liu Guangrui, Robot Innovation Manufacturing [M]. Xi'an: Northwestern Polytechnical University Press, 2007.2.

Keywords:STC89C52 Reference address:Design of gymnastics robot system based on STC89C52 single chip microcomputer

Previous article:Design of a Simple Greenhouse Control System
Next article:Research on farmland water-saving irrigation system based on Internet of Things technology

Recommended ReadingLatest update time:2024-11-16 17:38

STC89C52RC MCU Extra Chapter | 01 - Understanding interrupts, interrupt sources and interrupt priorities
1 Concept of Interruption Interrupts are set up to enable the microcontroller to process random external or internal events in real time. Imagine yourself as the CPU of a single-chip computer. You are playing King of Glory, but suddenly the courier calls you and asks you to pick up the package (you are very upset to
[Microcontroller]
STC89C52RC MCU Extra Chapter | 01 - Understanding interrupts, interrupt sources and interrupt priorities
How to design a thermostatic box temperature control system based on STC89C52 microcontroller
1. System design This system is based on the application development of the classic C51 series microcontroller. It is a digital control system that integrates ambient temperature signal acquisition, data processing, temperature maintenance control, etc. At the same time, the system is designed with a friendly human-co
[Microcontroller]
How to design a thermostatic box temperature control system based on STC89C52 microcontroller
Design of temperature control system using STC89C52 single chip microcomputer
    This paper gives a design method of using STC89C52 single-chip microcomputer for adaptive control to control PWM wave, and then control the heating of the electric furnace to achieve temperature control. This temperature measurement and control system makes up for the performance degradation of the traditional PID
[Microcontroller]
Design of temperature control system using STC89C52 single chip microcomputer
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号