introduction
Temperature and humidity are the main environmental parameters of industrial and agricultural production. It is of great significance to measure them accurately and timely. Using a single-chip microcomputer to control temperature and humidity has the advantages of high temperature and humidity control accuracy, strong functions, small size, low price, simplicity and flexibility, which meets the process requirements very well. This article introduces the intelligent method of temperature and humidity detection and control using the AT89S52 single-chip microcomputer.
Basic system plan
This system uses AT89S52 single-chip microcomputer as the control core. The collected humidity analog voltage signal is analyzed and processed through ADC0809. A/D conversion is realized so that the digital tube can display its humidity value. This design can manually set the upper and lower limits of temperature/humidity. If any of them does not meet the set value, that is, the temperature/humidity is too high or too low, the system will issue a voice alarm and the relay will immediately cut off the power supply to achieve system protection.
2 Hardware System Composition
(1) Main control module: AT89S52 single-chip microcomputer is used as the controller of the system. Port P1 controls the digital tube to display the temperature and humidity values. Port P2 is connected to ADC0809. The humidity analog voltage is converted into digital quantity for easy processing by the single-chip microcomputer. The keyboard control uses port PO. Among them, PO.0 is the temperature setting, PO.1 is the humidity setting, and PO.2/PO.3 are used to set the upper/lower limit values of temperature and humidity respectively. P0.4 is the connection port of DS18820 temperature sensor. PO.6 is the connection port of ISD1420 voice chip. The principle is shown in Figure 1:
(2) Display module: The system uses dynamic display mode to drive 6 digital tubes, of which 4 digital tubes are used to display temperature values and 2 are used to display the detected humidity values. The input end of 74LSl38 is used to select the bit code. The P1 port of the single-chip microcomputer controls the break code of the digital tube. If the detected temperature and humidity change, the digital tube will change accordingly, playing a real-time display function. The circuit is shown in Figure 2.
(3) Voice broadcast module: It uses voice chip ISD1420, which can complete high-quality sound recording and restoration. The maximum recording time is 20 seconds, and it has segmented recording function. Its operating voltage is in the range of 4.5V to 5.5V, and it uses direct level/edge storage technology, eliminating the need for A/D and D/A conversion. It integrates a large-capacity EEPROM, no longer requires extended memory, and is easy to connect to the microcontroller. The voice broadcast module circuit is shown in Figure 3.
The S3 key of this circuit is the recording key, the S1 and S2 keys are the play keys, and the A0-A7 are the address selection terminals. Connecting the A0-A7 of ISD1420 directly to the P1 port of the microcontroller can realize the recording address selection function, and then connecting the play key to the P0.6 port to realize the real-time playback function controlled by the microcontroller. The power supply VCCA and VCCD use different power buses for the internal analog and digital circuits, but because the interference of this chip is small, the two can be short-circuited together.
(4) A/D conversion module: ADC0809 conversion chip is used to realize the conversion from analog quantity to digital quantity. Since there are many types of analog conversion circuits, the A/D converter is selected from the aspects of speed, accuracy and price. It has 8 analog selection switches inside. And the corresponding channel resistance latch decoding circuit, the conversion time is about 128μS, and it is powered by a single power supply.
(5) Temperature and humidity acquisition module: The temperature sensor uses the intelligent temperature sensor DS18B20 produced by DALLAS Semiconductor. The collected data can be directly sent to the microprocessor without A/D conversion. The measured temperature can be directly read. It only needs 1 interface line to realize two-way communication with the microprocessor; only 1 4.7k pull-up resistor is needed. No other external devices are required. This system uses data line power supply for DS18B20, and the temperature measurement range is -50℃~125℃. Through programming, 9-12-bit digital value reading mode can be realized, and the measurement accuracy is ±0.5. The user can set the upper and lower limits of non-volatile alarm. Because of the single bus mode, multiple DS18B20 can be connected to the control bus to detect the temperature of different parts. The humidity sensor uses HSM-20G. Its principle is that the value increased by 1% for every 0.03V change in humidity. The output voltage value needs to be converted into digital quantity by ADC0809 so that the single chip microcomputer can process it so that the digital tube can display the humidity value. Its operating voltage range is DC voltage 5.0±0.2V, the test accuracy is ±5%RH, the operating current (maximum value) is 2mA, the storage environment humidity range is 0 to 99%RH, the working environment humidity range is 10 to 90% (can reach 100%RH instantly), and the working environment is 0℃~50℃.
(6) Relay control circuit: Electromagnetic relays have the advantages of simple structure, reliable operation, durability, and low price. They are widely used and are the most typical and commonly used relays. This circuit uses a normally closed relay controlled by a single-chip microcomputer. When the temperature or humidity is abnormal, the relay starts to work and the switch cuts off the power supply, and the small light goes out, thereby protecting the system. The circuit is shown in Figure 4.
3. System software design
The software design of this system adopts assembly language programming. After the temperature/humidity is collected and processed accordingly, the digital tube can display the current temperature and humidity values in real time. The output voltage of humidity collection needs to be converted into digital quantity by ADC0809 before it can be processed by the microcontroller. The voice broadcast only needs to be connected to the I/O port of the microcontroller and its interface line can be programmed to complete. The overall program flow is shown in Figure 5.
4 Conclusion
The detection system uses the single-chip microcomputer AT89S52 as the core to realize the detection and control of temperature and humidity. It is reliable, simple to operate, high in precision and fast in response. At the same time, the temperature and humidity values after passing through the control system are intuitively displayed through the LED digital tube. When an abnormality occurs, a warning is issued through the alarm device and it is handled in time. It meets the needs of the site and has a wide range of application prospects.
Previous article:12864 LCD display C language programming example
Next article:Stepper Motor Program
Recommended ReadingLatest update time:2024-11-16 15:37
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
- Please recommend a low voltage drop Buck chip
- [DFRobot motor driver] + DC motor driver Arduino example program analysis
- Buck high-side driver (PMOS)
- 28377 GPIO Module
- Common PCB Layout Pitfalls
- 2.4G Sync
- Single line mounting 16 DS18B20 sensors 51 program
- Take a look at the antique filter
- Mobile phone RF is moving towards integrated chips
- EEWORLD University ---- Make your home safer - Intelligent building security system