Jotrin Electronics
備考 合計 (USD) 動作して
製品とショッピングカート : 0
ホーム > Other > Design of a voice environment parameter tester based on the single-chi

Design of a voice environment parameter tester based on the single-chip microcomputer SPCE061A

公開時間: 2020-08-19 11:59:03

1 Introduction

People's health awareness and environmental protection awareness gradually increase, so that environmental parameters and their effects on the body are increasingly concerned. However, in real life, people are often surrounded by harmful gases such as gas, cigarettes, alcohol, etc., but because there is no suitable measuring instrument or the professional measuring instrument is too expensive, it is not easy to know the values of various parameters in the surrounding environment. Therefore, it is impossible to know whether the environmental parameters are harmful to the body or the environment. Here is a design method of a multifunctional environmental measuring instrument, which is cheap, practical and portable, and has multiple functions such as voice broadcast of measured values and hazardous gas over-limit alarms.

2 Overall structure and working principle

The measuring instrument uses the 16-bit single-chip microcomputer SPCE061A as the control core. The light, temperature, humidity, and gas sensors convert the acquired environmental information into analog electrical signals, which are converted into corresponding digital signals by the A/D converter and then processed by the CPU; The CPU calculates the measured value in real time and sends the result to the liquid crystal display for display, and at the same time voice broadcast.

Equipped with keyboard, infrared receiving circuit, manual reset and automatic power-on reset and hardware watchdog circuit. SPCE061A has A/D and D/A conversion modules inside, which can easily realize analog/digital conversion and voice broadcast functions. The overall structure of the system is shown in Figure 1.

Figure 1 Overall structure diagram of environmental measuring instrument (2).png

3 hardware circuit design

3.1 Temperature light module

The temperature sensor adopts R450 type negative thermal resistance, and the light sensor adopts high-sensitivity photoresistor. The temperature sensor and light sensor have better linearity, especially in indoor environments, and the resistance value changes significantly with external physical quantities, so the middle can be omitted The amplifying circuit is directly connected to the 10A port of the microcontroller. The light temperature measurement module circuit is shown in Figure 2. The whole circuit is powered by a 6 V battery, and a 2 V voltage regulator tube provides a 2 V reference voltage for the A/D conversion circuit. Adjustable resistor R1 is used to calibrate the reference voltage drop caused by temperature drift and power supply voltage drop, R4 and R6 Connected in series, the change of light intensity is reflected by the change of the wind partial pressure value, and input to the IOAO port of the single-chip microcomputer for A/D conversion. The IOA port is set as a floating input port, the variable iLM is defined in the microcontroller, the voltage data obtained by the light measurement is stored in the iLM, and the light is too strong, too weak or soft according to the iLM. The A/D conversion data is fetched once every 1 ms, and fetching 10 times in total is to get the data in one cycle of 100 Hz natural light. Take the average of 10 measurements and look up the table to get the light intensity. The principle of temperature measurement is basically the same as that of light measurement. The circuit principle of this module is shown as in Fig. 2.

Figure 2 Light temperature measurement module.png

3.2 Gas measurement module

The new semiconductor gas sensor TGS2600 can sensitively sense the peculiar smell of low-concentration pollutants in the air, such as low-concentration cigarette pollutants and other peculiar smells in the air, and has a high sensitivity to H2, CO, etc. The sensor can detect several ppm H2 content, the basic measurement circuit of the sensor is shown in Figure 3. This sensor requires two voltage inputs: heater voltage VH and circuit voltage VC1. The heater voltage VH is applied to the integrated heater to keep the sensor at a specific optimal sensing temperature. The circuit voltage VC1 is loaded in order to measure the load resistance voltage Vout in series with the gas sensor. The output voltage is directly input to the microcontroller through the IOA4 port for A/D conversion.

Figure 3 Gas measurement module.png

3.3 Humidity measurement module

Since the humidity sensor HS1101 is capacitive, it is necessary to measure its capacitance value, which cannot be read directly by a single-chip microcomputer. However, the feed-back function of SPCE061A can be used to measure the operating frequency of the RC circuit where HS1 101 is located, so that the capacitance value can be calculated . In order to reduce the error, a fixed capacitor C6 and resistor Rs are used to form another Feedback circuit as the reference of the humidity sensor HS1101, as shown in Figure 4. According to the parameters in Figure 4, in order to make the operating frequency of the humidity sensor HS1101 as close as possible to 10 kHz, a 620 kΩ resistor and HS1101 are selected to form Feedback1; a 390 pF capacitor is used as a reference and another 620 kΩ resistor forms Feedback2.

Figure 4 Humidity measurement module.png

3.4 Infrared transmitter and receiver module

The infrared transmitting and receiving adopts 38 kHz carrier, which has the characteristics of low power consumption, anti-interference, and long distance. The independent remote control allows people to control the broadcast and switch functions of the tester anywhere in the room. The transmitter consists of a Lingyang 61 board and an infrared transmitter circuit. The main program calls the keyboard scanning program to read the key value. If the KEY1 key is pressed, the KEY1 transmission program is called, and the transmission sequence is binary 1000 0000; the KEY2 key is pressed, the transmission sequence is 1000 0001; the KEY3 key is pressed, the transmission sequence is 1000 0010 . The receiving circuit is input to the single-chip microcomputer through the IOA7 port. The main program scans the IOA7 port after each measurement to see if there is a low-level start signal. If there is, continue to receive, otherwise the main program continues to execute downward. After the system is powered on, if it receives the KEY1 key transmission sequence, it will start measuring and display; if it receives the KEY2 key transmission sequence, it will broadcast the current temperature, light, humidity and harmful gas concentration. KEY3 key can make the system enter sleep state to reduce power consumption.

3.5 Keyboard display unit

The display unit uses 128x64 character dot matrix liquid crystal display SPLC501 module components, which are mainly composed of LCD display, LCD control board and bias voltage generating circuit. The current temperature value, light intensity, harmful gas concentration, humidity and other information are displayed in 4 rows. The keyboard module is mainly used to set the alarm threshold. The KEY1 button is the confirm/cancel function, the KEY2 button is the upward adjustment function, and the KEY3 button is the downward adjustment function. When the KEY1 key is pressed, the temperature value will continue to flash. Press the KEY2 or KEY3 key to set the temperature threshold. After the setting is completed, press the KEY1 key again, and the light intensity value will continue to flash. To set the light intensity threshold, press the same Method to set the gas concentration and humidity threshold, when the setting is done, stop the button, and the system will automatically restart the measurement after 2 seconds.

4 Software design

The software adopts a modular design method and consists of the main program and subprograms such as keyboard processing, data acquisition, alarm, voice, liquid crystal display and infrared receiving. The main program flow of the system is shown in Figure 6. This program is the core of control and management. After the system is powered on, it will be initialized. After completion, the system will start to operate normally, perform operations such as measurement and display of environmental parameters and judgment of over-limit alarms, and then detect Whether the infrared receiver has signal input and performs functions such as display and voice broadcast.

Figure 6 System main program flow.png

The upper limit of the system temperature reminder is 27°C, and the lower limit is 16°C. The light intensity is divided into 20 levels. Below level 7, the light is too weak, above level 16 is too strong, and there will be voice reminders if it is too weak or too strong. The concentration of harmful gas is divided into 100 levels, and the level below 20 is a harmless zone, and the system will not alarm. The system above level 20 will continue to give voice reminders until the gas concentration drops below level 20 again. When the humidity is below 40%, there will be no reminder, and the system will intermittently remind when the humidity is above 40%. Set the gas broadcast as the highest priority in the 4 voice broadcast reminder subroutines, because harmful gases are the most harmful to the human body and are most prone to accidents. In addition, there is a relay output interface outside the system, which can control external emergency equipment, such as exhaust fans, lights, humidifiers and other equipment. According to the requirements of different environmental parameters in different regions, the simple and easy parameter setting function of the system can meet various environmental needs, such as vegetable greenhouses, factory workshops, etc. The compilation environment of this system is unSP IDE 2.0, which is written in assembly language and C language. Among them, the interrupt service routine, A/D conversion and liquid crystal display and other related low-level programs are written in assembly language, and other programs such as measurement programs and voice broadcast are written in assembly language. C language is completed, the program volume is about 22 KB.

5 Conclusion

The prototype was developed according to the above principles. The whole system consists of 5 modules including measurement, relay output control, battery power supply, infrared remote control and display. After actual testing, the system has very sensitive detection and alarm capabilities for cigarettes, methane, and alcohol, and the measurement of temperature, humidity and light also meets practical requirements. The measuring instrument can change the set value according to requirements, and is suitable for environmental measurement and safety alarms in homes, greenhouses and public places. With the improvement of people's requirements for quality of life, this multi-functional portable tester will have a broader Application prospects. The innovation of this design lies in the integration of indoor environment and security alarm. The LCD display and voice broadcast are very user-friendly. In addition, the infrared remote control function makes it more convenient to use.

ラベル: SPCE061A


前: LED Driver ICs are optimized for high-line applications.

次の: How to troubleshoot temperature sensor