Design of multifunctional measurement system based on STC12C5A60S2

Publisher:Yuexiang666Latest update time:2013-01-25 Source: 电子技术 Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
0 Introduction
   
With the development of electronic technology, residents generally use electronic thermometers or thermometers that come with perpetual calendars to measure indoor temperature. However, with the increasing severity of environmental pollution and the improvement of people's requirements for quality of life, people are gradually paying attention to the detection of indoor humidity, carbon dioxide concentration and light intensity. However, so far, there is no suitable and applicable instrument for home-type detection of humidity, light intensity and CO2 concentration. The traditional method in small warehouses is to use test equipment such as hygrometers, bimetallic measuring meters and humidity test papers to conduct manual detection and ventilate, dehumidify and cool down warehouses that do not meet the temperature and humidity requirements. This manual testing method is time-consuming, labor-intensive, inefficient, and the test temperature and humidity have large errors and randomness. Therefore, we need a temperature and humidity measuring instrument with high cost performance.
    This paper designs and develops a novel, convenient, practical, and simple-structured multifunctional measuring instrument, which is suitable for places such as homes, warehouses, and greenhouses where environmental detection is required. The design displays the monitored results through LCD, and users can effectively adjust related equipment according to the monitoring results to achieve an ideal environmental state.

1 System Design
1.1 Design Task
   
This paper implements a multifunctional measurement system based on STC microcontroller, which can realize the functions of humidity detection, temperature detection, CO2 concentration detection, indoor light intensity detection, and time and date display. The measurement range of humidity is 20~90%RH; the detection range of temperature is -55~+125℃; the measurement range of CO2 concentration is 350~10000ppmCO2; the measurement range of indoor light intensity is 0~2500lux; the system displays the current time and date, and the current time and date can be modified by pressing keys.
1.2 Design scheme and working principle
   
The multifunctional detection system includes: power module, controller, temperature detection module, humidity detection module, illumination detection module, CO2 concentration detection module, clock module, keyboard input module, LCD display module. As shown in Figure 1.

a.JPG


    This control system uses the STC12C5A60S2 single-chip microcomputer as the control core. The single-chip microcomputer has the characteristics of high speed, low power consumption, and super strong anti-interference, and has 8-channel 10-bit precision AD conversion; temperature and humidity detection is realized by digital temperature detection sensor DS18B20 and humidity detection sensor DTH11. Since the digital sensor outputs digital quantities, data processing is relatively simple, and these two sensors have a high cost performance; the clock module uses the more commonly used DS1302 clock chip, and the communication between the controller and the clock chip is realized to obtain the comparison More accurate time value, in addition, the clock can be calibrated by key operation; the detection of illumination and CO2 concentration is more complicated. Since the output signal of silicon photocell and CO2 detection sensor is a weak analog signal, it is necessary to condition the small signal obtained, and send the conditioned signal information to the AD port of the single-chip microcomputer to obtain the digital quantity that the single-chip microcomputer can process; all test results and date and time are displayed by LCD; since the amplifier in the signal conditioning circuit adopts dual power supply, the power module uses AC 220V to ±5V power module. 2

Hardware Circuit Design
2.1 Control Circuit
   
The control circuit of the system is the minimum system composed of STC12C5A60S2 single-chip microcomputer as the control core. In addition, in order to facilitate program downloading, a program download interface circuit based on CH340 is designed, and the circuit diagram is shown in Figure 2.

b.JPG


2.2 Detection circuit
   
According to the different output signals of sensors, they can be divided into digital sensors and analog sensors. Different signal types lead to different detection circuits.
2.2.1 Temperature and humidity detection circuit
   
Since both the temperature sensor DS18B20 and the humidity sensor DTH11 are digital outputs, the detection circuit is very simple. In order to prevent the appearance of uncertain signals, a 4.7k pull-up resistor is required at the output end of the signal, as shown in Figure 3.

c.JPG[page]

2.2.2 Illuminance and CO2 concentration detection circuit
   
Since the light detection uses silicon photocells, the signal is a small analog output, so the signal needs to be conditioned. The output of the CO2 sensor MG811 is also a small analog voltage signal. Its parameters are shown in Table 1.

d.JPG


    The principle of measuring light intensity by silicon photocell is the photovoltaic effect, that is, it is a semiconductor device that directly converts light energy into electrical energy. From the characteristic curve of silicon photocell, it can be seen that the output current of photovoltaic cell is more linear than the output voltage, so its current characteristic is detected here. From the experimental test, it can be obtained that the indoor light intensity is generally 0-2500 lux. At this time, the output current of silicon photocell is about 0-0.15mA. A 100 Ω resistor is connected in parallel at both ends of the silicon photocell, and the output voltage at this time is about 0-15mV.
    In order to condition the small signal into a signal suitable for single-chip microcomputer processing, the small signal is amplified and filtered. First, the small signal is amplified and processed, and a high input impedance differential amplifier is used here. Secondly, the signal output by the amplifier passes through a second-order active low-pass filter. Finally, the signal enters the AD port of the single-chip microcomputer. The signal conditioning circuit is shown in Figure 4.

f.JPG


    (1) Difference amplifier circuit
    Because R3=R4, R6=R8=R7=R9 in the circuit, the total gain of the two-stage differential mode can be derived as follows:
    e.JPG
    Usually, the gain of the first stage should be as high as possible, and the gain of the second stage is generally 1 to 2 times. Here, the first stage is selected as 100 times and the second stage is 1 times. Then R6=R7=R8=R9=10KΩ is selected, and good matching is required. Generally, metal film precision resistors are used, and the resistance value can be selected between 10KΩ and several hundred KΩ. Then
    g.JPG
    first determine R5, which is usually within 1 to 10kΩ. Here, R5=1kΩ is selected, and R3=99R1=49.5 kΩ can be obtained from the above formula.
    Take the nominal value of 51kΩ. Usually, R1 and R2 should not exceed R5/2. Here, R1=R2=510Ω is selected to protect the op amp input stage.
    A1 and A2 should use op amps with low temperature drift and high KCMRR, and the performance consistency should be good.
    (2) Active low-pass filter circuit
    Since the input and output signals of the filter circuit are DC signals, the cutoff frequency selected in the calculation is 3Hz. The filter capacitor C1=C2=1 μF.
    i.JPG
    From formula (3) and (4), we can get R=53078 Ω, A0=2, so here we take R10=R11=51k.
    The actual amplification factor of the signal after the signal conditioning circuit is A=200. For the CO2 sensor, according to the different input signals, choose appropriate R3 and R4, and the gain of its signal conditioning circuit is 80.
2.2.3 Clock module
   
This design uses a high-performance, low-power real-time clock chip DS1302 launched by Dallas, USA. The chip uses the SPI three-wire interface to communicate synchronously with the CPU, and can use burst mode to transmit multiple bytes of clock signals and RAM data at a time. The real-time clock can provide seconds, minutes, hours, days, weeks, months and years. It can automatically adjust when a month is less than 31 days, and has a leap year compensation function.

i.JPG


    The working voltage is as wide as 2.5~5.5V. It adopts dual power supply (main power supply and backup power supply), and the backup power supply charging mode can be set, providing the ability to charge the backup power supply with a trickle current. The circuit connection is shown in Figure 5.

3 Software Design
3.1 Software System Design
   
The system software mainly consists of two parts: data acquisition and data display. When the system is powered on, the system is first initialized; then the flag is judged to determine whether the clock is currently set. If yes, the clock is adjusted by the key. If not, all data is collected and processed accordingly; finally, the collected data is displayed on the LCD. The system program block diagram is shown in Figure 6.

j.JPG


3.2 Partial detection software design
   
For light intensity detection and CO2 concentration detection, there is a conversion from analog to digital, so the accuracy of the AD converter needs to be considered. In order to obtain a more accurate detection value, the 10-bit AD conversion interface of STC12C5A60S2 is used here, that is, its accuracy is 1/(210-1).
    For light intensity detection, the output voltage after the signal conditioning circuit is 0~3V, and the corresponding light intensity is 0~2500lux. Assuming that the value after AD conversion is A, the corresponding light intensity at this time is E, as shown in formula (5).
    k.JPG
    Simplified: E=(12500×A)/3069. Therefore, the detection of light intensity can be realized through program writing.

4 Conclusion
   
A multifunctional measurement system based on STC12C5A60S2 is designed. Through theoretical analysis, actual circuit welding and related program writing, the physical object is designed. Through testing, the functions of temperature and humidity detection, CO2 concentration detection, indoor illumination detection and clock display are realized. The experimental results are good, and the measurement accuracy is within the actual calculation error range.

Keywords:MCU Reference address:Design of multifunctional measurement system based on STC12C5A60S2

Previous article:What are the maskable interrupts of MSP430?
Next article:Design of welding temperature measuring instrument based on single chip microcomputer

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

A simple dialing keyboard based on 51 single chip microcomputer and 8-bit digital tube
We know that when dialing, each time a digit is dialed, the previously dialed digit must be moved one position to the left. We can use a one-bit array to achieve position movement by moving the numbers in the array and dynamically scanning the 8-bit digital tube. code show as below: #include "reg52.h" //This file
[Microcontroller]
Application of μPSD32xx microcontroller in tax controller
Abstract: μPSD32xx is a SoC microcontroller integrating 51 cores and PSD (Programmable System Device). It has many functional components and is cost-effective. It is widely used in tax control equipment such as tax control cash registers, tax controllers and micro printers. middle. This article introduces the main feat
[Microcontroller]
Allegro MicroSystems launches high-bandwidth current sensor technology to help enable high-performance power conversion
New high-power-density sensors reduce energy losses while improving efficiency and reliability of SiC and GaN technologies Manchester, New Hampshire, USA - Allegro MicroSystems (hereinafter referred to as Allegro), a global leader in sensing technology and power semiconductor solutions for motion control and ener
[sensor]
Allegro MicroSystems launches high-bandwidth current sensor technology to help enable high-performance power conversion
Study 32-bit Cortex-M3 MCU development technology
This article introduces the LM3S9B96 MCU Cortex-M3 processor block diagram and the main features, block diagram, circuit diagram and expansion board circuit diagram of the Stellaris? LM3S9B96 development board. Texas Instruments (TI) Stellaris? provides a series of microcontrollers are the first ARM? CortexTM-M3-bas
[Industrial Control]
Study 32-bit Cortex-M3 MCU development technology
Application of single chip microcomputer in power system monitoring
At present, in the microprocessor as the heart of microcomputer protection, high-performance single-chip microcomputers (such as Intel's 87C196CB, 87C196CB, 78C196NT), digital signal processors DSP (such as TI's TMS320F2812) and programmable logic devices PLD (such as Xilinx's XC9572) are generally used to improve the
[Microcontroller]
Application of single chip microcomputer in power system monitoring
Section 10: (II) VB MSCOMM control communicates with the microcontroller to realize temperature display
     In the previous section, the MCU program processes the collected temperature data and sends it out through the serial port. This section specifically explains how to use VB6.0 (Enterprise Edition) to call the MSComm control to receive, process and display data. The first step is to open the VB software, as show
[Microcontroller]
Section 10: (II) VB MSCOMM control communicates with the microcontroller to realize temperature display
51 MCU-button usage
1. Connect with life The common practice of pressing buttons is just like the induction cooker in life. Press the "+" button on the induction cooker and release it immediately, and you will find that the number on the induction cooker has increased. Now we plan to use the development board to switch the state of th
[Microcontroller]
51 MCU-button usage
Energy-saving microcontroller design enables 20-year battery life
When designing a battery-powered product, it is obvious that one would like the battery life to be as long as possible. As a rapidly growing category of devices, applications that grow from a single battery are not just about the specifications: they revolve around the entire product concept. Energy-sensitive produc
[Security Electronics]
Energy-saving microcontroller design enables 20-year battery life
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号