With the continuous development of science and technology, people's production requirements for the surrounding environment are getting higher and higher. For example, crop greenhouses, factories and some large-scale mechanical equipment all need to grasp the temperature and light of working conditions in real time. Traditional manual measurement methods waste manpower and material resources, are inefficient and have poor safety. With the development of single-chip microcomputer technology, people have increasingly adopted single-chip microcomputers to detect and control some industrial control system parameters. At the same time, PCs have powerful monitoring and management functions, while single-chip microcomputers have simple, flexible and fast control characteristics. Communicating with external devices through the RS 232 serial interface of the PC is a commonly used communication solution in measurement and control, so the communication between the PC and the single-chip microcomputer has very important practical significance.
1 Overall design of system hardware
The overall design of the system is based on the design of the upper computer using serial port communication and the single-chip microcomputer environment monitoring system, which consists of three parts: the upper computer, the communication interface and the lower computer. The microcontroller uses STC89 C52; the light sensor uses TSL2561; the temperature sensor uses DS18B20 produced by DALLAS. The single chip microcomputer transmits the data collected by the sensor to the PC through serial communication. The PC displays the acquired data in real time on the monitoring screen, and also displays the temperature curve and light curve in real time. The overall structure of the system is shown in Figure 1.
1.1 Control module function
The main control board uses a STC89C52 as the controller. STC89C52 is a high-performance CMOS 8-bit single-chip microcomputer, which contains 8 KB of repeatedly erasable FLASH ROM and 256 B of RAM.
STC89C52 has excellent performance and low cost, and is very suitable for this system. The main function of the core control module STC89C52 is to process the data collected by the sensor, transmit it to the host computer through the RS 232 serial communication interface, and display the data in real time on the LCM12864 LCD screen. When it is automatically determined that the collected data is higher than the set value, the relevant buzzer is immediately activated to complete the alarm function.
1.2 Serial communication module
This module uses RS 232, which is a serial physical interface standard formulated by the American Electronic Industry Association EIA (Electronic Industry Association). It uses asynchronous transmission and is characterized by simple use and low price. It transmits the data collected by the single-chip microcomputer to the host computer to realize remote monitoring. [page]
TSL2561 is a high-speed, low-power, wide-range, programmable, and flexible light intensity digital conversion chip launched by TAOS. It is a light-to-digital converter. The microcontroller obtains the values of CH0 and CH1 channels from the TSL2561 through the I2C bus, converts the collected digital signals into optical units of lux through software calculation, and finally converts the light intensity into a digital signal for output. The light intensity algorithm is as follows:
1.4 Temperature acquisition module
DS18B20 is a digital temperature sensor that provides 9-bit binary temperature readings. It has a single-line structure, and the information is sent to or output from DS18B20 via a single-line interface. In this design, the upper limit of the high temperature alarm value can be set by yourself. When the temperature is higher than the set value, the buzzer is activated to prompt the user to take appropriate measures.
1.5 Display module
The display module uses LCM12864 liquid crystal display. The module has a built-in font library, which is easy to connect, has high display quality, and is low cost. It mainly displays the collection of system light intensity information and temperature information, as well as the timer count value, for overall debugging and on-site viewing of the system.
1.6 Serial port software module
Under VC 6.0, the built-in MSComm control can be used to realize serial port communication between the microcontroller and the PC, and RS 232 can be used to receive data. Here, select com1 port, the baud rate is 9 600 b/s, and the data is retrieved in binary mode. The main code is as follows:
1.7 Data storage module
After completing data reception, the data must be stored in the Access database. The variables in the database completely correspond to the received data. Create a database bia o. Mdb in Access 2000, add support for ODBC database, add #include
1.8 Host computer data reading and curve display module
Through software VC 6.0 programming, the collected data is displayed on the PC as a curve. This module is written using the teechart8 control that comes with VC 6.0. This control has a good function of drawing real-time curves and is easy to operate. The host computer detection interface is shown in Figure 2.
[page]
2 System software design
The MCU part of this design adopts modular design and is written in C language through the μVision 4 compiler developed by Keil. It mainly includes light intensity acquisition, temperature acquisition, LCD display, and serial port sending module programs. The host computer part is written in VC++ language under VC 6.0 environment, including serial port communication, database storage and curve drawing modules. The main program flow charts of the upper and lower computers are shown in Figures 3 and 4.
3 Conclusion
Based on STC89C52, this paper provides an agricultural greenhouse light and temperature detection system in the VC 6.0 environment. Its light sensor TSL2561 and temperature sensor DS18B20 are both high-precision measurement sensors, which is a detection system with high precision and remote monitoring. The upper computer interface is a friendly dynamic curve observation, which allows users to easily view and record data. At the same time, the lower computer of this design can also realize multi-point measurement and control, with strong expansion capabilities, high cost performance and strong practicality.
Previous article:Disable C51 compiler from compiling power-on clear code
Next article:Design scheme of intelligent cluster control fire emergency indicator light
Recommended ReadingLatest update time:2024-11-17 01:49
- Popular Resources
- Popular amplifiers
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Single-chip microcomputer technology and application - electronic circuit design, simulation and production (edited by Zhou Runjing)
- Principles and Applications of Single Chip Microcomputers 3rd Edition (Zhang Yigang)
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!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- 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
- Huawei employees complain: After working for 16 years, I only earned a house worth 14 million yuan
- Switching Power Supply Interest Group 10th Task
- Design of traffic light controller based on single chip microcomputer
- R5F1056A Device file not found
- AVR's experience in dog training
- Short circuit protection circuit!!!
- FPGA Verilog Problems
- Help! How to view the pin definition in the Keil file for the STM32F103C8T6 chip?
- Popular Science丨Six Elements of Brushless DC Motor Control
- Play with HDMI2.1 source test