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
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.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
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.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
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]
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
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
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]
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
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
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
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)
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
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
- TMS320C665x program loading and burning based on emulator
- 31 "Millions of Miles" Raspberry Pi Car——Ubuntu MATE System Installation
- ABB six-axis robot and Siemens 1500PLC user manual
- [Ateli Development Board AT32F421 Review] 7. Kuga registers jointly light up OLED
- Design and FPGA implementation of digital on-screen display control core.pdf
- EL817C Optocoupler Transmission Ratio Problem
- Keysight Technologies N9020A 3.6G spectrum analyzer special sale: 8500/unit
- STM32+photosensitive sensor+serial port receiving light intensity source program is successfully produced
- How does the uart.write function output three bytes of 0XFF 0XFF 0XFF (HEX data, not string data)?
- Electric vehicles use silicon carbide power devices to successfully move out of the laboratory