Design of voice guidance system based on AT89S52

Publisher:EnchantedMagicLatest update time:2010-06-09 Source: 现代电子技术Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Keywords:MCU Reference address:Design of voice guidance system based on AT89S52

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

Method of single chip microcomputer controlling GSM module TC35
This paper introduces a method of using GSM SMS function to achieve "zero distance" control of some controls. Since the cost of short messages is low, it can replace the traditional wireless remote control. Now, a method of using a single-chip microcomputer (MCS51 series) to control TC35 (cheap GSM module) to send and
[Microcontroller]
Method of single chip microcomputer controlling GSM module TC35
51 MCU C language programming: MCU timer interrupt
Requirements: P1.0 outputs a square wave with a period of 2ms, P1.1 outputs a square wave with a period of 5ms, and the duty cycle is 1:1. (The high and low levels are the same). The crystal frequency is 24MHz. (Use two timer counters T0 and T1) Assembly or C is OK. Programming is as follows: //===================
[Microcontroller]
Design of intelligent oil temperature detection and alarm system based on single chip microcomputer
0 Introduction     At present, hydraulic systems are widely used in the field of automatic control. The main problem that the system protection caused by excessive oil temperature is the stability of continuous operation of hydraulic systems. As the oil temperature of the oil circuit continues to rise during the circ
[Microcontroller]
Design of intelligent oil temperature detection and alarm system based on single chip microcomputer
Implementation method of communication between 51 microcontroller and computer
51 microcontroller and computer communication First, let's take a look at how the 51 microcontroller communicates with the computer. Let's first look at a basic circuit that implements this function. P1 in the picture is a serial port interface used for simulation . To realize the communication function with the
[Microcontroller]
Implementation method of communication between 51 microcontroller and computer
51 single chip microcomputer simulates traffic lights
Traffic lights are simulated by using the control diode and digital tube display of the 51 single-chip microcomputer. The system crystal oscillator is 11.0592MHZ. The red light in the east-west direction is set to 30 seconds, and the red light in the north-south direction is set to 20 seconds. P1.3 is connected to an e
[Microcontroller]
51 single chip microcomputer simulates traffic lights
Ideas for self-written microcontroller key release detection
All along, the single-chip computer has used while(key==0) for hand release detection; this not only wastes CPU resources, but also... Therefore, using hand release detection is very good and fashionable. The following is a summary of what I made when I made a small car at night. It can press a single button without
[Microcontroller]
Programming of automatic testing device for furniture door drawer durability based on 51 single chip microcomputer
#include #define uint unsigned int #define uchar unsigned char #define ZKB 6               //duty cycle initial value setting #define max_time 100       //Set the timeout   sbit gd1=P1^0;             //The photoelectric switch is blocked and the level is high, and it is not blocked and the level is low
[Microcontroller]
A brief analysis of the main factors that determine the performance and power consumption of ARM core MCUs
After ARM launched the Cortex-M0+ core, its 32-bit MCU cores increased to 4. Not long ago, NXP also announced that it had obtained the Cortex-M0+ processor license, becoming the only semiconductor manufacturer that can provide a complete series of Cortex-M0, Cortex-M0+, Cortex-M3 and Cortex-M4 core MCUs . Freescale al
[Power Management]
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号