Design of embedded controller for time sharing con

  • Detail

Design of embedded controller for time-sharing control electric water heater

1 overview

with the development of national energy-saving and safety certification of household appliances, the time-sharing billing method for urban electricity has been promoted and implemented, that is, the charge is high at peak hours and low at low peaks. At present, it is rare to use the mechanical temperature control mode of water heaters. The early electric water heaters can no longer meet the needs of modern life because of their simple control, low degree of intelligence and few protection functions. The controller mentioned in this paper adopts high cost performance single chip microcomputer, uses software control technology, integrates intelligent control ideas, increases multiple protection functions such as leakage detection and dry burning alarm, greatly improves the intelligence and safety of the electric water heater, and uses LCD to display the temperature, so that the water heater has a good man-machine interface, which is convenient for users to operate, and makes the electric water heater more economical and practical

2 system function design

the intelligent controller of this electric water heater mainly has the following unique functions: ① LCD real-time display temperature and real-time clock with soft backlight; ② It has multiple protections such as leakage, dry burning, overheating and sensor failure; ③ Convenient key operation: system start key; Power selection key; Timing status key; Section timing setting or clock calibration state switching key; Adjust the numerical setting keys of temperature, clock and timing on-off time; ④ Operation status indication; ⑤ Fault audible and visual alarm and indication

3 system hardware design

the system circuit is mainly composed of electric heating tube control circuit, leakage detection circuit, buzzer drive circuit, temperature sampling circuit, LCD and LED display circuit, key circuit, backlight, etc. The system structure is shown in Figure 1

mcu adopts Toshiba's high cost performance tmp87p809n, which has rich resources (including 512 bytes of ram, 8K bytes of ROM, 10 interrupt sources, 22 i/o ports, two 16 bit multifunctional timers, a basic timer, a watchdog timer, an S-curve automatic follow CI port, such as 6-way 8-bit a/d converter for extrusion processing of glass fiber reinforcement, magnetic plastics, conductive materials, new ceramics and other materials) and low prices, It is especially suitable for embedded control of intelligent household appliances

3.1 temperature sampling circuit

this system uses a temperature sensor to collect the water temperature of the water heater in real time for MCU control; Because the single chip microcomputer has its own a/d circuit, it can be composed of a thermistor temperature sensor and a high-precision resistance partial voltage; In order to improve the anti-interference ability, a resistor can be connected in series on the port line of the single chip microcomputer, and a filter capacitor according to the ground can be connected

3.2 leakage detection

for the use of electric water heaters, safety performance is the primary factor to be considered. This system designs a unique leakage detection and protection circuit, as shown in Figure 2

the power supply of the electric heating tube passes through the transformer L, and the relay J isolates the strong current of the electric heating tube from the outside world

when powered on, the (P1) of the single chip microcomputer 1 port, output a high level, make j pull in, and get power on the electric heating. When there is no leakage, the current flowing into and out of the electric heater is balanced, and there is no induced electric heat on L. once there is leakage, the current in the wires entering and leaving the electric heater is unbalanced, and there is induced electric heat on L. after the filtering and rectification of D1, D2, C1 circuits, the DC voltage V1 is obtained and sent to the comparator. When V1 is greater than the warning voltage V2, the output of the comparator IC will flip, producing a falling edge, Send it to the interrupt port int of the single chip microcomputer, and the single chip microcomputer immediately responds to the interrupt, making (P1) Port 1 outputs a low level, relay J is disconnected, and the power supply of the heater is quickly cut off

R5, R6, T2 in Figure 2 and (P1) of MCU 0 port constitutes the constant monitoring system of leakage protection circuit. (P1). Port 0 outputs a high level every certain time (e.g. 5 minutes) to saturate T2, and the voltage V1 is immediately induced on L. at this time, V1> V2, the output of the comparator turns over, and the single chip microcomputer should be interrupted. If the single chip microcomputer does not interrupt in time, it indicates that the leakage protection circuit is faulty, (P1) Port 1 outputs a low level to release relay J and cut off the power supply of the water heater; LCD display failure, buzzer alarm. This ensures the real-time reliability of the leakage protection circuit

3.3 liquid crystal drive circuit

HT1621B is selected for liquid crystal display. This chip is an intelligent special module for liquid crystal display drive. It has the characteristics of high integration, small size, strong function, low power consumption, less peripheral devices, etc. it can drive 32 × 4-digit LCD screen. Figure 3 shows the LCD driving circuit

cs is the chip selection pin of HT1621B. When it is at low level, the data communication between MCU and HT1621B is connected, otherwise it is prohibited

wr is the clock pin for writing data. HT1621B receives commands or data from the date line only at the rising edge of WR clock signal

date is the input/output pin of serial data

the function of resistor R7 is to adjust the brightness of LCD, and the value range is generally 15K Ω± 20%

4 software design

software design adopts function independence and structure modularization as software design mode

program consists of main program, int interrupt program and timing interrupt program. Int interrupt program is used for leakage detection and monitoring of leakage protection circuit; Timing interrupt program is used to generate clock and count various times; The main program consists of initialization program and each function module program. Figure 4 is the structure flow chart of each function module of the main program

a/d sampling program completes the data acquisition of temperature, and controls the switch of electric heating tube according to the temperature setting value. If the collected data is too high or too low, it is considered that the sampling circuit including the sensor is faulty, turn off the power supply heating tube, and the system will alarm

4.1 dry burning protection

the water heater is short of water due to the aging of the sealing ring caused by the long-term use of the water heater, or water leakage caused by other factors. At this time, if the power supply is added, the heating tube will be in a dry burning state. If the power supply is not turned off in time, the electric heating tube will burn out or even burst

the anti dry burn protection subroutine is to monitor the temperature rise of the heater in real time. If the temperature rises too fast, it is considered as dry burn, and immediately turn off the heating pipe and alarm

the block diagram of the anti dry burn subroutine is shown in Figure 5. The unit time is 1 minute, and the consequences caused by dry burning are serious. Therefore, the temperature rise of dry burning should be judged within 1 minute, rather than wait until the end of 1 minute timing

4.2 segmented timing

according to the real-time clock of 24 hours a day, the system divides the fixed time into four time periods: 0~6, 6~12, 12~18, 18~24, a total of 12 ways. The user can select one or more periods to heat regularly, and can also use the "∧" and "∨" keys to modify the four time periods and the upper and lower limits. If you need to cancel a certain period, set the upper and lower limits of the time to the same. Figure 6 is a flowchart of the segment timing setting procedure

arrive at the site within 72 hours during non holiday periods

after the segmented timing is set, press the timing key to enter the timing state, and press the timing key again to cancel the timing

4.3 LCD display program

ht1621b is a multifunctional LCD driver chip. Before using, it must be initialized first, and then data can be transmitted to it to drive the required LCD. Figure 7 is the most basic program block diagram of the LCD module

5 anti interference design

the electric water heater is used in a humid environment, and the interference caused by power pollution is particularly serious. In order to ensure the reliable operation of the control system, the following anti-interference measures are taken

in hardware design, pay attention to the layout of components, that is, the analog signal, digital circuit and noise source (strong current part) should be reasonably separated. When designing the printed board, the leads between components should be as short as possible, the ground wire and power line should be appropriately thickened, and a decoupling capacitor should be added between the power source and ground of the integrated circuit

in the software design, the methods of instruction redundancy, software trap and software self recovery by using the watchdoc monitor inside the single chip microcomputer are adopted; In order to eliminate the interference signal of a/d sensor channel, digital filtering is realized by using CPU operation and control function; The repeated detection method is adopted to realize the accurate judgment of leakage

6 Conclusion

this paper introduces the application design of a new intelligent electric water heater controller with segmented timing control. This product has been mass produced and achieved good economic and social benefits. With the development of technology, intelligent electric water heaters with self-learning ability and remote control ability are also being developed

Copyright © 2011 JIN SHI