The most popular prepaid heat meter design based o

  • Detail

Design of prepaid heat meter based on ht46r65

with the reform of China's welfare system, the heating system has also undergone corresponding changes. In the heating system, the traditional way of calculating the heating fee based on the residential area has been questioned by more and more residents. For example, in the heating season, households with the same area have different actual indoor temperatures due to the different time of having people at home and the relationship between floors. However, according to the traditional method, they must pay equal heating fees, which brings about contradictions. The Ministry of construction is carrying out the reform of the heating system to charge the heat energy according to the actual use. This paper presents a design scheme of intelligent IC card prepaid heat meter based on ht46r65 single chip microcomputer

1 working principle

the heat meter is used in the household heating system with hot water as the heat transfer medium to measure the heat released by hot water through the inlet pipe and return pipe; It is mainly composed of flowmeter (water meter), digital temperature sensor, contactless IC card reading module (zlg500), LCD module, etc. The flowmeter is used to measure the volume of hot water flowing through the heating equipment; Two temperature sensors are used to measure the inlet water temperature and return water temperature respectively; The contactless IC card is used to facilitate the management of the heating Department, and the LCD is used to display some basic information. The principle is that according to the volume of hot water flowing through the pipeline provided by the flowmeter and the temperature data of water inlet and return measured by the paired temperature sensor, it is sent to the calculator to calculate the consumed heat energy, and the heat energy data is displayed on the LCD after processing. After the contactless IC card is recognized, the thermal energy value in the card is read out, and then the thermal energy data in the card is cleared. As the used thermal energy increases, the remaining thermal energy decreases accordingly. When the remaining thermal energy is zero, the water meter valve will automatically close, stop heating, wait for the user to buy heating and recharge, and restart heating

the calculation formula of consumed heat energy Q is as follows:

where: C is the specific heat capacity of water (c=0.011 67 kwh/L ·℃); V is the volume of hot water flowing through the heating equipment; T inlet water and t return water are the two temperatures flowing through the heating equipment

residual heat energy q2=q1-q (Q1 is the sum of the heat energy purchased by the user), the total consumed heat energy that can be displayed on the screen within a period of time q3= ∑ Q

2 structure of heat energy meter

2.1 hardware part

the hardware part is mainly composed of ht46r65, power module, clock circuit, temperature sensor DS18B20 which must be amplified to reach the required value, water meter flowmeter, keyboard and LCD display circuit, card reader, valve motor control circuit, etc. The relationship between peripheral components and MCU is shown in Figure 1, and the wiring of zlg500 and ht46r65 is shown in Figure 2

the following is a brief description of each part in Figure 1

temperature acquisition module: two pieces of Dallas DS18B20 temperature sensors are used to collect inlet water temperature and return water temperature respectively. DS18B20 is a single bus (1-wire) digital temperature sensor. It has the advantages of simple structure, flexible operation, no external circuit, and insensitive to power supply voltage fluctuation (the power supply voltage can be +3.3 ~ +5.5 v when the temperature conversion accuracy is guaranteed to be ± 0.5 ℃)

flow detection module: use reed sensor water meter to detect hot water flow. A pulse signal is generated whenever the amount of water flowing through the water pipe reaches 1 L; The pulse signal can be detected by interruption or query, and then the consumed thermal energy can be calculated according to the collected temperature

card reading module: zlg500 is used to read the thermal energy data in the non-contact IC card (recharge the thermal energy meter); Then it is added with the remaining heat energy and stored in the heat energy register, and the data in the card is cleared after the card is read successfully. The drive buzzer sounds to indicate that the card reading is successful

control valve motor module: use the two ports of ht46r65 to directly drive the motor. If the forward direction is energized, start the motor; Otherwise, turn off the motor and set the port to low level at ordinary times. If the value of the thermal energy register is zero, close the valve; Otherwise, the valve is open

keyboard and LCD module: the LCD is used to display some relevant information (such as heat and temperature), and the keys are used to switch the display information. Make full use of the LCD driver module of HT single chip microcomputer to directly drive the LCD without purchasing the integrated LCD module, which reduces the cost

the main function of the heat energy meter is to measure the actual heat energy consumption of users. The heat energy purchased by the user is stored in the contactless IC card, and then the card is read to recharge the meter. Pay the heating fee in this way, pay as much as you use, and turn off the heating automatically after use. The heat meter can quickly and intuitively display the residual heat energy, consumed heat energy, inlet water temperature and return water temperature on the LCD. It is convenient for users to use, and also convenient for the heating Department to manage and collect heating fees

2.2 software part

the software part consists of several sub modules. The C language main program is embedded with several assembly programs, such as card reading module communication, data transmission after card reading, temperature acquisition, thermal energy calculation and liquid crystal display, making full use of the mixed language programming environment of ht-ide3000. The software flow is shown in Figure 3. Q=c? V? △t。 Assuming △ t=26 ℃, v=1 L, then q=0.011 67 × one × 26=0.303 42 kWh。 Ht-ide3000 does not support floating-point operation. If it is calculated directly and then accumulated, it will bring great rounding error. In order to improve the calculation accuracy of the project using coal as raw material, it is still necessary to enter windows through a series of operations and compile a large number of floating-point processing and calculation programs in the program: converting a number into a corresponding 3-byte floating-point number, floating-point subtraction, floating-point multiplication, floating-point addition, converting floating-point numbers into corresponding values for display, etc. Floating point operation has the advantages of high precision and large range of values. The rules for floating-point operation are as follows: before floating-point addition and subtraction, the order code needs to be aligned, and then the mantissa is added and subtracted; Floating point multiplication is mantissa multiplication and order code addition. Take the assembler module communicating between zlg500 and ht46r65 as an example, and the brief description is as follows (the crystal frequency of the system is 4 MHz): assembler SPI_ Init initializes the SPI interface to the idle state, the external interrupt 1 connected to the SS line is triggered by the falling edge, and the timer 1 is configured as the watchdog timer of the SPI interface. When writing data, the MCU first generates a falling edge on the SS line and sends a signal requesting data transmission; After waiting for the zlg500 response, this data transmission starts. When the SCLK is high, the zlg500 reads the data on the sda-ta line. After the transmission, MCU generates a rising edge on the SS line to end the transmission. (the specific procedure is omitted - editor's note.)

3 functions of the heat meter

the heat meter has the following functions:

① measure the temperature of hot water in the inlet and return pipes

② calculate heat energy Q, Q2 and Q3

③ with keyboard operation and LCD display, switch the contents displayed on the screen by pressing the key. The displayed data include t high temperature, t low temperature, Q2 and Q3

④ turn on or off heating automatically

⑤ establish connection and communication between ht46r65 single chip microcomputer and zlg500 card reading module, read and write cards timely and accurately, and realize prepaid function


the test proved that this heat energy meter can accurately calculate the thermal energy consumed by users, realize the function of paying before using, and won the first prize in the "shengqun" cup competition in Tianjin in 2006; However, there are still some areas that need to be improved, such as the sensitivity is not high enough. The installation and operation of the heat energy meter is simple. The indirect method has many varieties and accurate calculation. It realizes the collection of heating fees according to the actual heat energy consumption. The use of contactless IC card prepayment technology is a development trend. It is not only convenient for users, but also solves the "charging difficulty" that has plagued the supply department for a long time. It can be widely used in central heating and household metering heating facilities. (end)

Copyright © 2011 JIN SHI