28-Smart curtain design based on 51 single chip microcomputer

Specific realization function

The system is composed of STC89C51+1602 liquid crystal + stepping motor + photoresistor + button module + DS1302 clock module + ADC0832 module + power supply.

1. LCD1602 displays date and time, current control mode and light intensity;

2. It can be switched by buttons: manual mode, timing mode, light control mode;

3. Manual mode: control the curtains by opening and closing the curtains;

4. Timing mode: Set the time for opening and closing the curtains by pressing the button;

5. Light control mode: open the curtain when the light intensity is greater than the set value, otherwise close;

6. The stepper motor rotates for a half circle forward to simulate opening the window, and the red LED light is on; the motor reverses a half circle to simulate closing the window, and the red LED light is off.

Key Description: 

Button 1: Switch mode (cyclically switch between manual mode, timing mode, and light control mode)

Button 2: Enter the current time setting (year, month, day, hour, minute setting)

Button 3: Enter the setting of timing time and light control threshold

Button 4: Minus (manually close the curtain)

Button 5: add (manually open the curtain)

design background

Smart home takes residence as a platform, combines construction, network communication, information appliances, equipment automation, and integrates system, structure, service, and management into an efficient, comfortable, safe, convenient, and environmentally friendly living environment. A variety of devices (such as audio and video equipment, lighting equipment, curtain control, air conditioning control, network appliances, etc.) are connected together through a home network. Compared with ordinary homes, it not only has traditional living functions, provides a safe and comfortable family living space, but also provides a full range of information interaction functions to optimize people's lifestyles.

With the acceleration of social informatization, people's work, life, communication, and information are becoming increasingly close. When the information society is changing people's lifestyles and working habits, it also poses a challenge to traditional housing. Advances in society, technology, and economy have caused people's concepts to change dramatically. People's requirements for home are no longer physical space, but more concerned about a safe, convenient and comfortable home environment. 

With the adjustment of the technological industry structure and the rapid development of production technology, people's living standards have been continuously improved, and household electrical appliances have gradually become popular. High-precision, multi-function, and low power consumption are the trends of modern technology development. Under this trend, the digital and intelligent curtains have become the dominant design direction of modern production research. 

The application of single-chip microcomputers in electronic products has become more and more extensive, and the intelligent curtain system combining the photosensitive system and the clock system has a good development prospect.

hardware design

The whole system takes STC89C52 single-chip microcomputer as the core device, and cooperates with the resistance capacitor crystal oscillator and other devices to form the smallest single-chip microcomputer system. The other modules are developed around the smallest system of the single-chip microcomputer. Among them, the display device uses 1602 liquid crystal, which can simultaneously display basic information such as year, month, day, hour, minute, control mode, light intensity, etc.; the clock module uses DS1302 chip, after initialization, it will start to run to calculate the time, and the single-chip microcomputer only needs to Read the time information; the light detection circuit uses photoresistor and analog-to-digital conversion chip ADC0832 to digitize the analog quantity and display it; the curtain uses a stepper motor to replace the analog, and is equipped with an LED light to indicate the current curtain This design also has 5 buttons as operation input devices, which can adjust the current time and set the curtain switch time and light control threshold. Finally, the power supply is commonly used USB 5V for power supply.

software design

Software design idea: Initialize the LCD and clock chip at first, and then enter a cycle of processing. Including reading the date and time data of the clock chip first, and then displaying it on the 1602 liquid crystal, then reading the light intensity and displaying it. The next step is button scanning. If a button is detected, different tasks will be processed according to different buttons. Then according to different modes, different curtain switch controls are carried out. If it is in manual mode, the curtain is controlled by opening and closing the curtain button; if it is in timing mode, the curtain is controlled according to the set opening time and closing time, and if it is in light control mode, then Determine whether the current light is higher than the set control threshold, if yes, close the curtain, otherwise open the curtain. At this point, the process of a cycle is completed.

Schematic diagram

The system schematic design adopts Altium Designer19, as shown in the figure.

program

This design uses KEIL5 software to realize the program design, as shown in the figure.

Simulation implementation

This design uses protues8.7 software to realize the simulation design, as shown in the figure.

All information

All materials include programs (notes), AD schematics, PCB source files, protues simulation, reference papers, program explanations, simulation explanations, simulation videos, schematic explanations, introductions to the use of materials, etc., the most complete network!

For information, please follow the WeChat public account "Electronic Engineer Growth Diary", and reply the key word: "Information"!

Guess you like

Origin blog.csdn.net/weixin_41017942/article/details/114551576