0 Introduction
Topic B of the 2009 National Undergraduate Electronic Design Competition is "Sound Guidance System"; the topic requires the design and production of a sound guidance system. The sound guidance system has a movable sound source S and three sound receivers A, B, and C. The sound receivers can be connected by wire. The sound receiver can use the different distances between the movable sound source and the receiver to generate an error signal of the movable sound source from the specified position, and transmit this error signal to the movable sound source wirelessly to guide its movement.
1 Specific design and implementation of the system
1.1 System composition
The system composition is shown in Figure 1. In the system design, two single-chip microcomputers (AT89S52) are used as the detection and control core of the movable sound source. The single-chip microcomputer (MCU1) processes the time when the receiver receives the sound source signal, detects the current position of the car, and then sends it to MCU2 via wireless. MCU2 controls the speed and direction of the motor according to the current position, and gives corresponding sound and light prompts when it stops.
1.2 Specific algorithm implementation
1.2.1 Design and calculation
This design mainly determines the current position S of the car based on the time interval of the receiver receiving the sound source signal, as shown in Figure 2. Let the distance from point S to point C be a. The distance from point S to point A is b; the distance from point S to point B is c. Let the coordinates of point S be l, h), and assume that the time interval of receiving the signal by receiver A, receiver B and receiver C is measured by the single-chip microcomputer to calculate the distance difference between b and a as c1; the distance difference between b and c is c2. The following equation can be obtained from the relationship in Figure 2:
The corresponding position of the car (l, h) can be obtained based on the measured distance difference △d=|c2-c1|.
1.2.2 Error signal generation
The error signal generation of this design has three main aspects:
Detection error The half-wave loss caused by the sound source signal has an error size related to the frequency of the sound source signal. When the frequency is smaller, △d=|c2-c1| is smaller. For example, if the sound source signal with a frequency of 5 kHz has a period of 0.2 ms, the half-wave loss will result in △d=0.1 ms×340 m/s=3.4 cm, so the larger the frequency, the smaller the half-wave loss.
The error caused by the measurement time of the single-chip microcomputer is that the crystal oscillator of the single-chip microcomputer is 24 MHz, and the internal clock is divided by 12, the clock period is 0.5μs, and the measurement time error is ±0.5μs, which will generate a certain error signal.
Calculation error In the process of calculating the sound source position, there is a certain trade-off in the data, which will cause a certain error.
1.2.3 Simple Algorithm of Control Theory
The control theory simple algorithm for this design mainly considers three schemes:
Solution 1: Determine whether the car moves based on the calculated value of △d=|c2-c1|. When it moves to △d=0, control the car to stop.
Solution 2: Control the word PWM according to the specific value of the measured △d=|c2-c1|, PWM=K△d, where k is proportional adjustment. The larger △d is, the larger K is, thereby controlling the speed of the car.
Solution 3: PID control algorithm
In the continuous motion control system, the proportion (P), integral (I) and differential (D) of the deviation are linearly combined to form the control quantity. In the control system, the drive motor speed sampling information is used as the feedback quantity, and the incremental digital PID control algorithm is adopted to achieve closed-loop control of the motor by outputting PWM signals. The calculation formula is:
In the formula: △un is the nth output increment; en is the nth deviation; en-1 is the n-1th deviation; en-2 is the n-2th deviation. The KP, KI, and KD parameters in the incremental PID control system are generally tested and analyzed repeatedly to determine the ideal values. Considering the simplicity, feasibility and practical application of the algorithm, the first solution is the simplest and can achieve the control of the car speed.
2 Unit hardware circuit design
According to the system block diagram, the system consists of the following circuits. There are different design schemes for the design and implementation of each circuit.
2.1 Design of movable sound source modulation circuit
The signal generated by the movable sound source is a periodic audio pulse signal. The RC oscillator circuit is used to generate an adjustable periodic audio pulse signal, which is then sent out by the speaker after power amplification. The audio signal generated by this scheme has a large high-order harmonic signal. After the circuit is improved, the high-order harmonic signal is greatly reduced, which can meet the design requirements. The circuit diagram is shown in Figure 3.
2.2 Receiver Circuit Design
The receiver circuit is mainly used to receive the audio pulse signal emitted by the movable sound source, and then transmit it to the single-chip microcomputer (MCU1). The single-chip microcomputer 1 (MCU1) processes the time when the receiver receives the sound source signal, detects the current position of the car, and then sends it to the single-chip microcomputer 2 (MCU2) via wireless. Therefore, whether the audio signal can be received well is the key to the whole design. The design considers that the signal acquisition sensor of the receiver adopts MIC, which amplifies, filters, and shapes the collected signal to generate a square wave signal and transmit it to the single-chip microcomputer. Since the MIC has a high sensitivity and is greatly interfered by external noise, a high-pass filter circuit is added in the middle to realize the reception of the sound source signal. The circuit diagram is shown in Figure 4.
2.3 Design of car control circuit
The car control circuit design uses NEC's motor control ASSP chip (model MMC-1) to realize the movement of the movable sound source, uses UART mode to communicate with the ASSP chip to provide control signals, and then uses L298 to drive the motor to rotate. The L298N chip can drive two two-phase motors or a four-phase motor. The output voltage can reach up to 50 V, and the output voltage can be adjusted directly through the power supply; the signal can be directly provided by the ASSP chip port; and the circuit is simple and easy to use. The speed and direction of the motor are controlled by controlling the INl, IN2, IN3, and IN4 input terminals of L298. This solution has a simple interface and does not occupy system resources.
2.4 Car Steering Accuracy Control and Distance Calculation
There are many solutions for the car's steering accuracy control and distance calculation. Considering the complexity of installation and the ease of debugging, the design uses a reflective photoelectric tube to detect the black and white code disks on the wheels, generate pulse counts, and thus calculate the car's travel distance and steering control.
3 Software Design
3.1 Software Design Description
In the car program, the wireless reception is turned on at the beginning. After receiving the data, it is judged whether the car has reached the predetermined position. If not, the algorithm continues to control the calculation of the PWM value, and the PWM value controls the speed and direction of the motor; if it is judged that the predetermined position has been reached after receiving the data, an audible and visual signal is emitted to indicate that the predetermined position has been reached.
For the monitoring end program design, the measured value is first filtered through the filtering algorithm, and then the last measured value is sent, and then the timer is cleared to determine whether there is a falling edge of INT3. If no falling edge is detected, continue to wait. If there is, start the timer and the interrupt. After a delay of 100μs, continue to filter the measured value.
3.2 Program Flowchart
The program flow is shown in Figure 7.
4 Test Data
4.1 Basic requirements
(1) After the movable sound source emits a sound, it starts to move, reaches the ox line and stops. This movement time is the response time. Measure the response time and use the following formula to calculate the average speed of the response. The average speed is required to be greater than 5 cm/s.
(2) The distance between the position of the movable sound source after it stops and the ox line is the positioning error. The positioning error is less than 3 cm.
(3) The distance that the movable sound source exceeds the left side of the ox line at any time during the movement is less than 5 cm.
(4) After the movable sound source reaches the ox line, there must be obvious light and sound indications.
(5) Turn the movable sound source 180° (the direction of the sound-emitting device can be adjusted manually) and be able to repeat the basic requirements.
4.2 Development part
(1) The average speed is greater than 10 cm/s; the positioning error is less than 1 cm; the distance that the movable sound source exceeds the left side of the ox line at any time during the movement is less than 2 cm.
(2) After completing the basic requirement and moving to the ox line, the movable sound source stops at the original location for 5 to 10 seconds, and then uses receivers A and C to move the movable sound source to point W. After reaching point W, there must be obvious light and sound indications and the sound source stops. At this time, the straight-line distance between the sound source and W is less than 1 cm. The average speed of the entire movement process is greater than 10 cm/s.
4.3 Basic requirements test
The test data table is shown in Table 1. Turn the movable sound source 180° (the direction of the sound-generating device can be adjusted manually) and repeat the above basic requirements. The test data table is shown in Table 2.
4.4 Play part test
The test data is shown in Table 3.
The
test data shows that the design can meet the basic requirements of the competition and can basically achieve the performance part.
The design is based on a complete and reliable hardware design, using the control and computing advantages of NEC Electronic Motor Control ASSP chip and AT89S52, and using a unique set of software algorithms to achieve precise control of the sound guidance system.
Previous article:Application design of LCD touch screen based on C8051F023
Next article:Design of Remote Online Upgrade Program for C8051F130
Recommended ReadingLatest update time:2024-11-16 16:19
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
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!
- 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
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Random notes small total small picture signal reflection picture
- Basic knowledge of radome structure
- (Repost) Getting Started with Bluetooth Development
- [Shanghai Hangxin ACM32F070 development board evaluation] 5. Run the watchdog
- The rules for adding core points have been adjusted, and new products have been added to the core redemption mall!
- How does a magnetostrictive sensor work? What is the working principle of a magnetostrictive sensor?
- What types of posts can become featured posts?
- Several important parameters of RF switches
- The pitfalls of first contact with sensortile.box
- Award-winning live broadcast: Hidden costs of isolation system design