Research on laboratory intelligent control system based on single chip microcomputer principle

Publisher:cangartLatest update time:2012-05-23 Source: 现代电子技术 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
In the 21st century, energy issues are becoming increasingly prominent, and energy conservation and environmental protection have become a major factor that must be considered in many designs. This design aims to effectively improve the utilization rate of laboratory lighting and various power sources. It uses infrared counting to provide corresponding lighting and power supply in different situations, avoiding waste such as turning on multiple sets of lights when there are few people, using multiple sets of instruments, and forgetting to turn off instruments when people leave. While saving energy, it can also increase the service life of the equipment, effectively achieve the purpose of automatically shutting down the power supply, and effectively prevent fires. At the same time, the system can also display detailed information such as room temperature and date. The system can be used in libraries, classrooms, conference rooms, and as a central control device in large public places.

1 System overall design and function
The system uses a single-chip microcomputer to control the DS12C887 clock chip to accurately count, uses DS18B20 (1-Wire) to connect to the single-chip microcomputer to realize temperature collection, and displays the clock and indoor temperature on the LCD chip 12864 to control the temperature. When the temperature reaches 25℃, the air conditioner power supply is automatically closed, allowing the use of air conditioning. Under normal circumstances, when the timing reaches 7:00 (the time can be adjusted manually by independent buttons), the starting music is automatically played and the main power supply is closed to test the temperature in the room. When the time reaches 21:55, the ending music will be played, and the whole system will be shut down at 22:00. When the power is controlled at ordinary times, the system will have two working states: automatic control state and forced state.
1.1 Automatic control state (default state)
Two infrared sensors are installed at the door of the laboratory, set to 1 and 2 respectively. When a person passes through 1 first and then 2, it is set to enter, otherwise it is set to leave. Using photoresistors, when the indoor brightness is lower than the normal requirement and there are people, the lighting circuit can be turned on. When someone enters the laboratory in dark weather (or at night), the system controls the switch of the power supply of the laboratory table and the closing state of the lighting circuit through a relay. When the number of people is 1 to 10, one of the lights in the laboratory is turned on, and the power supply of 5 laboratory tables is closed and available for use; when the number of people is 10 to 20, 2 lights are turned on, and 10 laboratory tables are available for use... According to the number of people entering the laboratory, the number of available laboratory tables and the number of fluorescent lights turned on when the weather is dark are intelligently determined. When the number of people becomes zero again, 20 minutes later, the horn alarms, the relay is closed, the lights go out, and the power supply of all the opened laboratory tables is disconnected. Until someone enters again, the relay is closed and the power supply of the laboratory table is closed again. When the indoor lighting is sufficient, the lighting circuit does not work and the power supply of the laboratory table can be controlled.
1.2 Forced state
This state is to transmit data to the single-chip microcomputer (lower computer) through the computer switchboard (host computer). Connect the host computer and the single-chip microcomputer together, and control the single-chip microcomputer through serial communication to achieve the purpose of controlling the amount of power used in the laboratory. The laboratory lighting circuit and the laboratory table circuit can be fully connected, fully off, or a specific power supply can be turned on as required. The single-chip microcomputer can be queried by inputting instructions, and the number of laboratory people can be displayed on the host computer screen in real time.

2 System hardware design
2.1 Introduction to hardware composition and functions
of each device The hardware core components of the intelligent laboratory control system are composed of single-chip microcomputer STC89C52 chip, E18-B03N1 reflective infrared photoelectric switch, music chip, single bus temperature sensor DS18B20, clock chip DS12C887 and 12864 LCD with font library. Among them, the E18-B03N1 reflective infrared photoelectric switch adopts reflective type, and the adjustable distance of measurement is greater than 30 cm. There are 3 pins in total, one for power supply, one for ground, and the other for data line. When there is no induction closure, the data line is high level, and when someone passes by, the data line becomes low level. DS12C887: clock chip, when the power is off, the internal clock still moves, with clock timing function, and can set off alarms at a specified time within 24 hours. DS18B20: single bus temperature sensor, real-time reading of temperature signal, accuracy of 0.5℃.
2.2 Working principle and introduction of each part of system hardware
The hardware block diagram is shown in Figure 1.

a.jpg [page]

(1) Using a single chip microcomputer (2) to control the circuit, the infrared photoelectric switch (4) is connected to (P3.2, P3.3) in the form of an external interrupt (8), and the digital tube (6) displays the number of people in the laboratory at this time.
(2) When the number of people entering the laboratory is not zero, the external power supply circuit (5) controls the relay through the single chip microcomputer, and according to the number of people required, the lights are turned on and the laboratory table is closed.
(3) When the number of people becomes zero again, the single chip microcomputer timer (7) is used to time for 20 minutes. If no one enters within 20 minutes, the music piece will alarm through the speaker and the external circuit will be disconnected. If someone enters again, the external circuit (lighting circuit and laboratory table power supply circuit) will be closed by the single chip microcomputer according to the number of people.
(4) The single chip microcomputer (10) can be powered by the single chip microcomputer (2) and the relay control power supply. When there is no one in the laboratory or the computer is forced to shut down, the single chip microcomputer (10) will not work.
(5) LCD 12864 (14) is connected to the single-chip computer (10), and the LCD displays the following information: "Laboratory control system", year, month, day, week, hour, minute, second and temperature.
(6) DS12C887 clock chip (14) is used (in the case of power failure, the DS12C887 clock continues to run) to achieve accurate timing, and the current time can be adjusted by independent buttons. At the set specific time at night (such as: 21:53:20), the alarm alarm is given, an external interrupt (12) is sent, the music disc plays music (15) and delays power off, and starts playing music at the set specific time in the morning (such as: 7:00), and delays the closing of the main power supply on the mains line. At the same time, when the alarm time is reached and the music sounds, the music can be turned off in four ways: 1. manual button, 2. timer (11) reaches the set time of 20 minutes, 3. The number of people is zero, and 4. The host computer forces power off and turns off the music. At the same time, the above time can be adjusted by the independent button of the single-chip computer, which can determine the time in a more humane way.
(7) DS18B20 (16) detects the temperature, displays the temperature in the laboratory on the LCD, and turns off the air conditioning power when the temperature is higher than 25℃. Air conditioning is allowed.
2.3 Multi-chip computer communication system
STC89C52 is connected to an RS 232/485 converter to form a standard PC-chip computer communication interface, so that multiple single-chip computers can communicate with the PC serial port, and the PC (host computer) can communicate with multiple slave computers (single-chip computers) via serial ports. The host computer and the single-chip computer strictly implement the master-slave structure in the form of responsive communication control, with the host computer as the master and the slave computer as the slave. The slave computer cannot actively send commands or data, and everything is controlled by the host computer. At any time, the host computer only transmits information to one slave computer, and the slave computers cannot communicate directly with each other. In a multi-computer communication system, the host computer sends commands to each slave computer by calling the name to realize the master control of the system. While executing tasks, the host must continuously poll the slave to monitor the status of the slave, receive requests from the slave, or send commands to the slave. In order to control the lighting circuits of multiple laboratories and the power supply of the laboratory table in real time. According to the requirements, the on and off of the circuit outside the laboratory, the on and off of the power supply at a specific location, and the real-time query of the number of people in the laboratory are forcibly controlled and displayed on the PC screen. That is, when the command is entered, the number of people in a single microcontroller is transferred to the host computer to query the number of people in the laboratory in real time.

3 System software design
The single laboratory software control system is mainly composed of two single-chip microcomputers. The process of single-chip microcomputer 1 and single-chip microcomputer 2 is shown in Figure 2 and Figure 3.

b.jpg

[page]

c.jpg


3.1 Working principle of single chip microcomputer 1
(1) Two E18-B03N1 infrared photoelectric switches (respectively marked as A and B) are connected to the single chip microcomputer external interrupt ports P3.2 and P3.3 in the external interrupt mode. When someone enters the classroom, infrared switch A is first blocked, and the INT0 terminal first receives the low level "0" generated by the infrared switch, triggering the single chip microcomputer interrupt. In the corresponding interrupt program, the number of people is calculated by adding 1, and the interrupt enable of INT1 is turned off in the program, so that INT1 will not trigger the interrupt, and start the delay. After a certain period of time, the interrupt enable of INT1 is turned on by the timer interrupt; Go out - when someone leaves the classroom
, the infrared photoelectric switch B light is first blocked, and the INT1 terminal first receives "0", triggering the single chip microcomputer interrupt, and the number of people is reduced by 1. At the same time, the interrupt enable of INT0 is turned off in the program, and the delay is started. After a certain period of time, the interrupt enable of INT0 is turned on by the timer interrupt. Finally, the number of people in the laboratory at this time is displayed through the digital tube. The working status of the external circuit is determined according to the real-time number of people.
(2) When the upper computer queries the number of people in the lower computer, the number of people can be stored in the SBUF register of the microcontroller and queried through the upper computer.
(3) The upper computer can control the lower computer to use relays through level conversion to achieve the purpose of controlling the power supply of the laboratory.
3.2 Working principle of microcontroller 2
Microcontroller 2 mainly queries the indoor temperature in real time through DS18B20, uses LCD display, and judges that when the temperature is greater than the specified temperature (such as 25℃), the air conditioner switch is allowed to close. At the same time, DS12C887 reads the real-time time (the time can be adjusted through independent buttons) and displays it through LCD. Because there is only one alarm interrupt inside the chip, the DS12C887 chip interrupt and 89C52 single chip are used for mixed control. When a specified alarm time is reached, the microcontroller rewrites the new alarm time until the new alarm time takes effect, and then writes the first alarm time again to achieve the effect of dual alarm timing. When the alarm rings at night, in order to leave enough delay time, the microcontroller timing method is used to delay a specific time (such as 20 minutes). At the same time, considering that different laboratories have different requirements for sound, the manual button and the upper computer forced method are used to close it. When the number of people is zero, or the delay time is reached, all the circuits in the laboratory are closed. Until the alarm is turned on the next day, the external circuit is closed again.

4 Conclusion
Through practice, the intelligent control system of this laboratory has better realized the above basic functions, and has been approved by the head teacher of our school's microelectronics laboratory, and is being applied to our school's microelectronics laboratory. However, due to the rush of time, there are still some shortcomings. For example, when two people squeeze through the door, the infrared device cannot detect it; the front and rear doors are not considered (that is, the problem of communication between the two microcontrollers). These problems need to be further improved in the future.

Reference address:Research on laboratory intelligent control system based on single chip microcomputer principle

Previous article:Design of a new electric bicycle speed control system based on C8051F313
Next article:Application of single chip microcomputer technology in data collection and monitoring process

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号