In this paper, a portable intelligent fan controller system based on STM8 single chip computer, sensor technology and battery charging technology is proposed. The hardware and software design of the mobile intelligent fan control system is discussed, and it has been successfully applied to the occasions where ventilation and cooling need to be carried out through the fan. The system can automatically adjust the speed of the fan according to the real-time temperature detection around the fan. It can be powered by municipal electricity or by lithium batteries to meet the needs of energy saving and has the function of power reminder. The system meets the needs of ventilation and cooling occasions, and the use effect is good. With the rapid development of science and technology, the acceleration of industrialization and the deterioration of the environment, the temperature difference between indoor and outdoor is increasing, and the demand for ventilation and cooling is increasing. At present, the development of single-chip computer technology, sensor technology and battery technology makes it more feasible to cool indoors through the ventilation of DC fans. Compared with air conditioning, this scheme not only saves the hardware cost, but also saves the operation cost. In order to be able to work under the condition of power outage without increasing the load of power supply in the occasion of power outage, it is required not only to use 220 V AC to provide DC power through step-down rectification, but also to use lithium battery as standby power supply to ensure that the fan can continue to work at low speed at the time of power outage. This design uses temperature sensor (thermistor) to detect ambient temperature, then transfers analog temperature signal to digital temperature signal and transmits it to SCM chip STM8 for processing. By comparing the preset temperature, it automatically changes the speed of fan motor and even stops working when the temperature is lower than the set temperature. It also gives the system fan. The battery can also be charged when the fan is working, and the alarm is added when the battery is low, so that the fan can use the stored power in the battery to work continuously when the power is out. The control system is composed of hardware and software.
The hardware structure is the core of the whole system. It is also the focus and difficulty of the design. The performance of the hardware design largely determines the performance of the whole system. In terms of hardware, the control system consists of STM8 MCU, sensor module, motor drive module, 220 V step-down rectifier module, charging module and keyboard module. The system structure is shown in Figure 1.
STM8 MCU: STM8S is an 8-bit microprocessor with high performance-price ratio. It has its own core. It has the advantages of more powerful functions, simple programming and high performance-price ratio. 128 KB Flash program memory, 640 KB RAM data memory, internal integrated EEPROM up to 300,000 erasure cycles, with 16-bit universal timer, powerful I/O function, has a very strong ability to withstand backfilling current, 32-foot packaging chip has a maximum of 28 I/O, including 21 high absorption current outflow. Sensor module: In this design, a thermal sensor is used. It is a device that changes with the change of temperature. Its signal and temperature response are an exponential curve. Motor Driving Module: To make the fan work, it is necessary to provide the motor with controllable driving current. In the circuit, the driver module L9110 with simple interface, easy operation, high reliability and strong anti-interference is adopted.
The L9110 module can directly drive two motors or two parallel motors to get larger driving. Power.
Step-down rectifier module and charging module: In this design, lithium batteries are used as energy source without electricity. In order to make the batteries work normally and charge and discharge safely, it is necessary to design charging and discharging module and protection module in the circuit. The design of this module circuit is good or bad, which plays an important role in the service life of batteries. The control system consists of STM8 MCU controller, sensor interface circuit, motor drive interface circuit, power supply step-down rectifier, charging interface circuit and keyboard interface circuit. The main hardware circuit design is shown in Figure 2. The motor drive module uses L9110 integrated chip to drive the fan’s DC motor. L9110 integrated chip, which can drive two motors at the same time, each motor is controlled by an I/O port of the single chip computer. The output of the I/O port of the single chip computer is 5V TTL signal. The two-channel push-pull power amplifier IC devices are separated in the integrated circuit monolithic Ic and the input of two TTL/CMOS compatible levels. At the same time, it has a lower input level. The built-in clamp diode with output saturation voltage drop can release the reverse impulse current of inductive load, making it safe and reliable in driving relays, DC motors, stepper motors or switching power transistors. The boost power supply based on LM2577-ADJ is a boost switching power regulator. LM2577-ADJ has a built-in converter that can control boost, flyback and forward functions. The required external components are relatively small and easy to use, as shown in Figure 3. The protection circuit module of lithium battery is shown in Fig. 4. The overcharge protection control principle of FS8205A protection circuit is that when the battery is normally charged, the voltage of the battery increases with the increase of charging time. When the voltage of the battery rises to 4.4V, the DW01 chip will process that the battery voltage has been overcharged, and will immediately disconnect the output voltage of the third leg, 8205A. The inner switch is closed because the fourth leg has no voltage.
The battery will stop charging. The protective circuit is always overcharged and maintained.
When the discharge load is connected to the output of the protective board, the switch in FS8205A will be closed, so that the voltage of the battery will be lower than 4.3 V, and the output of DW01 will be high, so that the built-in control tube of FS8205A will be turned on, so that the battery can be charged and discharged normally. The charging circuit module is shown in Fig. 5.
TP4056 is a complete single lithium ion battery charger with positive and negative pole back connection protection and constant current/constant voltage linear control. Because of the internal PMOSFET architecture and anti-backcharging circuit, there is no need for external isolation diodes. Thermal feedback can automatically adjust charging current to control chip temperature under high power operation or high ambient temperature. The charging voltage is fixed at 4.2V, and the charging current can be set by an external resistor.
TP4056 will automatically terminate the charging cycle when the charging current reaches 1/10 of the set value after reaching the floating charging voltage. When the input voltage is withdrawn, TP4056 will automatically enter a low current state, reducing the leakage of the battery to less than 2 mu A. TP4056 features battery temperature detection, undervoltage blocking, automatic recharging and two LED lights for charging and ending. When the red light is on and the green light is off, it is charging. When the red light is off, the green light is full. When the red light goes out and the green light goes out, it’s a fault. The red light is flashing and the green light is battery-free. The main flow chart of the control system is shown in Figure 6. After power-on reset in Figure 6, the MCU initializes, thermostatic element then starts temperature detection, judges according to the results of detection, if the temperature is higher than the set upper limit, opens the fan, and automatically adjusts the PWM output of the MCU to change the fan speed, if the detected temperature is lower than the set lower limit, closes the fan. The main interface program is as follows. Driving motor module L9110 is a good motor driver chip. In order to control fan speed, PWM wave is output through PD3 and PD4 ports to realize motor speed control.
Keyboard, display and other modules are the channels of human-computer interaction. The module is connected with single-chip computer through PB. The main program code is more, which is limited to the length of the page. It is omitted here.
This paper designs a movable intelligent fan controller based on STM8 single chip computer, sensor technology and battery charging technology.
The system can automatically adjust the speed of the fan according to the real-time temperature detection around the fan. It can supply power not only by municipal power, but also by lithium batteries to meet the needs of energy saving. The overall function of the control system is realized to meet the needs of ventilation and cooling through fans. After debugging, the system is tested and tested under various conditions, even in high temperature, high humidity, high dust and frequency vibration environment, it can still work normally. Although this control system is mainly designed for ventilation and cooling occasions, it can be applied to ventilation, constant temperature, heat preservation and other occasions. It can also be widely used in large-area crop production environment regulation, and even for toxic and harmful environment control. It is economical and convenient, and has great market promotion value.