In order to meet the requirements of automatic control of water-falling solar water heaters, a water temperature and water level controller based on PIC16C72 single-chip microcomputer is designed. NTC thermistor is used as temperature sensor, and the voltage drop on NTC thermistor is converted into digital quantity by built-in multi-channel 8-bit A/D converter of PIC16C72 to realize temperature measurement. The equivalent resistance of water level sensor is converted into the frequency of oscillation signal by asymmetric multivibrator circuit, and then the frequency is measured by built-in counter of PIC16C72 to realize water level measurement. The working principle, complete hardware circuit and function of the controller are introduced. The design omits temperature measurement signal conditioning circuit, dedicated A/D conversion and output decoding driver chip, and has the characteristics of simple hardware system composition and good reliability.
Solar water heaters are rapidly entering thousands of households due to their advantages of energy saving, environmental protection, and low cost. The water temperature and water level controllers that are matched with solar water heaters are very convenient for users to use. The product has a good market prospect and is widely valued and studied. However, the water temperature and water level controllers currently used still have many shortcomings, such as unreasonable button function design, the need to reuse buttons, user operation cannot be separated from the manual, and the operation instrument is complicated, which brings a lot of trouble to users; the selected water temperature sensor parameters and measurement circuits are unreasonable, and are easily damaged by thermal breakdown; the water level sensor
The device is prone to scaling or cracking, has many faults, short service life and high maintenance cost. So far, there is no water temperature and water level controller with good quality at home and abroad. In view of the above problems, in order to make the controller more comprehensive and practical, easier and more intuitive to operate, improve the reliability of the sensor and reduce the maintenance cost, the author combined PIC microcontroller and NTC thermistor sensor technology to design a controller suitable for falling water solar water heaters.
1 System structure and working principle
The controller is mainly used to measure and display the water level and water temperature in the water tank of the fall-type solar water heater, the temperature of the upper and lower water pipes, control the water supply of the solenoid valve, control the auxiliary electric heating and the antifreeze electric heating belt of the pipeline, etc. It mainly consists of a single-chip microcomputer PIC16C72, a water tank temperature and pipe temperature sensor, a water level sensor and a measurement circuit, an input key, a water flow switch, a solenoid valve control, an electric heating control and an electric heating belt control. The block diagram of the controller is shown in Figure 1. The single-chip microcomputer PIC16C72 is the core of the control, and controls various parts of the system by executing the program. The water level measurement module realizes the measurement of the water level of the water tank, and the temperature measurement module realizes the temperature measurement of the water tank water temperature and the upper and lower water pipe temperature. The three-way control output controls the water supply solenoid valve, the electric heater and the antifreeze electric heating belt through the relay. The LED part displays the water level of the water tank, the water temperature of the water tank and displays related parameters. The key part is used to select the working mode, set related parameters, and manually control the water supply or electric heating. The water flow switch is used to measure the water use status.
Figure 1 System structure diagram
2 System Hardware Design
The controller designed is based on the single-chip microcomputer PIC16C72 as the control core, and the circuit of the controller is shown in Figure 2. The single-chip microcomputer PIC16C72 has two counters, a built-in five-channel 8-bit A/D conversion module, and a 2K OTP program memory. The method of measuring the water level here is to use an asymmetric multivibrator circuit to convert the equivalent resistance of the water level sensor into the frequency of the oscillation signal, and the built-in counter of the single-chip microcomputer counts the frequency to achieve the water level measurement. The water temperature of the water tank and the temperature of the upper and lower water pipes are measured by using thermistors and fixed resistors in series to divide the voltage, converting the temperature change into the change of the voltage drop on the thermistor, and using the multi-channel 8-bit A/D conversion module in the single-chip microcomputer to perform A/D conversion on these two temperature voltage signals, and then read and process them by the program. The program controls the PORTB port to be used as the keyboard input port and display output port in a time-sharing manner.
Figure 2 Controller hardware circuit
2.1 Water level measurement
The long-term reliability of the water level sensor is the key to water level measurement. In the early days, semiconductor pressure sensors were used to measure water levels. However, scale blocked the water pressure transmission pipe and the sensor was abandoned after a period of use because it was not suitable for measuring water level. Here, an asymmetric multivibrator circuit is used to convert the water level signal into a frequency signal as a water level measurement method. In Figure 2, the asymmetric multivibrator consists of 74HC04 and capacitor C5, resistors R3, R19, R22 and the equivalent resistance Rw of the water level sensor. The oscillation frequency of the circuit is 1/[2.2 (R19 + R22 + Rw) C5]. Here, several resistors are connected in series, and water level detection electrodes are led out at the leads between the resistors as a water level measurement sensor. Since water is conductive, changes in water level can cause a short circuit between the water level detection electrodes, which will change the size of the equivalent resistance Rw of the water level sensor, thereby changing the oscillator frequency. After being isolated by the NOT gate, the signal is output from the pin 6 of the 74HC04 to the pin T1CKI of the microcontroller, and the frequency of the oscillation signal is counted by the on-chip counter T1 of the PIC16C72. The selection of the series resistance parameters of the water level sensor is a key factor in effectively measuring the water level. Through a large number of experiments, it is found that in the above multivibrator circuit, when the capacitor C5 is selected as 0.1μF and the water level sensor is composed of four resistors of 30, 10, 10, and 10kΩ connected in series to form a water level sensor, the equivalent resistance value of the sensor changes between 60 and 0 kΩ when measuring the water level, and the frequency of the oscillation signal of the multivibrator is between 60 and 415 Hz, which has a better effect on measuring the water level. The structural form and electrode material type of the water level sensor are important factors affecting the service life of the water level sensor. Using conductive silicone material as the conductive electrode of the water level sensor and adopting a dual-electrode backup structure can better solve the problem of water leakage that often occurs due to water level sensor failure. [page]
2.2 Temperature measurement
The following uses the water temperature measurement method of the water tank as an example to illustrate the temperature measurement principle. In Figure 2, RT1 is a thermistor used to sense the water temperature of the water tank. Resistors R1 and RT1 form a simple series voltage divider circuit to divide the 5 V power supply voltage. The voltage drop on RT1 is 5V RT1/(RT1+R1). This voltage drop changes with temperature and is sent to the A/D converter inside the PIC16C72A through the A/D input pin AN0, converted into a digital signal, and read by the program. Thermistor RT1 is used to measure the temperature of the outdoor pipeline. The principle is exactly the same as above. The voltage drop on the corresponding thermistor is sent to the A/D converter by pin AN1. Here, a negative temperature coefficient thermistor (NTC) is selected as a temperature sensor. The main advantages of the NTC temperature measuring thermistor are large resistance temperature coefficient, high sensitivity, fast response speed, and can perform precise temperature measurement. The main disadvantage is that the thermoelectric characteristic nonlinearity is serious. Experiments have found that when measuring high temperatures, NTC thermistors consume a lot of power, which can easily cause thermal breakdown. Therefore, NTC thermistors and voltage dividers with larger resistance should be selected as much as possible. In addition, considering that the maximum input leakage current of the A/D input signal pin of the PIC microcontroller is ±500 nA, to ensure the correctness of the A/D conversion result, the voltage loss on the internal resistance of the signal source must not exceed 10 mV, which requires that the maximum internal resistance of the signal source should not exceed 20 kΩ. Analysis and research show that when selecting glass-encapsulated NTC thermistors with an accuracy of 50kΩ+±0.5%, its B25/50 is 4050 k±1%, and the voltage divider resistors are selected with a metal film resistor with good thermal stability and an accuracy of 20 kΩ±0.5%, there is no need for linear compensation. Only the table lookup method can meet the temperature measurement accuracy requirement of ±1℃, and the thermal breakdown problem of the thermistor is solved well.
2.3 Keyboard input and display output
Each I/O pin of PIC16C72's PORTB port can provide a pull current of up to 20 mA to directly light up the LED, and has the feature of software-controlled weak pull-up, which can simplify the design of key input and display output interface circuits. In addition to being the input port for key status, PORTB port is also used as the output port for water level, temperature display and working status. This is achieved by setting the PORTB port as an input port or output port in a time-sharing manner. The keyboard query circuit consists of resistors R4~R10 and 6 buttons S1~S6, which are defined as "heating up", "cooling down", "quantitative", "timing", "water supply", and "electric heating" keys respectively. The switch status of buttons S1~S6 can be input by reading the level on pins RB0~RB5. The two-digit digital tube SM42052, water level indicator light L1~L7, and status indicator light L8~L14 are displayed in a common cathode and dynamic scanning mode. The four common cathode display position control levels output by the pins RC4~RC7 of the PIC16C72 control the four 8050 transistors Q1~Q4 as the position control of the two-digit digital tube and two groups of LEDs (L1~L7, L8~L14). The display code decoded by the software is output from the pins RB0~RB6 to directly drive the LED digital tube and indicator light L1~L14. The keypad S1~S6 is connected to the pin RC3 of the PORTC port through the 1kΩ current limiting resistor R16. The purpose is to eliminate the influence of the key operation on the display of the digital tube and indicator light L1~L14 when PORTB is used as the output port. Before querying the status of the input keypad S1~S6, the program first makes the pin RC3 output a low level, then reads the level of the PORTB port, and inputs the status of the keypad S1~S6. Before PORTB outputs, the program sets RC3 as the input pin first, and then outputs the display code from the pins RB0~RB6 of the PORTB port. Since the RC3 pin is input high impedance at this time, the buttons S1~S6 are floating. Even if a button is pressed at this time, the high level output on the pins RB0~RB6 will not be pulled down to affect the display. The L1~L7 lights display the water level of the water tank, and the two-digit digital tube generally displays the water temperature of the water tank. When the temperature increase or decrease button is pressed, the set water temperature value is flashing; when the timer button is pressed, the set water use time value is flashing; when a fault occurs, the fault code is displayed; the lights L8~L10 are respectively the constant temperature working mode, quantitative working mode, and timing working mode indicator lights; the lights L11~L14 are respectively the water supply, electric heating, fault, and tap water pressure status indicator lights. S1 and S2 are the temperature increase key and temperature decrease key respectively, which are used to select the constant temperature mode and to change the water temperature setting value; S3 is the quantitative key, which is used to select the quantitative mode and to preset the water volume value; the timing key S4 is used to select the timing mode and to change the time setting value; S5 is the water supply key, which is used to turn on/off automatic water supply; S6 is the electric heating key, which is used to turn on/off electric heating; S7 is the water flow switch, which is used to measure the user's water use status.
2.4 Control output circuit
The system has three control outputs, which are controlled by the RA5, RC1 and RC2 outputs of the microcontroller to control the transistors Q6, Q7 and Q8, respectively, and control the relays RL1 and RL2, RL3 and the water supply solenoid valve. Relays RL1 and RL2 are used to control the electric heating pipes to assist in the electric heating of the water in the water tank, relay RL3 controls the electric heating belt to prevent freezing and blockage of the water supply and drainage pipes, and Q8 controls the water supply of the water supply valve. For example, press the "Water Supply" key to set RC2 to a high level to open the water supply solenoid valve and start water supply. Press the "Water Supply" key again, and the program will make RC2 output a low level and close the water supply solenoid valve. The condition for the antifreeze of the low-temperature electric heating belt is that the outdoor pipe temperature is equal to or lower than 4℃, and the program will set the RC1 port to a high level to make the electric heating belt work and heat up. When the pipe temperature is equal to or higher than 10℃, the pin RC1 will output a low level to turn off the power supply of the electric heating belt.
3 Function Introduction and Software Programming
This system is controlled by a single-chip computer program. Its functions include water temperature and water volume display, quantitative water supply, constant temperature water supply, timed water use, automatic water supply, auxiliary electric heating, automatic pipe antifreeze, overflow stop, automatic water supply and electric heating stop, low water pressure judgment, etc. The main functions are introduced as follows: Quantitative water supply function: Press the "water volume" key, the quantitative touch light is on, the system enters the quantitative mode, the water level light begins to flash, and then continue to press the "water volume" key. The water level light begins to change in a cycle and stops at the desired water volume value. The water volume setting is completed. Press the "water supply" key, the water supply light is on, and water supply begins. When the water volume in the water tank reaches the set value, water supply stops automatically. Constant temperature water supply function: Press the "heating" or "cooling" key, and the constant temperature mode light is on, indicating that the system enters the constant temperature mode, and the digital tube flashes to display the set water temperature value. Continue to press the "heating" or "cooling" key until the desired value is reached. Press the "Water Supply" key, the water supply light will light up, and the fixed temperature water supply function will start. During the water supply process, press the "Water Supply" key again to turn off the water supply. Timed water use function: first press the "Water Volume" key, the water level light will flash to display the set water volume value, continue to press the water volume key until the water volume value to be set; then press the "Temperature Increase" or "Temperature Decrease" key, the digital tube will flash to display the set water temperature value, continue to press the "Temperature Increase" or "Temperature Decrease" key until the value to be set; finally press the "Timer" key, the digital tube will flash, and the timing mode light will light up, indicating that the current timing working mode is the timing working mode. Continue to press the "Timer" key until the displayed value is the water use time to be set (1~24 h). In the timing mode, when the sunshine is good and the solar energy has made the water temperature reach the set temperature, the electric auxiliary heating will not be started; when the sunshine is insufficient, the controller will calculate the appropriate time to start the electric auxiliary heating, truly achieving automatic complementarity between light and electricity, saving electricity and ensuring all-weather use. If you want to cancel the timing function, press the "water volume" key or the "temperature increase" or "temperature decrease" key to leave the timing mode and enter the quantitative mode or constant temperature mode. Constant temperature electric auxiliary heating function: When the water temperature is lower than the set value, press the "electric heating" key to switch between turning on/off the electric heating. Anti-dry burning function: When the water temperature is lower than the set value and the water level in the water tank is less than 1/4, the electric heating cannot be started even if the electric heating key is pressed. Overflow automatic stop function: After 15 minutes of water filling, if the water level does not change, the water filling will be automatically turned off. In addition, it is designed to automatically postpone water filling and stop electric heating when the user uses water. The water filling function will be automatically started after 15 minutes without water in the water tank. The system program consists of a main program, multiple functional subroutines and an interrupt service program. The program flow is shown in Figures 3 and 4. The program is written in PIC assembly language, and the program code is nearly 2kB.
Figure 3 Main program flow chart
Figure 4 Interrupt program flow chart
4 Conclusion
This design effectively reduces the working current of the NIC thermistor by using a larger resistance voltage divider resistor and NTC thermistor in the temperature measurement circuit, and solves the thermal breakdown problem of the NTC thermistor. The water level sensor with a homemade backup electrode has doubled the service life of the water level sensor. PIC16C72 is selected as the control chip, with simple peripheral circuits, low cost and good anti-interference. The three working modes of quantitative, constant temperature and timing are designed, which are comprehensive and practical and can meet the requirements of diversified control of household solar water heaters. The key operation is simple, without key reuse, clear at a glance, and easy for users to master and use. The water level and temperature controller is particularly suitable for the automatic control of household water heaters.
Previous article:Design of brushless DC motor control system for electric motorcycle
Next article:Design of wireless temperature acquisition system based on nRF24E01
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- What is jitter and phase noise?
- [Shanghai Hangxin ACM32F070 development board + touch function evaluation board evaluation] + OLED screen display driver
- Tailing Micro B91 Development Kit Burning Pitfalls Record
- Interrupt vectors for ARM (Cortex-M3)
- July 28 live broadcast review: TI DLP technology innovation and new applications in automobiles (including video and text Q&A)
- The phone cannot display the formula
- How Smart Battery Fuel Gauges Can Effectively Improve Battery Life in Continuous Glucose Monitors
- Are 51 single-chip microcomputers still used now? I used this single-chip microcomputer when I was in college.
- [Mill Edge AI Computing Box FZ5 Review] VCU with DP interface plays mp4 video
- MSP430 CPU and MSP430X CPU