An intelligent control scheme for solar water heater’s functions such as inlet and outlet water, heating and leakage protection is designed and expounded. The purpose is to design a simple, high efficiency and low cost integrated device. This system uses STM32F103ZET6 of TI company as the main controller, and cooperates with temperature detection module, water level detection module, water and heating control module and alarm module to realize the functions of water control, water heating, leakage protection and real-time display. The expected effect is that the designed system can run normally and steadily, and can accurately complete the real-time detection and timely action of the above functions.
The block diagram of the total system is shown in Figure 1. According to the design requirements, STM32F103ZET6 is the core of the whole system, and the hardware circuit composed of comparator LM339, double-pole double-throw relay and single-pole double-throw relay is supplemented by key control, real-time detection and display, alarm and other functions.
The water temperature and water in the water tank are realized. Accurate detection and display of position and precise setting of arbitrary temperature in the range of 40 ~70. The system consists of temperature detection module, water level detection module, water supply and heating control module and alarm module. STM32F103ZET6 single-chip computer is used as the general controller of this subject, and the real-time detection of water temperature is realized through the temperature detection module. In order to control the water level in the water tank according to the predetermined requirements, the method of output threshold voltage of the comparator is adopted, which uses 5V power supply voltage after dividing voltage, and connects the wires at different locations with water after dividing voltage in the process of rising water level. At the same time, when the water level falls below one level, the alarm function is realized by buzzer on the single chip computer. The hardware part of the subject consists of temperature detection module, water level detection module, water supply and heating control module and alarm module. The digital temperature sensor DB18B20 is used. DS18B20 is a commonly used temperature sensor, which has the characteristics of small size, low hardware overhead, strong anti-interference ability and high precision. The range of temperature measurement is – 55 ~125 ~C. No peripheral components are needed in use. The power supply voltage between 3.0V and 5.5V is only needed. After common ground with MCU, the digital quantity of temperature measured is directly output.
The measurement method is as follows: DS18B20 is configured to be 12 bits when it leaves the factory. When it reads the temperature, it reads 16 bits. The first five bits are symbolic bits. When the current five bits are 1, the reading temperature is negative; when the current five bits are 0, the reading temperature is positive. Temperature is read at the right time by converting the hexadecimal number to the decimal number. The disadvantage is that the detection time is long. The schematic diagram of the design circuit is shown in Fig. 3 (b). The comparator LM339 is used as the core component of the water level detection module. After dividing the voltage of power supply 5V, the fourth stage water level is put into the water tank. If the water overflows two wires at the same height, the water will lead two wires to make the comparator LM339 work and light the corresponding LED. The advantages are high performance-price ratio, high swing rate, faster speed and more stable output. The design circuit diagram is shown in Fig.
3 (b).
Double-pole double-throw relay and single-pole double-throw relay are used as main controllers. When the water level reaches the first level, S2 usually opens and closes the contacts. Because the water level has not reached the fourth level at this time, S1 and S3 normally closed contacts are still closed, so the LED 1 light indicates the water intake. When the water level reaches the fourth level, B4 receives the signal from the comparator.
S1 usually closes the contact and disconnects, stops the water intake, and the LED 1 goes out.
When water is needed, the switch S6 is closed, the outlet signal is given to MCU to activate the alarm function. S3 is usually closed, S4 is usually closed, the contact is disconnected, and LED 2 is bright to indicate the water. If the temperature is lower than 40 C, the MCU gives S5 signal to make S5 normally open contacts close. When water is not available, S4 normally closed contacts are closed, and LED 3 is bright to indicate that heating begins. The buzzer is used as the alarm of the alarm module. The principle is the same as scheme one, but better than scheme one, the number of LED lights used in this project has reached 7, thermostatic element if added, it will inevitably be confused. The buzzer’s peripheral circuit is simple. It uses sound alarm to draw people’s attention. Compared with scheme one, the practical effect is better. The design circuit diagram is shown in Fig. 3 (b). The main program design flow chart of this design is shown in Figure 2.
After the main program is initialized by STM32F103ZE, it can display information such as preset water temperature, actual water temperature and water level on LCD screen. If the water level below the second level is detected in the case of effluent, the sound alarm will be given. If the temperature of the water in the water tank is lower than 40 C without effluent, the heating indicator will be turned on. If the temperature of the water in the water tank is lower than 40 C when effluent is produced, the water in the water tank will not be heated until the effluent stops.
At the same time, in the process of adding water at different temperatures, the LCD screen can always display the information of water temperature and water level in real time. In addition, the software part adds the remote control and monitoring function of Android mobile phone app, which can monitor water temperature and water level in real time and increase the practicability of this topic.
The whole system includes hardware and software. The whole design is completed by using STM32F103ZET6 and four-part module hardware circuit as the main idea. The hardware circuit mainly includes temperature detection module, water level detection module, water supply and heating control module and alarm module. The software part includes interruption, AD sampling, key control and LCD display functions. During the debugging process, there are some problems, such as the connector is connected reversely, the chip is not inserted firmly, the chip does not output, the display is disordered after the joint debugging of software and hardware, and the erection and construction of the overall structure. After patiently debugging, the above problems have been solved. The shortcoming of this design is that the water tank used is plastic shell and paper support. Plastic case is not resistant to high temperature, the temperature of 70 C is already limited, which can cause some deformation of the water tank. The paper support water is not large enough to design this topic, but if the water in the tank is more than enough to support the time is not long, and if the water is blistered when discharging, the support effect will be greatly reduced. If time and money permit, we will use glass or other high temperature resistant materials to act as water tanks, using plastic or metal brackets as support. The improvement of this design lies in that the heating control controlled by switch can be changed into that controlled by AC voltage regulation. The digital incremental PID algorithm can reduce the error of setting temperature and increase the adjustability, stability and practicability of heating control.