Application of SPCE061A in Voice Environment Humidity Measuring Instrument

Publisher:朱颜素韵Latest update time:2013-05-29 Source: 21icKeywords:SPCE061A Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1 Introduction

Industrial and agricultural production, meteorology, environmental protection, national defense, scientific research, aerospace and other departments often need to measure and control environmental humidity. The control of environmental temperature and humidity and the monitoring and analysis of the moisture value of industrial materials have become one of the more common technical conditions, but among the conventional environmental parameters, humidity is the most difficult parameter to measure accurately. This is because measuring humidity is much more complicated than measuring temperature. Temperature is an independent measurement, while humidity is affected by other factors (atmospheric pressure and temperature). In addition, humidity calibration is also a difficult problem. At present, there are more than 20 to 30 kinds of humidity measurements in principle. With the development of the electronics industry in the second half of the 20th century, electronic humidity sensor products and humidity measurement also emerged in the 1990s, and have made great progress in the following years. This solution is to use electronic sensors with single-chip microcomputers to realize a humanized hygrometer with voice function.

1.1 System parameters

The main parameters of this system are:
working temperature: 0~70℃;
working humidity: 0~100%RH;
measurement range: 1%~99%RH;
accuracy: ±5RH%.

1.2 Functional Introduction

This solution can achieve:
button control to start humidity measurement;
voice playback of measured humidity values;
humidity judgment, and there are warm reminders. When the humidity is too high, it plays "It's humid, please turn on the dehumidifier", and when the humidity is too low, it plays "It's too dry, please turn on the humidifier".

2 System Hardware Design

For humidity measuring instruments, in addition to a controller to control the measurement, a measuring device is also required. In this system, SPCE061A is used as the controller, and the capacitive humidity sensor HS1101 is used as the measuring device. A button is used to start humidity measurement and voice playback. Since the capacitor cannot be directly connected to the I/O port of SPCE061A for measurement, a circuit module is required to connect to the Feedback interface IOB2, IOB4, IOB3, and IOB5 of SPCE061A to realize the conversion from capacitance to frequency. The structural block diagram of the system is shown in Figure 2.1.


Figure 2.1 System structure diagram

The SPCE061A microcontroller is the main control chip. It determines whether to start the measurement based on the key value it reads. During the measurement, it is responsible for reading the operating frequency of the Feedback circuit, calculating the capacitance of the HS1101 and the humidity of the environment it is in based on the frequency, and playing the humidity through the speaker. At the same time, if the humidity value is too high or too low, the system will play a warm reminder.

2.1 Introduction to SPCE061A chip

SPCE061A is a 16-bit microcontroller based on the \'nSP core. Its chip features are as follows:

◆ Operating voltage: The core operating voltage VDD is 3.0~3.6V (CPU), and the I/O port operating voltage VDDH is VDD~5.5V (I/O);
◆ CPU clock: 0.32MHz~49.152MHz;
◆ Built-in 2K word SRAM and 32K flash ROM;
◆ When the system is in standby state (the clock is in stop state), the power consumption is less than 2μA@3.6V;
◆ With the function of touch key wake-up;
◆ 32-bit general-purpose programmable input/output port;
◆ 2 16-bit programmable timer/counters (the initial count value can be automatically preset);
◆ 7-channel 10-bit voltage analog-to-digital converter (ADC) and single-channel sound analog-to-digital converter;
◆ 2 10-bit DAC (digital-to-analog conversion) output channels;
◆ 14 interrupt sources can come from timer A / B, time base, 2 external clock source inputs, key wake-up;
◆ Equipped with serial device interface;
◆ Low voltage reset (LVR) function and low voltage monitoring (LVD) function;
◆ Built-in online simulation (ICE, In-Circuit Emulator) interface.

The internal structure block diagram of SPCE061A is shown in Figure 2.2.


Figure 2.2 SPCE061A internal structure diagram

2.2 Humidity sensor HS1101

2.2.1 Introduction to humidity measurement

1. Definition of humidity

According to the metrology, humidity is defined as "the quantity of the state of an object". The humidity referred to in daily life is relative humidity, expressed as RH%. In general, it is the percentage of the amount of water vapor (water vapor pressure) contained in a gas (usually in the air) to the saturated water vapor (saturated water vapor pressure) under the same conditions.

2. Humidity measurement method

Based on the output parameters of the test, humidity measurement methods are mainly divided into the following categories: humidity measurement method (extension method) using the change of geometric dimensions of the material, dry-wet bulb method, condensation dew point method, lithium chloride dew point method, electrical humidity measurement method (resistance method, capacitance method), electrolysis method (coulomb hygrometer) and other humidity measurement methods. Readers can find relevant information for further understanding of these measurement methods. Due to space limitations, they will not be repeated here. The following focuses on the characteristics of the electrical humidity measurement method used in this system.

3. Characteristics of electronic humidity sensors

Electronic humidity sensors have only developed rapidly in recent decades, especially in the past 20 years. Before the humidity sensor is shipped out of the factory, the humidity sensor manufacturer must use a standard humidity generator to calibrate each product. The accuracy of the electronic humidity sensor can reach 2% to 3% RH.

In actual use, due to the influence of dust, oil and harmful gases, it will age and reduce its accuracy after a long time of use. The annual drift of the humidity sensor is generally around ±2%, or even higher. In general, the manufacturer will indicate that the effective use time of a calibration is 1 or 2 years, and it needs to be recalibrated when it expires. The

accuracy level of the electronic humidity sensor should be judged in combination with its long-term stability. Generally speaking, the long-term stability and service life of the electronic humidity sensor are not very good.

The humidity sensor uses semiconductor technology, so it has requirements for the ambient temperature of use. Exceeding the specified operating temperature will cause damage to the sensor.

Therefore, the humidity measurement method of the electronic humidity sensor is more suitable for use in clean and normal temperature occasions.

There are two main types of electronic humidity sensors: capacitive and resistive.

The advantages of capacitive humidity sensors are fast response speed, small size, good linearity, and relatively stable. Some foreign products also have high temperature working performance. However, most of the products that achieve the above performance are foreign famous brands, and the prices are relatively expensive. Some low-priced capacitive humidity sensors sold on the market often fail to achieve the above level, and their linearity, consistency and repeatability are not ideal. The humidity sensing section is seriously deformed below 30%RH and above 80%RH. Some products use single-chip microcomputer compensation correction, which causes a "step" jump in humidity, reduces accuracy, and has the disadvantages of poor consistency and poor linearity. Regardless of high-end or low-end capacitive humidity sensors, the long-term stability is not ideal. Most of them drift seriously after long-term use. The capacitance value of the humidity-sensitive capacitor changes in the pF level, and the change of 1%RH is less than 0.5pF. The drift change of the capacitance value often causes an error of tens of %RH. Most capacitive humidity sensors do not have the performance of working at temperatures above 40℃, and often fail and damage.

In this system, we use the capacitive humidity sensor HS1101, which is relatively common and suitable for some occasions where accuracy requirements are not high. [page]

2.2.2 Introduction to HS1101

1. Basic parameters

are shown in Figure 2.3. If not otherwise specified, the default measurement temperature in the figure below is Tα=25°C, and the operating frequency of HS1101 during measurement is 10KHz.

Figure 2.3 HS1101 parameter diagram

2. The characteristic curve

is shown in Figure 2.4. The measurement temperature is Tα=25℃, and the operating frequency of HS1101 is 10KHz during measurement.


Figure 2.4 HS1101 characteristic curve

2.3 Hardware Circuit

2.3.1 SPCE061A Minimum System

This solution uses the SPCE061A streamlined development board (61 board) as the MCU minimum system. The 61 board includes the SPCE061A chip and its peripheral basic modules. The peripheral modules include: crystal oscillator input module (OSC), phase-locked loop peripheral circuit (PLL), reset circuit (RESET), indicator light (LED), etc., as shown in the figure below.


Figure 2.5 SPCE061A minimum system

2.3.2 Capacitive humidity sensor HS1101 circuit module

Since the humidity sensor HS1101 is capacitive, we need to find a way to measure its capacitance. It is impossible to read it directly using a single-chip microcomputer, but the feedback function of SPCE061A can be used to measure the operating frequency of the RC circuit where HS1101 is located, so that its capacitance can be calculated.

In order to reduce the error, a fixed capacitor and a resistor are used to form another feedback circuit as the reference of the humidity sensor HS1101.

As shown in Figure 2.6: According to the parameters in Figure 2.3, in order to make the operating frequency of the humidity sensor HS1101 as close to 10KHz as possible, a 620KΩ resistor and HS1101 are selected to form Feedback1; a 390pF capacitor is used as the reference, and another 620KΩ resistor is used to form Feedback2.


Figure 2.6 Capacitive humidity sensor circuit module circuit [page]

2.3.3 Key circuit

This system directly uses the keys on the SPCE061A streamlined development board. The key circuit on the 61 board is shown in Figure 2.7.


Figure 2.7 61 board key circuit

3 System software design

The software system of this scheme includes the following modules:

key scanning: scan the keys to determine whether a key is pressed, implemented in the Key.c file;
humidity measurement: port initialization, measure humidity and return humidity value, implemented in the Hum_Measure.c file;
voice play arbitrary numbers: play any integer, used to play humidity value in this system, implemented in the PlayVoice.c file;
interrupt service: voice play interrupt service program and IRQ2 interrupt read count value program, defined in the isr.asm file.

3.1 Program description of each module

3.1.1 Main program

The main program flow is shown in Figure 3.1: Call the key scanning program to read the key value. If the KEY1 key is pressed, start the measurement, call the humidity measurement function to measure the humidity, and play the corresponding according to the measurement result; if the KEY1 key is not pressed, return to continue scanning the keys.

Note: The fast interrupt FIQ will be turned off before each measurement. This is because the timer/counter TimerA is used in the measurement process, and the FIQ interrupt is turned on during voice playback. Therefore, it needs to be turned off before measurement to avoid the CPU responding to the FIQ interrupt during the measurement process, causing unnecessary trouble.


Figure 3.1 Main program flow chart

3.1.2 Key Scan Module

This system uses only one key - KEY1 on the 61 board, which is connected to IOA0. The key scan program flow is shown in Figure 3.2. Using the delay de-jitter method, first obtain the port data, delay for a period of time, generally a delay of tens of ms, and then obtain the port data again. If the two are the same, it means that the correct key value has been obtained.


Figure 3.2 Key scanning program flow chart [page]

3.1.3 Humidity measurement program flow chart

The humidity measurement program flow chart is shown in Figure 3.3. In order to reduce errors and ensure the accuracy of the measurement, measure four times, remove the highest value and the lowest value. If the difference between the two middle numbers is not greater than 10, the average of the two middle numbers is the final data of the measurement. This data in the program is the count value of TimerA.

Since the capacitance of the sensor is measured using the Feedback function, as shown in Figure 2.6. In fact, the Feedback function can directly measure the working frequency of the sensor, and the capacitance value of the sensor can be calculated based on this frequency.

The method for measuring the working frequency of the sensor: use TimeB as a timer and TimeA as a counter; measure the working frequency of the sensor based on the number of TimeA counts within the TimeB timing time.


Figure 3.3 Humidity measurement program flow chart

3.1.4 Voice playback of arbitrary integer data program

The voice playback of arbitrary three-digit integer program flow is shown in Figure 3.4. This program can define formal parameters to pass any three-digit number. First calculate the hundreds, tens, and ones of the data, and then play them separately. The playback process is as follows:


Figure 3.4 Flowchart of voice playback of any three-digit number

3.1.5 Interrupt service program flow chart The

interrupt service program of FIQ is shown in Figure 3.5. The main function of the FIQ interrupt service program is to call the F_FIQ_Service_SACM_S480 function to decode and output.

The IRQ2 interrupt service program is shown in Figure 3.6. The IRQ2 interrupt service program has two functions: one is to save the count value of TimerA; the other is to set the timer overflow flag in order to cooperate with the humidity measurement function. If this interrupt service program is entered, it means that the timer has overflowed.


Figure 3.6 IRQ2 interrupt service program flow chart

4 Conclusion

Humidity measurement itself is much more complicated than temperature measurement, mainly because humidity is affected by temperature and atmospheric pressure. For capacitive humidity sensors, it is even more difficult because measuring capacitance itself is also a very complicated process. The Feedback function of SPCE061A provides great convenience for this measurement. A fixed resistor and a capacitive humidity sensor are used to form an RC oscillation circuit, which is connected to the input and output of the Feedback. In this way, by measuring the frequency, it is easy to get the capacitance of the capacitive humidity sensor, and the measured humidity can be obtained according to the calibration value. (end)
Keywords:SPCE061A Reference address:Application of SPCE061A in Voice Environment Humidity Measuring Instrument

Previous article:Online monitoring system for hydraulic pump drive motor of formation test and evaluation instrument
Next article:Design of DC servo driver based on SPMC75F2313A

Recommended ReadingLatest update time:2024-11-16 22:34

SPCE061A single chip collects voice signals and transmits them to PC for analysis
introduction With the continuous improvement of the integration level of single-chip microcomputers, modern single-chip microcomputers have digital signal processing functions, making it possible to implement voice signal processing with single-chip microcomputers. SPCE061A, a product launched by Taiwan Lingyan
[Microcontroller]
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号