Design and Research of Intelligent Remote Control Fan Based on Single Chip Microcomputer and Bluetooth Technology

. This paper is designed for intelligent remote control fans. The design of the microcontroller as the core, the sensor, Bluetooth and Andrews system applied to the design of intelligent remote control fan. According to the temperature sensor to achieve the indoor temperature collection, to achieve and set the temperature comparison, thus affecting the fan speed. At the same time, the system according to the infrared sensor components to detect external factors, in order to achieve the running or stopping of the fan, that is, to achieve intelligent control of the fan. In addition, the system achieve the Bluetooth and mobile phone Andrews system of effective combination, and through the software program to complete the fan remote operation and wind speed control.


Introduction
With the rapid development of society, the fan as a common household appliances, also often applied to the elevator system. Most of the common fans use manual operation to control speed or control switch, only according to the actual operation of the fan to complete the control, the indoor temperature cannot be detected, appear frequently where is empty, the fan is still open, this not only wastes resources, but also reduces the fan's life. If the fan can be based on the presence or absence of timely operation or stop, and can detect the Elevator interior temperature, according to set temperature to adjust the fan speed, will make the fan more humane. These assumptions are applied to the control system of the fan, thus realizing the intelligent fan [1][2][3].

Overall design
In view of the shortcomings of the current control system of the fan, the design idea of the intelligent fan is proposed to achieve the fan speed control of the refinement and humanization. When the room temperature reaches or exceeds artificially set temperature and detects someone, then the fan is automatically opened, And change the size of the wind speed according to the change of the temperature; when the temperature is lower than the artificial temperature or when nobody exists, the fan will automatically stop.
Through the analysis of the fan control system, the overall design method of intelligent fan is put forward. This design mainly implements the following functions: (1) Wind speed control function: According to the set temperature to achieve the motor speed control, adjust the wind speed of the fan, to achieve better cooling effect.
(2) Remote control function: through the mobile phone Andrews client and Bluetooth technology for remote control of the fan speed, operation, stop and other operational status.
(3) Real-time temperature display function: real-time monitoring of the current ambient temperature through the sensor, and through the display terminal shows the current indoor temperature and the set temperature, according to reference the indoor temperature, user-friendly set the temperature at which the fan is on [4][5][6][7].
System overall design block diagram shown in Figure 1, the hardware consist of the STC15F2K61S2 microcontroller, infrared temperature sensor and Bluetooth devices. Through the infrared temperature sensor to detect the existence of people, and the STC15F2K61S2 microcontroller get the person's information, then control fan to start or stop, while the fan starts to detect the current room temperature and display on the monitor. Through the Bluetooth module connected Andrews client to the fan, transmit the corresponding information to control the fan, to achieve remote control of the fan.

SCM control module
Intelligent remote control fan use STC15F2K61S2 microcontroller as the core controller to control and coordinate the normal operation of the entire system. DS1302 clock real-time module to achieve real-time display temperature and timing function, STC15F2K61S2 microcontroller receiving the accurate time information through the DS1302 to control timing program, and complete the remote control intelligent fan timing system.
The pins of X2 and X1 of the DS1302 external crystal oscillator circuit to generate the reference clock signal, through the frequency to get accurate second signal, to achieve the timing function, thereby improving the stability and efficiency.

Temperature detection feedback and display module
Select the DS18B20 temperature sensor to achieve real-time temperature detection. By shielding or detecting the reflected beam, the photoelectric sensor cycle scan to collect human infrared information, when detect the information of the human and reach the set temperature, the external information is transmitted to the STC15F2K61S2 single chip microcomputer, and which control to open the fan instructions. When a person's presence is detected and the state lasts for a long period of time, the fan automatically turns off to conserve energy.
Through an input line DQ achieve to information transfer between DS18B20 and the DOI: 10.1051/ , 03011 (2017) microcomputer, a 10K ohm resistor in series, then connect the input to the P13 port of the microcontroller and transmit the temperature information. The OUT pin of the photoelectric switch connect to P32 pin of microprocessor. The reset pin RST of LCD5110 connect to the P14 port, DIN pin as the data input connect to P17 port [8][9][10][11][12][13].

Motor control module
Controlling the motor is an important aspect of the overall control system. which achieves the control of the fan speed. STC15F2K61S2 chip contains PWM module, obtain temperature information from the DS18B20, according to the different set temperature, output different PWM to L298N, the driver module L298N will have a different PWM and speed corresponding to it, then change the terminal voltage, in other words, the fan drive voltage changes, which will be transmitted to the fan can control the fan speed, obtain to the set temperature, the fan speed is almost close to the infinitely variable speed.
OUT1 and OUT2 of L298N, as the fan data input and output, IN + and IN-are connected to the power and ground, and the EN pin connect to the microcontroller P13 port, by receiving the microcontroller output PWM signal to control the motor speed [14].

Bluetooth technology control module
Implant Bluetooth module and Andrews client in the design, so that people can remotely remote control the fan. The TXD side of the Bluetooth module is connected to the RXD terminal in the microcontroller, and the RXD terminal in the Bluetooth module is connected to the TXD terminal in the microcontroller. The Bluetooth module is operated by two-way communication to the chip and the handset, and transmitted to the microcontroller via Bluetooth Of the data, and receive feedback from the Bluetooth phone [15].
The Bluetooth module is operated by both hardware and software, you can control the fan through the mobile phone operation, Not only can achieve the timing of fan work, you can also set the temperature control fan speed.

Design of the software program
In order to realize the intelligent control of the fan, the main program of the system consists of module initialization program, infrared photoelectric display program, Bluetooth control program, temperature detection program and LCD display program and so on. The main program flow chart shown in Figure 2. After the DS18B20 has initialized the data, it starts to measure the temperature and set the corresponding parameters. The internal temperature processing system calls the corresponding control program to make internal judgment, output the data and display it through the LCD. Digital temperature sensor module program flow chart shown in Figure 3.

Initialize The system
Initialize DS18B20  The microcontroller STC15F2K61S2 controls the DS1302 by calling the corresponding driver programs. The program completes the definition of the address of the DS1302 register and writes the control words, and reads the data in the DS1302 register. Initialization of DS1302 causes SCLK to be low, and when set to high, data transfer begins. I / O line data on the rising edge of SCLK is sent to the DS1302, write DS1302 program flow chart shown in Figure4  The protocol of host control interface is the interface between the host's HCI driver and the control host located between the firmware of the Bluetooth communication module, which is included in the Bluetooth protocol stack and used in the hardware part of the Bluetooth communication module. RTS / CTS is used to prevent temporary UART buffer overflow. Bluetooth data transceiver system program flow shown in Figure 5.

System debugging
According to the system circuit schematic manual welding circuit, and implante the program into system. Turn on the power, start the fan switch, adjust the fan running mode, so that it works in the general mode that is the normal fan of the manual speed mode, by adjusting the fan gear, change the fan speed. Start the second mode of operation that is intelligent mode, through the Bluetooth technology for remote control, the monitor shows the current room temperature of 25 , set the temperature abover than the room temperature, the sensor detected the information of pepole , turn on the fan. If the room temperature is belower than the set temperature, the fan stops rotating, which plays a very good temperature control.

Summary
The intelligent fan in the system can be adjusted speed according to the temperature changes, but also according to the presence of room to the conver the switch; Combined with Bluetooth technology, install Andrews client that specially designed for this fan, you can achieve the remote control. The microcontroller process the data, and compare set temperature and indoor temperature, determine whether the fan is turned on, in order to determine the fan speed corresponding self-set temperature.
Will be applied to the elevator design process, can play a ventilation, cooling and energy saving role.