The application of the hottest SPCE061A in the voi

  • Detail

The application of SPCE061A in the voice environmental humidity measuring instrument

Abstract: This paper introduces the scheme of using 16 bit single chip microcomputer SPCE061A as the control center and cooperating with capacitive humidity sensor HS1101 to measure humidity. The humidity measuring instrument has the function of voice playback, and uses the keys to control the measurement of humidity and the playback of humidity value. In this scheme, a humidity sensor and a fixed resistor are connected in series with iob2 and iob4 of SPCE061A to form an RC feedback circuit, that is, the feedback circuit of SPCE061A; Using the feedback function of SPCE061A, the conversion of humidity sensor from capacitance to frequency is realized. After SPCE061A reads the working frequency of feedback circuit, it is converted into capacitance, and the humidity value is calculated according to the capacitance value

Keywords: SPCE061A; Sensors; Humidity; HS1101; Feedback

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 in the conventional environmental parameters, humidity is the most difficult parameter to measure accurately. This is because measuring humidity is much more complex than measuring temperature. Temperature is measured independently, while humidity is affected by other factors (atmospheric pressure, temperature). In addition, the calibration of humidity is also a difficult problem. At present, there are as many as 20 or 30 kinds of humidity measurements detected by people in principle. With the development of the electronic industry in the second half of the 20th century, electronic humidity sensor products and humidity measurement also rose in the 1990s, and made great progress in the later years. The scheme is to use electronic sensors with MCU to realize a humanized moisture meter with voice function

1.1 system parameters

main parameters of the system in this scheme:

working temperature: 0 ~ 70 ℃

working humidity: 0 ~ 100% RH

measurement range: 1% - 99% RH

accuracy: ± 5rh%

1.2 function introduction

this scheme can be realized:

key control to start humidity measurement

measure humidity value by voice playback

humidity judgment, with warm prompts, when the humidity is too high, play "wet, please turn on the dehumidifier", when the humidity is too low, play "too dry, please turn on the humidifier"

2 system hardware design

for the humidity measuring instrument, in addition to having a controller to control the measurement, it also needs a measuring instrument. In this system, SPCE061A is used as the controller, and the capacitive humidity sensor HS1101 is used as the measuring device. A key is used to start humidity measurement and voice playback at room temperature. Since the capacitance cannot be directly connected with the i/o port of SPCE061A for measurement, a circuit module is required to connect with the feedback interfaces 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 block diagram

spce061a single chip microcomputer is used as the main control chip to judge whether to start the measurement according to the read key value. During the measurement, it is responsible for reading the working frequency of the feedback circuit, calculating the capacitance of HS1101 and the humidity of its environment according to the frequency, and playing the humidity through the horn. At the same time, if the humidity value is too high or too low, the system will play a warm prompt

2.1 introduction to SPCE061A chip

spce061a is a 16 bit single chip microcomputer based on'nsp core, and its chip characteristics are as follows:

◆ working voltage: the working voltage of the core VDD is 3.0 ~ 3.6V (CPU), and the working voltage of the i/o port 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 ;

◆ it has the function of key touch wake-up

◆ 32-bit universal programmable input/output port

◆ two 16 bit programmable timers/counters (the initial count value can be preset automatically)

◆ 7-channel 10 bit voltage analog-to-digital converter (ADC) and single channel sound analog-to-digital converter

◆ two 10 bit DAC (digital to analog conversion) output channels

◆ 14 interrupt sources can be input from Timer A/B, time base, 2 external clock sources, and key wake-up

◆ with serial device interface

◆ low voltage reset (LVR) function and low voltage monitoring (LVD) function

◆ built in simulation (ice, in circuit emulator) interface

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

Figure 2.2 internal structure diagram of SPCE061A

2.2 humidity sensor hs1101

2.2.1 introduction to humidity measurement

1. Humidity definition

it is stipulated in the measurement method that humidity is defined as "the quantity of object image state". Humidity in daily life refers to relative humidity, expressed in RH%. In general, that is, the percentage of the amount of water vapor (vapor pressure) in the gas (usually in the air) and the amount of saturated vapor (saturated vapor pressure) under the same condition

2. Humidity measurement methods

from the output parameters of the test, humidity measurement methods are mainly divided into the following categories: wet measurement (expansion method), dry wet ball 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 using the change of physical geometric size. Readers can find relevant materials to further understand these measurement methods. Due to space limitations, I won't repeat them here. The following focuses on the characteristics of the electric humidity measurement method used in this system

3. Characteristics of electronic humidity sensor

electronic humidity sensor has developed rapidly in recent decades, especially in recent 20 years. Humidity sensor manufacturers should use standard humidity generators to calibrate one by one before products leave the factory. The accuracy of electronic humidity sensors can reach 2% to 3% RH

in actual use, due to the influence of dust, oil and harmful gases, aging will occur and the accuracy will decline after a long time of use. The annual drift of humidity sensor is generally about ± 2%, or even higher. Generally, the manufacturer will indicate that the effective use time of one calibration is 1 year or 2 years, and it needs to be recalibrated when it expires

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

the humidity sensor adopts semiconductor technology, so there are requirements for the ambient temperature used. Exceeding the specified temperature will cause damage to the sensor

therefore, the humidity measurement method of electronic humidity sensor is more suitable for clean and normal temperature occasions

electronic humidity sensors are mainly capacitive and resistive

capacitive humidity sensor has the advantages of fast response, small volume, good linearity and stability. 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-cost capacitive humidity sensors sold on the market often fail to reach the above level, and the linearity, consistency and repeatability are not ideal. The deformation of the humidity sensing section below 30% RH and above 80% RH is serious. Some products are compensated and corrected by single-chip microcomputer, which makes the humidity jump "step by step", reduces the accuracy, and has the disadvantages of poor consistency and linearity. No matter the high-grade shutdown of the operator power supply and impact motor source or the low-grade capacitive humidity sensor, the long-term stability is not ideal, and most of the long-term use drift is serious. The humidity sensitive capacitance capacity includes all kinds of infusion tubes, infusion tube drip, implants and other short-term utilization values change to PF level, and the change of 1% RH is less than 0.5pf. The drift change of capacitance value often causes dozens of%rh errors, 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 capacitive humidity sensor HS1101, which is common and suitable for some occasions with low accuracy requirements

2.2.2 introduction to HS1101

1, basic parameters

are shown in Figure 2.3. If there is no special note, the measurement temperature T in the following figure is defaulted α= At 25 ℃, the working frequency of HS1101 is 10kHz during measurement. Figure 2.3 HS1101 parameter diagram

2 and characteristic curve

are shown in Figure 2.4. Measuring temperature T α= At 25 ℃, the working frequency of HS1101 is 10kHz during measurement

figure 2.4 HS1101 characteristic curve

2.3 hardware circuit

2.3.1 SPCE061A minimum system

this scheme uses SPCE061A simplified development board (61 boards) as the minimum system of single chip microcomputer. The 61 board includes SPCE061A chip and its peripheral basic modules, which include crystal oscillator input module (OSC), phase locked loop peripheral circuit (PLL), reset circuit (reset), indicator light (LED), etc., as shown in the following figure

figure 2.5 SPCE061A minimum system

2.3.2 capacitive humidity sensor HS1101 circuit module

because the humidity sensor HS1101 is capacitive, it is impossible to directly read its capacitance by using the single chip microcomputer, but the working frequency of the RC circuit where HS1101 is located can be measured by using the feedback function of SPCE061A, so 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 benchmark of humidity sensor HS1101

as shown in Figure 2.6: according to the parameters in Figure 2.3, in order to make the working frequency of humidity sensor HS1101 as close to 10kHz as possible, select a 620k Ω resistor and HS1101 to form feedback1; The capacitance of 390pf is used as the reference, and another 620k Ω resistor forms feedback2

figure 2.6 capacitive humidity sensor circuit module circuit

2.3.3 key circuit

this system directly uses the keys on SPCE061A simplified development board, and the key circuit on 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 there is a key pressed, in key C file

humidity measurement: initialize the port, measure the humidity and return the humidity value in hum_ Measure. C file

voice play any number: play any integer, which is used to play humidity value in this system. In playvoice C file

interrupt service: the voice playback interrupt service program and irq2 interrupt reading count value program are defined in the m 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 it accordingly according to the measurement results; If the key1 key is not pressed, return to the continue scanning key

note: the quick interrupt FIQ will be turned off before each measurement, because the timer/counter TimerA is used in the measurement process, and the FIQ interrupt is turned on during voice playback, so it needs to be turned off before measurement, so as to prevent the CPU from corresponding FIQ interrupt all the time during the measurement process, causing unnecessary trouble

Figure 3.1 main program flow chart

3.1.2 key scanning module

only one key is used in this system - key1 key on board 61, which is connected with ioa0. The key scanning program flow is shown in Figure 3.2. Using the method of delay deblocking, first take the port data, delay for a period of time, generally delay for dozens of MS, and then take the port data again. If the two are the same, it indicates that the correct key value is taken