0Introduction
The infrared sensing system is used to sense whether there are harmful gases nearby. When the infrared sensing system senses that harmful gases are approaching, it sends a high level that lasts for a period of time. The single-chip microcomputer starts the voice chip by opening an interrupt. The single-chip microcomputer communicates with the serial port, extracts the harmful gas parameters from the host computer, and prompts the nearby human body, and compares it with the safety value to determine whether the current environment is safe. For the use of the voice chip, the necessary text and digital information is first recorded. When playing, the single-chip microcomputer automatically addresses and reads the real-time parameters. In order to facilitate future system improvements or transplantation to other systems, recording and playback circuits can be designed to record different contents by switching. The system design is friendly and convenient, and the information given to people is more direct.
1 System overall design plan
Based on the existing available data of gas concentration, the connectivity and portability of the system are considered. The overall scheme of the system is shown in Figure 1.
The system is divided into four modules: core control module, voice circuit module, infrared sensing module and data reading. The system is designed to read and control the gas concentration under the premise that the gas concentration is an existing available resource. The core control module uses a single-chip microcomputer as the control device, and cooperates with appropriate peripheral circuits to control the operation of the entire system. The infrared sensing module is based on an infrared sensor, configured with a certain signal processing circuit, and sends signals to the single-chip microcomputer. The voice circuit is based on the voice chip, and two circuits for recording and playback are designed.
1.1 Design of core control module
The core control device uses a single-chip microcomputer, and its minimum system structure is shown in Figure 2.
This module is the core of the system. When the infrared sensing system senses the human body, it will send an interrupt signal. After receiving the signal, the microcontroller will execute the interrupt, read the gas concentration through the serial communication, then address the voice chip, and control the voice module to report the gas concentration. In addition to the basic peripheral circuits, the core control module mainly uses interrupts, serial communications and basic input and output functions.
In this system, the host computer communicates with the single-chip microcomputer through the serial port, and then the single-chip microcomputer processes it. After receiving the infrared signal, the single-chip microcomputer controls the voice chip to work and play the corresponding voice information. There are many optional single-chip microcomputers, such as AVR, AT89C51, etc. The advantage of using a separate control chip is to reduce the workload of the main control chip (CPLD) and improve the performance of the system. We chose the AVR single-chip microcomputer. AVR is a single-chip microcomputer based on the RISC (reduced instruction set computer) structure, referred to as AVR single-chip microcomputer. This series of single-chip microcomputers has made major improvements on the basis of absorbing the advantages of PIC and 8051 single-chip microcomputers. Compared with ordinary 51 series single-chip microcomputers, AVR single-chip microcomputers have many advantages. The first and most intuitive thing is that it has JTAG boundary scanning, simulation, and programming functions, which will not cause the previous phenomenon of passing the simulation but failing offline.
1.2 Design of infrared sensing module
This module is relatively simple. It uses an infrared sensor as its core. It only processes the signal simply and sends it to the interrupt of the microcontroller, as shown in Figure 3.
1.3 Design of data reading method
There are two ways to read data: one is to directly combine with the hardware circuit, read the 16-bit binary data, and sort and restore it; the other is to communicate through the serial port and read the data that has been sorted by the host computer through the RS-232 protocol. Obviously, compared with the first method, the serial port method avoids repeated data sorting and programming is simpler. For the entire project, the design is more reasonable and the development cycle is shortened.
This system uses serial data communication, and the interface is RS-232 serial port. Experiments have proved that this communication method is simple and easy to use, and meets the requirements of this system. This system uses a half-duplex configuration, which requires both the lower computer and the host controller to have independent sending and receiving capabilities.
The receive/transmit clock is used to control the speed at which the communication device receives/transmits character data. This clock signal is usually generated by the clock circuit inside the microcomputer. When receiving data, the receiver samples the received data at the rising edge of the receive clock and performs data bit detection. When sending data, the transmitter serially shifts the data in the shift register at the falling edge of the send clock and outputs it.
The relationship between the receive/send clock frequency and the baud rate is as follows:
Where: Fe is the receive/send clock frequency; n is the frequency coefficient, n=1, 16, 64; vc is the receive/send baud rate.
The relationship between the receive/transmit clock period Tc and the transmitted data bit width Td is:
Where: n=1, 16, 64.
If n=16, the process of asynchronous transmission and receiving data synchronization is as follows: the receiver samples the receiving data line at the rising edge of each receiving clock. When the receiving data line is found to be at a low level, it is considered to be the beginning of the start bit. If the receiving data line is detected to remain at a low level within 8 consecutive clock cycles (because n=16, so Td=16Tc), it is determined to be the start bit (not an interference signal). This method can not only eliminate the noise interference on the receiving line and identify the false start bit, but also determine the middle point of the start bit quite accurately, thereby providing an accurate time reference. Starting from this reference, the data line is sampled every 16Tc as input data. Generally speaking, starting from a falling edge detected on the receiving data line, if its low level can be maintained for nTc/2 (half-bit time), it is determined to be the start bit, and then every nTc time (one data bit time) is sampled at the middle point of each data bit.
2 Communication Software Design
The system communication software consists of three parts: the lower computer, the host controller communication software and the upper computer monitoring software. The lower computer communication software mainly receives the signal sent by the host controller, sends a response signal for each lower computer address, and then responds accordingly according to the control signal sent by the host controller, and then sends the data required by the host controller. Its communication function is realized by using the serial interrupt of the microcontroller and the method of querying the receiving and sending status flag. The lower computer usually collects data from each monitoring point and stores it regularly. When there is a serial interrupt, the serial interrupt service program is executed to determine whether it is the address information of the local machine. When the address information matches the local address, it switches to receiving control commands and performs corresponding operations; when the address information does not match the address of this station, the interrupt is exited. The lower computer communication flow chart is shown in Figure 4.
The communication software of the host controller mainly implements functions including calling each slave (lower computer) and sending query control commands to each slave. Its working process is: the controller sends the address of the slave to be called, and then waits for the response signal from the slave. If the response signal is correct, the control command is sent. If the response signal is incorrect, the address to be called is resent, and the response signal is received. After receiving the response signal, the data sent by the lower computer is received, stored in the corresponding data storage area and displayed on the LCD (liquid crystal display) screen. If the same slave is called multiple times and there is no response signal within the specified time or the response signal is incorrect, an error message is prompted. Figure 5 is a communication flow chart of the host controller.
The host computer monitoring software is written in Visual C++, with good visual effects, and its functions include data query, data storage, serial communication settings, video monitoring, chart display (single machine, multi-machine), etc. The data of the host computer comes from the host controller, which is transmitted to the host computer through the RS-232 serial network. Its interface is parallel to the interface of the RS-485 network. The standard interface has 25 lines, 4 data lines, 11 control lines, 3 timing lines, 7 spare and undefined lines, but only 9 are commonly used.
3 Conclusion
For this system, in addition to using the host computer software designed by yourself for debugging, you can also use a simple serial port debugger to achieve it. This system covers the single-chip microcomputer technology and some knowledge of analog and digital circuits. The system has certain controllability, stable operation, easy implementation, low cost, and high use value. After the system was built, the operation results showed that the system worked stably and reliably, and had broad prospects in the field of industrial control.
Previous article:Design of multifunctional power supply based on single chip microcomputer AVR Butterfly
Next article:Design of I SP1362 OTG based on AVR microcontroller
Recommended ReadingLatest update time:2024-11-16 20:35
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
- Combining 51 code to analyze the programming ideas of RFID card reader
- X-NUCLEO-IKS01A3 sensor driver transplantation based on STM8S-DISCOVERY
- TMDSEVM572X development board link emulator
- [Sipeed LicheeRV 86 Panel Review] 3-System Burn-in Test
- STM32MP157A-DK1 Review - 2. MPU Functions
- [AB32VG1 development board review] OLED screen display driver
- TI TMS320F2812 SVPWM Program
- JHL HOOD 1969 small class A amplifier board
- Solutions to several difficult problems in the CCS debugging process
- How do you calculate the cost of PCB materials?