The bionic robot fish experimental platform is a "National Undergraduate Innovative Experimental Program" project jointly funded by the Ministry of Education and Beijing University of Posts and Telecommunications. It is an experimental platform integrating light, machinery, electricity, fluid and intelligence. The research content includes: research on the mechanical structure of bionic robot fish, research on recommended efficiency and research on control performance.
1 Introduction to the bionic robot fish platform:
The designed and manufactured robot fish imitates the appearance of the croaker fish, and the head is made of rigid plastic material. Its shape is streamlined, imitating the shape and size ratio of the head of a real fish. The power supply and control circuit are installed in the internal space of the fish head, and 3 infrared sensors are installed at the fish eyes on both sides of the fish head and on the lower side of the front of the head, forming a sensor network that detects the left, front and right directions, so that the fish has the function of self-help obstacle avoidance. The
fish skeleton made of aluminum alloy is used to connect the three servos in series. The fish skeleton supports the rubber fish skin on the outside of the servo, which constitutes the three-joint drive system of the robot fish body. The fish body is fixed to the rigid fish head by threaded connection using a connector made of aluminum alloy, and the rubber fish skin of the fish body is glued to the fish head using hot melt adhesive, thus forming the overall result of the robot fish. The details are shown in Figure 1. Experiments have shown that this method is simple and easy to disassemble and assemble.
Technical indicators of the robot fish: cruising speed: 1.2~1.5m./s; cruising distance with full power: 4.5~5.5 kilometers; turning radius: 15~20cm.
2. System composition and working principle:
From a functional point of view, the entire fish system can be divided into three major parts: perception area, decision area, and behavior area. The perception area corresponds to the multi-infrared sensor network and the infinite transmission module, while the decision area refers to the main control chip (MCU), and the action area corresponds to the three-joint drive system composed of servos in series. See Figure 2 for details. The most important work of this system is concentrated on the coordinated control of multiple servos, so the control work of the servos is mainly introduced in detail.
[page]
3.1
Working principle of servo:
The servo is mainly composed of the following parts: steering wheel, reduction gear set, proportional potentiometer (position feedback potentiometer), DC motor (motor), control circuit board, etc. Its working principle: The control circuit board receives the control signal from the signal line, controls the rotation of the DC motor, and the DC motor drives a series of gear sets. The output shaft of the gear set is connected to a linear proportional potentiometer, which converts the angle θ of the output shaft into a proportional voltage feedback to the control circuit. The control circuit compares it with the input control pulse signal, generates a correction pulse, and drives the motor to rotate forward or reverse, so that the output position of the gear set matches the expected value, and the correction pulse tends to 0, so as to achieve the purpose of precise positioning of the servo. The servo is a typical closed-loop feedback system, and its working principle is shown in Figure 3.
There are three input lines for the servo. The red one in the middle is the power line, and the black one on the side is the ground line. These two lines provide the most basic energy guarantee for the servo, mainly for the rotation consumption of the motor. There are two specifications of power supply, one is 4.8V and the other is 6.0V, which correspond to different torque standards respectively. The other line is the control signal line, which is generally white.
3.2 Angle control of single servo and multiple servos
3.2.1 Angle control of single servo:
According to the working principle of the servo, a periodic pulse signal with a period of about 20ms and a pulse width between 0.5ms and 2.5ms is input to the servo, driving the output shaft of the servo to reach an angle between -90° and 90°, which changes linearly. And no matter how the external torque changes, the output shaft of the servo will remain at a corresponding angle until it is provided with a pulse signal of another width, and then the output angle will be changed to a new corresponding position. Through programming, the required periodic pulse signal is obtained with the help of the output port of the single-chip microcomputer.
Program example: (Crystal oscillator: 4MHZ, pulse output from PORTDbits.RD0)
void delay(int j) //This function is used to generate a delay of 0.25ms*j
{
for(i=0;i
INTCONbits.TMR0IF=0; //Clear TMR0 interrupt flag
T0CON=0XCF; //Set TMR0L to work in 8-bit timer mode, internal clock,
TMR0 does not need frequency division
TMR0L=0X14; //Set TMR0 to generate an interrupt every 0.25ms
L1: if(INTCONbits.TMR0IF==1)
{
INTCONbits.TMR0IF==0; //Clear TMR0 interrupt flag, turn off timer
T0CON=0X4F;
}
else goto L1;
}
}
PORTDbits.RD0=1; //Output a pulse signal with a pulse width of 2ms and a period of 20ms
delay(8);
PORTDbits.RD0=0;
delay(72);
From the above program, we can see that by changing the parameter j of the delay function, we can get a pulse signal with the corresponding pulse width and period as needed. For example, change the 1st to 4th line of the above program segment:
PORTDbits.RD0=1;
delay(4);
PORTDbits.RD0=0;
delay(76);
to get a pulse signal with an output pulse width of 1ms and a period of 20ms. Then, with the help of a for loop, the required periodic pulse signal can be obtained to drive the output shaft of the servo to a rotation angle between -90° and 90°.
3.2.2 Control of multiple servos at different angles:
By controlling multiple servos at different angles, several servos can be controlled to rotate to different angles at the same time to achieve the desired control purpose.
The specific implementation method is: set a timing value t in the timer delay function (the value of t is 0 when initialized in the program), so that t increases by 1 each time the timer is finished. For example, the timing time of a timer cycle is 0.25ms, then each increase of t value is equivalent to 0.25ms. When the representative value of t reaches 20ms, that is, when t is equal to 80, it is cleared to zero. In this way, the pulse period can be controlled at 20ms. Then, by using the if statement query method, the pulse width of the same period pulse can be adjusted, which can make multiple servos rotate to different angles at the same time.
Program example: (the crystal oscillator is 4MHZ, and the pulses are output from the three ports PORTDbits.RD0, PORTDbits.RD1, and PORTDbits.RD2)
if(t=0) //Port initialization
{
PORTDbits.RD0=1
PORTDbits.RD1=1
PORTDbits.RD2=1
}
INTCONbits.TMR0IF=0; //Clear TMR0 interrupt flag
T0CON=0XCF; //Set TMR0L to work in 8-bit timer mode, internal clock, and TMR0 without frequency division
TMR0L=0X14; //Set TMR0 to generate an interrupt every 0.25ms
L1: if(INTCONbits.TMR0IF==1)
{
INTCONbits.TMR0IF==0; //Clear TMR0 interrupt flag, turn off timer
T0CON=0X4F;
t++
}
else goto L1;
if(t=4)
PORTDbits.RD0=0; //Pulse width is: 1ms
else if(t=6)
PORTDbits.RD1=0; //Pulse width is: 1.5ms
else if(t=8)
PORTDbits.RD2=0; //Pulse width is: 2ms
else(t=80)
t=0; //Pulse period is: 0.25ms*80=20ms
[page]
Through the above program combined with the for loop, three periodic pulse signals with pulse widths of 1ms, 1.5ms, and 2ms and a period of 20ms can be obtained at the three ports PORTDbits.RD0, PORTDbits.RD1, and PORTDbits.RD2, thereby achieving the requirements of different simultaneous control of three servos. Of course, using the above method, it is easy to control more than 3 servos at the same time.3.3 Speed control of servos
Through the characteristics of the servo, it can be understood that the instantaneous movement speed of the servo is determined by the cooperation of its internal DC motor and the speed change gear set. Under constant voltage drive, its value is constant. However, the average movement speed of the servo can be changed by the control method of segmented pauses. For example, the rotation with an action amplitude of 90° is subdivided into 128 pause points, and the average speed of the change from 0° to 90° is achieved by controlling the length of time of each pause point. That is to say, the continuous one-step rotation of 90 degrees is changed into a step rotation of 128 pauses. The purpose of deceleration can be achieved by the short pause between each step. Because the pause time is very short, it can be regarded as a continuous rotation of 90 degrees. Due to the limitation of space, the corresponding program examples are no longer given here. Interested readers can refer to the above program examples to write them by themselves.
4. Conclusion
The PWM waveform generated by the method introduced in this article has high accuracy and can well complete the control work of the servo. The servo works stably. The robot fish we designed and manufactured successfully realized some basic movements of fish, such as swimming forward, accelerating, stopping, turning while moving forward, etc. This also verifies that the multi-joint drive method and the control method of multiple servos are effective. This article uses the bionic robot fish as a carrier to write an article, hoping to help other servo control applications.
The author's innovation: The article
uses the bionic robot fish as the application background, uses the PIC18F452 microcontroller as the control unit of the servo, and uses the microcontroller's timer to generate a periodic pulse signal from the microcontroller's port.
References:
[1] Liu Heping. PIC 18Fxxx MCU Principle and Interface Program Design. Beijing: Beijing University of Aeronautics and Astronautics Press, 2004
[2] Li Xuehai. PIC MCU Practical Tutorial - Advanced Edition (2nd Edition). Beijing: Beijing University of Aeronautics and Astronautics Press, 2007
[3] Wang Zhiliang, Zhou Zhuo, Jin Song, Zhao Jichun. Competition Robot Manufacturing Technology. Beijing: Machinery Industry Press, 2007
[4] Zhou Zhiqiang, Wang Zhiliang, Zhang Xueyuan, Huang Haihuan. Design of Bionic Robot Fish and Research on Its Motion Control. Microcomputer Information, Vol. 22, No. 17, 2006
Previous article:PIC microcontroller AD conversion data storage and serial port efficiency
Next article:Application of PIC microcontroller in automobile electric window controller
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- Ding~ It’s time to punch in on the first day of work after the holiday~Are you regretting that the holiday is not long enough or are you touched that you can finally start working again?
- How does Arteli AT32 MCU use on-chip Flash to implement EEPROM function?
- [Qinheng RISC-V core CH582] Development environment installation
- What is the MediaTek MT7628 WiFi module? What are its functions?
- High salary recruitment: European sales manager (German required)
- Application Notes on Flash Serial Programming for HuaDa MCU F003/F005/L110 Series
- MSP430 register detailed classification
- EEWORLD University Hall----Open Source PWM Robotic Arm (Arduion Version)
- 1MHz square wave double frequency
- CC3200 Modify the sprinkler routine of Out of Box