- Home >> Technical Service >> Bluetooth
Intelligent temperature control fan design
Design of Bluetooth data transmission intelligent temperature control fan system
The bluetooth data transmission intelligent temperature control fan system designed in this paper is composed of two STC15F2K60S2 single-chip microcomputers as the master controller and slave controller respectively, using the body temperature sensor module as the temperature acquisition device, and the HC-05 master-slave integrated bluetooth serial port module to send and receive fan files Bit information, through the comparison of the system preset temperature and the body temperature detected by the system, the automatic adjustment of the fan motor speed and automatic start and stop are completed, and the operation of the fan motor is controlled through the triode. And display the fan gear, preset temperature, and detected body temperature on LCD1602 at the same time.
1. The overall design idea of the intelligent temperature control fan system
Use the body temperature sensing module to collect body temperature and output voltage data to the main controller (STC15F2K60S2) for A/D conversion and calculation, and display the current body temperature value, preset temperature limit and fan gear on LCD1602. The preset temperature limit and the detected current human body temperature can be accurate to two decimal places. Send the gear position to the slave role Bluetooth through the master role Bluetooth, and the speed of the DC fan motor is changed by the controller (STC15F2K60S2) according to the gear position using PWM pulse width modulation. The system preset temperature limit is changed by three buttons, the first one moves the position corresponding to the changed limit value, the second one increases the preset limit value, and the third one lowers the preset limit value.
2. Design scheme of Bluetooth intelligent temperature control fan system
This design uses bluetooth wireless short-distance transmission to intelligently complete the temperature control of the fan motor. By adopting the shift and stop control components with high temperature change resolution and stable performance, the fan motor can automatically change the speed and start according to the change of human body temperature. stop.
(1) Selection of temperature sensor: The temperature sensor adopts a body temperature sensing module, which is small in size and only needs one acquisition port to connect to the main controller, plus two positive and negative power supply pins, a total of three pins can work. As long as the human body touches the probe, the module can collect data, and the data can be accurate to two decimal places after the main controller A/D conversion and calculation.
(2) Selection of the controller: The controller uses two STC15F2K60S2 single-chip microcomputers as the master controller and the slave controller respectively, through the method of software programming to convert, calculate and compare the body temperature data, and at the same time output the gear through the serial port of the master role Bluetooth Signal. STC15F2K60S2 single-chip microcomputer contains 2048 bytes of random data memory RAM, high performance, low operating voltage, no external crystal oscillator, affordable single chip, suitable for the design system of this article.
(3) Selection of display device: This design uses LCD1602 liquid crystal display to display temperature, set limit value and gear position. The liquid crystal display can display 16x02 or 32 characters, the power consumption is extremely low, the displayed data is clear and eye-catching, and the programming of the display program is relatively simple. It can display not only numbers but also characters and even graphics, and the displayed characters are beautiful.
(4) Choice of speed regulation method: This design adopts single-chip microcomputer software programming to realize PWM (pulse width modulation) speed regulation method. The most commonly used is the rectangular wave PWM signal. When controlling the speed of the motor, the speed is adjusted by adjusting the duty cycle of the PWM wave. The larger the duty cycle, the faster the speed. By using the software delay method, the high and low level delay time and the cyclic change of the I/O port level are realized to obtain the PWM signal.
(5) Selection of wireless transmission devices: The wireless transmitter uses two HC-O5 master-slave integrated Bluetooth modules as wireless transmission devices. This module can set the master-slave mode to connect and send and receive between the master and slave roles. The HC-O5 master-slave integrated Bluetooth module is easy to operate, low power consumption, and the communication distance is within 10 meters, which is suitable for this design.
3. Software design of intelligent temperature control fan system
The program design has two parts, master controller and slave controller.
4. Software debugging of intelligent temperature control fan system
(1) Debugging of key display: system program written according to this design: the key interface of the program adopts the P2.5, P2.4, P2.3 ports of the main controller, the LCD1602 display data port adopts P0 port, and the RS terminal is connected to P4 .5 port, the RW terminal is connected to the P2.7 port, and the E terminal is connected to the P2.6 port, so as to complete the key function and LCD1602 display. After compiling without errors, and then changing the interface to a simulation debugging interface, the LCD1602 can normally display the upper and lower limits of the preset temperature, the gear position and the temperature given by the program. The button function has also been realized. When the setting key is pressed, the cursor flickers, and when the plus and minus keys are pressed, the number in the blinking cursor can also be added or subtracted by one, and then the setting key is pressed, and the cursor moves to the right (the cursor There are 8 moving positions), modify the upper and lower limits of the temperature.
(2) Debugging of the acquisition part of the body temperature sensing module: Due to the integration of the body temperature sensing module, the adjustment is extremely simple. Its high precision, low power consumption, and small size make it possible to achieve high stability and high precision in controlling the motor. The P1.4 port of the main controller is used as the analog input port. Since the input analog signal needs to be converted and processed by AD to display the body temperature, it is necessary to increase the body temperature conversion program. The continuous detection of human body temperature is completed through software program design, and LCD1602 will display the percentile part of the temperature. Connect this module to the circuit, and LCD1602 will display a temperature, but this is not the ambient temperature. In this design, the module can only detect the temperature of the human body. After people pinch their fingers (or touch other parts of the human body) the probe of this module, LCD1602 can display the currently detected human body temperature.
(3) Debugging of the fan motor speed regulation circuit: This design uses two triodes to drive the fan DC motor. The software sets the P0.0 port to output different PWM waveforms to the two triodes to drive the rotation of the fan motor. The software is set to output different PWM waves according to different temperatures to obtain different duty ratios to control the fan motor. The larger the duty ratio, the higher the gear. The program realizes the PWM waveform output of the P0.0 port. When the temperature of the human body is lower than the lower limit temperature, the fan will automatically stop rotating (0 gear); ) or start to rotate automatically; when the body temperature is higher than the middle limit and lower than the upper limit, the fan rotates at a medium speed (2 gears); when the human body temperature is higher than the upper limit, the fan rotates at full speed (3 gears).
The speed of the fan motor in this design system can be adjusted in four stages, and the speed conversion is completed according to the comparison between the upper and lower temperature limits preset by the system and the temperature detected by the body temperature sensor module. Change the gear information received from the controller in the program, and the fan motor can realize the speed regulation of the corresponding gear.
(4) Debugging of the bluetooth circuits of the master and slave roles: the master controller compares the current gear position with the last time. If the gear position changes, it will send the changed gear position to the slave controller through the master role bluetooth. The role Bluetooth receives the gear information sent by the master role Bluetooth, and then transmits it to the slave controller. When there is a gear to the slave controller, the slave controller will output the PWM wave corresponding to the gear. The gear position is generated on the main controller side (can be known through the display of LCD1602), and then use the serial port assistant to connect the slave role Bluetooth to get consistent gear information, and then connect the slave role Bluetooth to the slave controller circuit, and the fan motor will also The corresponding rotational speed can be achieved.
5. Hardware debugging of intelligent temperature control fan system
5.1 Debugging of key display
The system button part realizes the following functions: press the setting button to connect the button of the P2.5 port of the main controller, and set the upper and lower limit values of the temperature (the LCD cursor moves and flashes); press the plus button to connect the button of the P2.4 port , to realize the addition of one to the value of the blinking cursor; press the minus key, that is, the button of the P2.3 port, to realize the reduction of the corresponding value by one. If the pressing time is too long, the cursor will not move by one position, but will increase by two positions. The main reason is that the debounce delay time of the key is too long, and the corresponding key debounce delay time can be appropriately increased as an improvement method.
This design realizes that the LCD1602 can display the upper and lower limits of temperature, the gear position and the temperature of the human body. The upper and lower limits of the temperature can be adjusted through buttons according to different needs, and the display effect of the LCD1602 is very good and stable.
5.2 Debugging of the temperature acquisition part of the body temperature sensor module
Connect the AD port of the body temperature sensor module to the P1.4 port of the main controller through a square female connector. The four ports on the right side of the main controller are the AD, GND, DC, and VCC ports of the body temperature sensor module. The module can be directly inserted into the header. In order to verify whether the module can work on the main controller board during system debugging, pinch the probe of the module (or other parts of the body) with a human finger, and you can find that the value displayed on the LCD1602 also changes, and it will be when it is stable. Detected body temperature, thus verifying that the module is working properly on the system board. Since the module has only 4 pins, pay attention to the corresponding position of each pin during the debugging process, so as not to reverse the connection and cause the module to fail to work or even burn the module.
5.3 Debugging of fan motor speed regulation circuit
Since the design of the speed control circuit mainly lies in the software design, the peripheral drive circuit simply amplifies the transmitted PWM signal to drive the fan motor to rotate. When the temperature of the human body is higher than the lower limit of the system preset temperature, the motor starts to rotate. Since the temperature of the human body is relatively constant and does not change much, the gear position of the fan motor will not change too frequently. The speed of the fan will change as the gear is switched. When the fingers (other parts of the body) leave the probe of the body temperature sensing module, it is found that the detected temperature first increases and then decreases until it becomes stable. system performance.
6. Intelligent temperature control fan system function
(1) Functions realized by the system: This design can realize the single-chip microcomputer system to detect the change of human body temperature, and according to the change of body temperature, transmit the gear signal through wireless Bluetooth to control the start-stop and speed regulation of the fan DC motor. Different duty ratios are output by the single-chip microcomputer to generate different speeds; different temperature upper and lower limits can also be preset through the buttons, and then the gear is adjusted according to the comparison between the set temperature limit and the detected human body temperature to control the motor speed . When the body temperature is lower than the lower limit of the preset temperature, the motor stops rotating; when the body temperature is higher than the lower limit of the preset temperature, the P0.0 port of the single chip microcomputer outputs PWM signals with different duty ratios to regulate the speed of the fan. The system can also dynamically display the current human body temperature, set temperature limit and gear.
(2) System function analysis: The system is generally composed of two parts: the main controller side and the slave controller side. The main controller side is composed of five parts, namely the main controller (single chip microcomputer), LCD1602 display circuit, body temperature detection module body temperature acquisition circuit, independent button circuit, master role Bluetooth connection circuit; the slave controller side is composed of three parts, that is, the slave role Bluetooth connection circuit, slave controller (single chip microcomputer), fan motor speed regulation circuit. The body temperature acquisition circuit in the human body temperature detection module is the most important part of the whole design system. First of all, the body temperature must be detected, and the gear can be obtained by comparing the master controller with the temperature limit, and the slave controller controls the speed of the DC fan motor through the gear signal; then the master and slave role Bluetooth connection circuit, this part uses the master Communication between roles from Bluetooth. The gear position signal of the master controller is sent to the slave role Bluetooth through the master role Bluetooth, and then transmitted to the slave controller; the second is the fan motor drive circuit, which amplifies and outputs the PWM wave output from the controller through the peripheral circuit. Different PWM wave to get different motor speeds. The circuit design uses two triodes to achieve a better control effect; finally, the dynamic display circuit of LCD1602 realizes the display of the set temperature limit, human body temperature and fan motor gear, and there are independent buttons to realize the temperature limit according to different needs. Adjustment.
Summarize
The designed system uses single-chip microcomputer as the control element, and the gear position is obtained according to the comparison between the human body temperature detected by the body temperature sensor module and the set temperature limit value, and the gear position is transmitted through wireless transmission between Bluetooth, and the fan is realized within a certain distance. Speed adjustment. The design of this system can be extended to the fan motor control system of the family to realize the intelligent control and adjustment of the fan speed, and also realize the monitoring of human body temperature (especially for children and the elderly).
The above is the design scheme of the Bluetooth data transmission intelligent temperature control fan system introduced by Shenzhen Zuchuang Microelectronics Co., Ltd. If you have Bluetooth product design and development needs, you can trust us. We have rich experience in custom development of smart electronic products. We can evaluate the development cycle and IC price as soon as possible, and can also calculate the PCBA quotation. We are a number of chip agents at home and abroad: Songhan, Yingguang, Jieli, Ankai, Quanzhi, realtek, with MCU, voice IC, BLE Bluetooth IC, dual-mode Bluetooth module, wifi 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 research and development of electronic education products.
- TOP