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 also increases the service life of the equipment, can 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 about the room, such as temperature, date, etc. 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 functions
The system uses a single-chip microcomputer to control the DS12C887 clock chip to accurately measure the time, uses DS18B20 (1-Wire) to connect to the single-chip microcomputer to realize temperature acquisition, 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 is automatically turned off, allowing the air conditioner to be used. Under normal circumstances, when the time reaches 7:00 (the time can be adjusted manually by independent buttons), the start music is automatically played and the main power is turned off to test the temperature in the room. When the time reaches 21:55, the end music is played, and the entire system is turned off at 22:00. When controlling the power supply 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 as entering, and vice versa. Using a photoresistor, the lighting circuit can be turned on when the indoor brightness is lower than the normal requirement and there are people. 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 lamps 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 Mandatory status
This state is to transmit data from the computer switchboard (host computer) to the single-chip computer (lower computer). The host computer and the single-chip computer are connected together, and the single-chip computer is controlled 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 turned off, or a specific power supply can be turned on as required. The single-chip computer can be queried by inputting instructions, and the number of laboratory personnel can be displayed on the host computer screen in real time.
2 System Hardware Design
2.1 Hardware composition and function of each device
The hardware core components of the intelligent laboratory control system are composed of a single-chip microcomputer STC89C52 chip, an E18-B03N1 reflective infrared photoelectric switch, a music chip, a single-bus temperature sensor DS18B20, a clock chip DS12C887, and a 12864 LCD with a font library. Among them, the E18-B03N1 reflective infrared photoelectric switch adopts a reflective type, and the adjustable distance of measurement is greater than 30 cm. There are 3 pins, 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 is still running, with a clock timing function, and the alarm can be set at a specified time within 24 hours. DS18B20: a single-bus temperature sensor, which reads the temperature signal in real time with an 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.
(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 that 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 to turn on the lights and close the laboratory table according to the number of people required.
(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 will sound an alarm through the speaker and the external circuit will be disconnected. If someone enters again, the external circuit (lighting circuit and experimental 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 no one is in the laboratory or the computer is forcibly shut down, the single-chip microcomputer (10) does not work.
(5) Use LCD 12864 (14) to connect 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) Using the DS12C887 clock chip (14) (in the case of power failure, the DS12C887 clock continues to run) allows 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 starts to sound, an external interrupt (12) is sent, the music player 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 closing 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 by 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°C. The use of air conditioning is allowed.
2.3 Multi-MCU Communication System
STC89C52 is connected to an RS 232/485 converter to form a standard PC-MCU communication interface, which enables multiple MCUs to communicate with the PC serial port, and PC (host computer) to communicate with multiple slave computers (MCU) serially. The host computer and the MCU strictly implement the master-slave structure of the responsive communication control mode, with the host computer as the master and the slave computer as the slave. The slave cannot actively send commands or data, and everything is controlled by the host. At any time, the host only transmits information to one slave, and the slaves cannot communicate directly. In a multi-machine communication system, the host sends commands to each slave by name to achieve the master control of the system. While executing the task, the host must continuously poll the slave to monitor the status of the slave, receive the request of the slave or send a command to the slave. In order to control the lighting circuits and power supply of multiple laboratories and experimental tables 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 input, the number of people in a single microcontroller is transferred to the host computer, and the number of people in the laboratory is queried in real time.
3 System Software Design
The single laboratory software control system is mainly composed of two single-chip microcomputers. The processes of single-chip microcomputer 1 and single-chip microcomputer 2 are shown in Figures 2 and 3.
3.1 Working principle of single chip microcomputer 1
(1) Use two E18-B03N1 infrared photoelectric switches (respectively marked as A and B) and connect them to the external interrupt ports P3.2 and P3.3 of the microcontroller in 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 an interrupt of the microcontroller. In the corresponding interrupt program, the number of people is calculated by adding 1, and at the same time, the interrupt enable of INT1 is turned off in the program, so that INT1 will not trigger an interrupt and start delaying. After a certain period of time, the interrupt enable of INT1 is turned on using the timer interrupt; Go out - when someone leaves the classroom
When the infrared photoelectric switch B light is blocked first, the INT1 terminal receives "0" first, triggering the single-chip interrupt, reducing the number of people by 1, and at the same time turning off the INT0 interrupt enable in the program, and starting the delay, after a certain period of time, using the timer interrupt to turn on the INT0 interrupt enable. 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 on the lower computer, the number of people can be stored in the SBUF register of the microcontroller and queried by 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 laboratory power supply.
3.2 Working principle of single chip microcomputer 2
Microcontroller 2 mainly queries the indoor temperature in real time through DS18B20, and uses LCD display to judge 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 an independent button) and displays it through the LCD. Because the chip only contains one alarm interrupt, the DS12C887 chip interrupt and 89C52 single-chip hybrid control are used. 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 turn it off. 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 the laboratory has achieved the above basic functions well, 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; it does not take into account the front and back doors (that is, the communication problem of the two single-chip microcomputers). These problems need to be further improved in the future.
Previous article:Intelligent Control System of Washing Machine Based on AT89C52 Single Chip Microcomputer
Next article:ISP brief introduction AT89S series microcontroller ISP principle analysis
- Popular Resources
- Popular amplifiers
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
- Gesture-Based Capacitive Touch Speaker Interface Reference Design
- 【NXP Rapid IoT Review】+ Development Kit Demonstration and Hardware Familiarization
- TI Live | How to make industrial communications more reliable? Take a look at this cost-optimized solution!
- How to fill in the PCB footprint of Cadence device?
- STM32F4 NVIC_SystemReset() function software reset fails due to external pull-up resistor on RST pin
- How to connect CC3200 to Gizwits Cloud
- MSP430Fr6972--AD usage summary
- 【Child care machine】+ ESP32-S3-BOX+ESP32-S3-DevKitC-1 material unpacking and BOX basic demonstration
- [Free trial of Pingtouge Bluetooth Mesh Gateway Development Kit] + nRF Mesh and Light Experiment (Part 2)
- PCB learning