Shenzhen ZTRON Microelectronics Co., Ltd
Telephone
0755-8299 4126

MCU

Single-chip intelligent curtain system


Design of intelligent curtain control system based on single chip computer


After entering the 21st century, with the continuous development of various technologies, the combination of theoretical knowledge and real life has become closer and closer, and people's living standards have continued to improve. At the same time, the application of more and more intelligent technologies has also made People's privacy security has been greatly violated, so people pay more and more attention to the security of their own privacy, and as a necessary curtain in a family residence, it is very useful for protecting residents' privacy and blocking external light. Most of the traditional curtains on the market now need to be opened and closed manually, which is not only laborious, but also may miss the best light time, so the intelligent control of curtains is very important and effective.


1. Design scheme of intelligent curtain control system


The design is mainly to realize the light control curtain system, which includes three functions of light control, timing and manual. Therefore, it is necessary to connect these control elements with various interfaces and MCU. Apply AT89C52 series MCU design system, install ADC0832 chip, VS1838b, ULN2003 chip, etc., to control the opening or closing of curtains under different light conditions. Button scanning module, infrared remote control module, photoresistor, stepping motor, AT89C52 together constitute the design system. Use photoresistors to collect analog signals and convert them into digital information through the analog-to-digital conversion A/D circuit, and use this to control the stepper motor to rotate clockwise or counterclockwise to simulate the opening and closing of the curtains. The automatic light control opening and closing of the curtains is completed by the principle of light control. When the external light intensity reaches the upper limit of the system's internal preset value, the curtain is opened; when the external light intensity reaches the system's internal preset value lower limit, the curtain is closed. is closed. Based on the above working principles, the realization of the design system is not only low cost, but also convenient and quick.


In addition, the automatic opening and closing of the curtains can also be preset through the time or directly start and close the curtains by pressing the button. The system has many advantages, the structure is relatively simple, the system is stable, and it is not easily disturbed by the external environment.


2. Hardware design of single-chip intelligent curtain control system


2.1 Main program module


The system uses AT89C52 single-chip microcomputer crystal oscillator circuit, the so-called quartz crystal oscillator is the crystal oscillator in the single-chip microcomputer circuit. The crystal oscillator is usually a capacitor and a resistor connected in parallel and then a capacitor in series. There are two resonance points. The resonance is connected in series for low frequency; the resonance is connected in parallel for high frequency. The crystal oscillator can provide a pulse signal to the microcontroller, which is the working speed of the microcontroller. The crystal oscillator will be connected to the X1 and X2 pins of the single-chip microcomputer. At this time, this circuit will generate harmonics, and the existence of harmonics will affect the stability of the oscillator. In order to solve this problem, we connect a ceramic chip capacitor to the pin of the crystal oscillator. This capacitor is generally selected at 10 to 50 pF and needs to be grounded. The crystal oscillator used in this design is a 12MHz quartz crystal.


2.2 Button module


The function of the button module in this design is to close the curtain regularly by pressing the button or directly control the opening or closing of the curtain by pressing the button in addition to the automatic lighting curtain. This design requires the use of 5 independent buttons. The functions they realize respectively are setting key (setting the opening and closing time of automatic light control curtain); digital value plus key; digital value minus key; start curtain key (the curtain is opened after pressing this key); close curtain key ( The curtain is closed after pressing this button).


2.3 Photosensitive and AD conversion module


The automatic light control opening and closing curtain system is to open or close the curtain in time according to the change of external light, and the photoresistor is responsible for completing the required functions of this part. The photoresistor is very sensitive to the external light intensity value, and has a direct effect on the change of the resistance value. The resistance value is negatively correlated with the light intensity, the resistance value decreases as the intensity increases, and vice versa, the resistance increases.


ADC0832 is an 8-bit successive approximation analog-to-digital converter. It can be replaced with TLC0832, which has two input channels that can be multiplexed. The serial output can be configured as a standard shift register or microprocessor interface, and its multiplexer can be configured as a single-ended or differential input by software. The differential analog voltage input can suppress common-mode voltage, but the input reference voltage cannot be adjusted. , has been connected to VCC internally. The ADC0832 chip has four data connection lines, which are respectively connected to the microcontroller, which are the CS chip selection terminal; the CLK chip clock input terminal; the DI data signal input terminal; the DO data signal output terminal. When the single-chip microcomputer communicates, the DI and DO terminals are bidirectionally connected to the single-chip microcomputer and they cannot work at the same time, so the two ends are connected in parallel to a data line in the circuit.


When the data at both ends are displayed as 1 and 0 respectively, the CH0 pin realizes single-channel conversion. The CH1 pin performs single-channel conversion when the 2-bit data is 1, 1. The CH1 pin and the CH0 pin are respectively used as the negative input terminal IN- and the positive input terminal IN+ when the data display is 0 and 0. When the two bits of data are displayed as 0 and 1, the polarity of the positive and negative input terminals of CH1 and CH0 changes. If the third pulse sinks, the DI terminal will lose its input function before the third pulse comes. Use DO/DI to output data to output DO. Use the DO terminal to output DATA7 of the conversion data when the fourth pulse sinks. The DO terminal will always input data before the D0 terminal sends out the lowest bit data DATA0, and the output data is before each pulse sinks. After receiving DATA0 data, this byte of data is output. Then output the opposite byte data. Set the CS chip selection enable pin to a high level, and the chip cannot be used at this time. The input voltage of the AD conversion chip is 0 to 5V, and this voltage is only applicable when it is used as a single-channel analog signal. Its voltage accuracy is 19.53mV at eight-bit resolution. When used as positive and negative input terminals, the voltage value of a larger range value should be predetermined and used to improve the conversion accuracy.


2.4 Stepper Motor Design Module


The stepper motor is an open-loop control device, and the angular displacement is obtained through the conversion of its electric pulse. The frequency and number of the pulse signal will affect the rotation of the motor. For example, when a pulse signal is sent to the driver of the stepper motor, it can make the motor rotate a certain angle in the forward or reverse direction we assumed earlier, and we call this angle the step angle. Stepper motors can be started and stopped very quickly. Stepper motors are mostly used in circuits with higher precision due to the relationship between speed and step angle, and these are only related to the frequency of the pulse.


The seven pins of ULN2003 are connected with the microcontroller P1.0~P1.7. Install the pin header next to the ULN2003 chip, which is the five-wire interface of the motor, for connecting the stepper motor. The 5V power supply is directly connected to the first pin port of J4. Connect with the motor, directly drive the motor forward and reverse to simulate the opening and closing of the curtain. Stepper motors include single-phase motors and multi-phase motors, both of which are synchronous stepper motors. A single electric pulse can drive a single-phase motor, which is generally used to drive a tiny circuit due to its low output power. Stepper motors are very suitable for microprocessor control mainly because they can directly receive digital quantities.


2.5 Display some modules


In this design, LCD1602 is used to display real time, opening and closing time of curtains, and light intensity value. The time displayed on 1602 can be adjusted by buttons, and the time of opening and closing curtains can be set by buttons, which can be displayed in real time on 1602; The light digital value collected by us can be displayed through 1602. P0 is used as the connection of the data port here, and it is connected with pins 7 to 14 at 1602, and the write data or write command is transmitted on the connection line. Moreover, a pull-up resistor must be added to the connection of the line. Pin 4 of LCD1602 is the RS register selection terminal, which can be used to select data or commands; pin 5 of LCD1602 is the R/W read-write control terminal, which can decide whether to read data or write data, and it is connected with the P2.0 port of the single-chip microcomputer chip ; The six pins of LCD1602 are E enable signal terminals, which can control whether the device works, and are connected with the P2.2 port of the single-chip microcomputer chip. In this design, a rotary potentiometer is used to adjust the brightness of the 1602's backlight.


3. Software Design of Intelligent Curtain Control System


The functions that the main program of this system needs to complete include: the initialization operation of each module of the single-chip microcomputer, the setting of the initial value of the timer, turning on the motor, displaying the digital quantity of time and light, etc. The function of the whole system is realized by calling the sub-functions of each module through the main function void main().


Summarize


The system design adopts the minimum system design of AT89S52 single-chip microcomputer. It controls the opening and closing of the curtains by controlling a reversible DC motor, and uses remote control and light control to make the curtain system intelligent, which is in line with the current development direction of smart homes. It can make the concept of intelligent life get better promotion.


The above is the design process of the intelligent curtain control system based on the single-chip microcomputer introduced by Shenzhen Zuchuang Microelectronics Co., Ltd. for you. We have rich experience in customized development of smart electronic products, can evaluate the development cycle and IC price as soon as possible, and can also calculate the PCBA quotation. We are the agent of Sonix MCU and Yingguang MCU agent, selling and developing MCU and voice IC solutions of Sonix and Yingguang. We act as an agent and develop ICs and solutions of Jieli, Ankai, Quanzhi, realtek and other series, and also develop BLE Bluetooth IC, dual-mode Bluetooth module, wifi module, and Internet of Things module. We have hardware design and software development capabilities. Covering circuit design, PCB design, single-chip microcomputer development, software custom development, APP custom development, WeChat official account development, voice recognition technology, Bluetooth development, wifi technology, etc. It can also undertake the research and development of smart electronic products, the design of household appliances, the development of beauty equipment, the development of Internet of Things applications, the design of smart home solutions, the development of TWS earphones, the development of Bluetooth earphone speakers, the development of children's toys, and the development of electronic education products.


  • TOP