This design is a project in smart home — Automatic curtains, mainly based on infrared induction and single chip microcomputer control to realize automatic pull of curtain. The article introduces the design scheme as a whole and completes the design of hardware and software of the system.
With the maturity of Internet of Things technology, people’s demand for intelligent life is getting higher and higher. The most important thing in smart home technology is how to identify and process information intelligently. In this paper, an automatic curtain controller is designed with infrared induction module and single chip computer as main modules. This design uses Easy ARM2131 ARM chip as the main control chip, ULN2003A as the driving chip to control the rotation of stepper motor, and displays the rotation mode of stepper motor through MG12864 dot matrix graphics LCD module. Fig. 1 is the overall design block diagram of the system hardware. The common functional devices in this design include Easy ARM2131 development board, ULN2003A driver chip, MG12864 LCD display, four-phase five-wire stepping motor, key switch and other devices. Easy ARM2131 development board uses PHILIPS based on ARM7TDMI-S core, single power supply, LQFP64 packaging LP2131, with JTAG simulation debugging, ISP programming and other functions. [1] GPIO control experiments can be carried out, such as LED scintillation control, keyboard input, buzzer control, analog SPI, etc. External interrupt experiments, learning vector interrupt controller (VIC), timer control experiments, such as timing control of LED, key capture input, matching and comparison output, and UART communication experiments can be completed using RS232 conversion circuit. ULN is an integrated IC, and a diode that eliminates the coil back EMF is also used to drive the relay. It is a dual row 16 pin package, NPN transistor matrix, the maximum driving voltage is 50V, the current is 500MA, the input voltage is 5V, suitable for TTL COMS, and is composed of a Darlington tube driver circuit. ULN2003 high voltage and High Current Darlington transistor array chip, the absorption current can reach 500mA, output voltage 50V, has a strong driving ability [2]. There are 7 sets of Darlington tube circuits, thermostatic element which can drive 7 loads. The input end of IN can be directly controlled by the pin of single chip computer. When the input end is high level, the output end of OUT outputs low level. TH12864-15 is a liquid crystal display module with 128 (column) *64 (row) lattice. When 15 feet are low and 16 feet are high, select the left area of TH12864-15 (64*64 on the left) and the right area of MG12864 (64*64 on the right) when 15 feet are high and 16 feet are low. 19 feet and 20 feet are backlights for the purpose of seeing the display content of LCD in dark environment, that is, adding a light source on the back of LCD.
The control lines R/W, CSI, CS2 and RS must be changed when the enabling line E is low. When enabler E is high, control lines R/W, CSI, CS2 and RS cannot be changed; when enabler E is high, TH12864-15 outputs data from data line DB0 to DB7. The design uses ULN2003A driver chip to drive stepper motor and light emitting diode to display the running state of the program. The design adopts TH12864-15 dot matrix LCD screen and serial connection method.
For the design of the main program, a flag variable is defined. When the rising edge of the level is detected, the motor is controlled to turn forward (Fig. 3), the flag variable is 1. When the falling edge is detected, the person leaves the curtain, controls the motor to turn back and closes the curtain. Two variables are defined to count. In the process of closing the curtain, each time the motor rotates a circle, the corresponding variable is automatically added one.
When the variable reaches the set upper limit, the motor stops turning, that is, the curtain has been completely opened or closed. In this paper, the main function is realized by stepper motor, the display function is realized by liquid crystal 12864, and the driving of stepper motor is realized by ULN 2003 chip, which is easy to use and simplifies the circuit. The operation of liquid crystal 12864 adopts serial communication, which is easy to operate and easy to connect. The detection induction module mainly detects the level jump caused by human motion, that is, someone approaches or leaves the curtain, and then sends the signal to LPC2131 to control the forward and reverse of the motor.