Design of heat meter prepayment module based on MFRC522

Publisher:创新脑细胞Latest update time:2012-05-04 Source: 21ic Keywords:MFRC522 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

With the development of science and technology, economy and the adjustment of national energy policy, the mode of "central heating and household metering" has become the preferred mode in urban heating systems, so heat meters have been widely used in heating systems. However, since the heat metering and charging of this mode involves the direct interests of thousands of households and the heating situation is complicated, it is difficult for heating companies to charge. MFRC522 is a contactless IC card reader and writer base station chip newly launched by Philips, which is used in 13.56 MHz contactless communication systems. The heat meter prepayment module based on MF RC522 designed in this paper uses radio frequency IC card as the carrier of information to store the purchased heat. After the heat meter reads the data in the card, it clears the data in the card, realizing the consumption mode of "buy heat first, use heat later", creating conditions for solving the difficulty of heating charging, improving residents' awareness of saving and improving resource utilization.

1 Composition and working principle of prepaid module

The heat meter is used to measure and display the energy released or absorbed by water flowing through the heat exchange system. It calculates the heat released by the system by collecting the temperature of the water inlet and outlet and the water flow rate. The prepayment module is set up to achieve "buy heat first, use heat later". The prepayment module based on MFRC522 is shown in Figure 1.


System working principle: When a card reading operation is required, the key circuit first wakes up the single-chip microcomputer from the low-power mode. After receiving the valid card reading information, the single-chip microcomputer turns on the power of the radio frequency card reading and writing circuit, responds to the IC card request entering the radio frequency field, and communicates after determining that there is an IC card of this system, reads the calorific value in the card, adds it to the original calorific value of the heat meter, stores the purchased calorific value and the existing calorific value, and clears the calorific value in the IC card. At the same time, the LCD display shows the IC card number, the calorific value purchased this time, and the calorific value of the heat meter. If the calorific value in the heat meter is 0 before reading the IC card, and the existing calorific value is greater than 0 after reading, the power of the valve control circuit is turned on, and the operation of opening the water inlet of the heating pipe is executed. When the microprocessor detects that the valve is effectively opened, the power of the valve control circuit is turned off. After the system scans the radio frequency field for a period of time, it turns off the power of the radio frequency reading and writing module.

When the existing calorific value in the heat meter is equal to 0 KJ, the system will turn on the power of the valve control circuit and execute the operation of closing the water inlet valve of the heating pipe. When the microprocessor detects that the valve is effectively closed, it will turn off the power of the valve control circuit.

2 Hardware Design

The hardware of the heat meter prepayment module is mainly composed of a microprocessor, an IC card reading and writing circuit, a valve driving circuit, a button and a display circuit.

2.1 Microprocessor

Since the heat meter is a battery-powered instrument, one battery needs to work for more than 5 years, which places strict requirements on the low power performance of the microprocessor. MSP430F149 is a 16-bit ultra-low power microcontroller launched by TI. Its power supply voltage range is 1.8~3.6 V. The working current is only 0.8 μA under sleep conditions, and it only takes 6 μs to wake up from sleep mode. It has 6 data ports, P1 and P2 ports can all be used for external interrupt processing, 2 serial port communication modules, and these two serial ports can be set to UART mode or SPI mode through software. The 5 energy-saving modes are very suitable for use in ultra-low power products. Therefore, MSP430F149 is selected as the microprocessor of this system.

2.2 RF IC card reading and writing circuit

The main function of the radio frequency IC card reader circuit is to complete the identification of IC cards, read the data in the card, clear the data in the card, etc. The circuit is mainly composed of the MFRC522 base station chip and its matching antenna. MFRC522 is a contactless low-power reader-writer base station chip newly launched by Philips. The card reader chip fully integrates all types of passive contactless communication methods and protocols under 13.56 MHz, supports all layers of ISO14443A, can easily read Mifare 1 S50, S70 and other cards, has three interface modes: SPI mode, UART mode, I2C mode, and can communicate with various types of MCUs.

MSP430F149 has an SPI interface, so the communication between the RF base station chip and the microprocessor in this system adopts the SPI method, and the typical application circuit shown in Figure 2 is used. The circuit is mainly composed of a power control circuit, a low-pass filter circuit, a receiving circuit and an antenna matching circuit. The antenna in this design adopts a direct matching antenna method. The power control circuit (R15, R16, R17, Q5, Q12) makes the on and off of the RF circuit power supply in a controllable state. The RF IC card circuit is powered only when the card needs to be read. When the card is not needed, the power supply of the RF IC card circuit is disconnected to reduce the power consumption of the system. The low-pass filter circuit (L1, C17; L2, C20) is set to suppress the high-order harmonics generated by the quartz oscillator in the system circuit. The receiving circuit (R25, R26, C13, C14) is used to receive the return signal, and the values ​​of the resistor, inductor and capacitor are recommended. The function of the antenna matching circuit (C15, C18, C19; C23, C22, C21) is to tune the antenna to the optimal value. When selecting the specific value, the value of the capacitor should be comprehensively considered based on the length and width of the designed antenna and the inductance of the antenna.


2.3 Valve drive interface circuit

The valve control circuit and low-voltage electric valve cooperate with the IC card reading and writing circuit to realize the prepayment function. It is the actuator of the prepayment system and completes the opening and closing control operation of the heating pipe. The circuit is powered by a separate power supply, and the single-chip microcomputer only needs to provide relevant operation signals. It is mainly composed of a power supply circuit, a drive circuit and a low-voltage electric valve, as shown in Figure 3. [page]


The low-voltage electric valve uses the electric copper ball valve of Tianjin Zhufeng Valve Factory. Its hot water working temperature is 0~100 ℃, the working voltage is DC 3V~6V, and the valve control leads to 4 wires, namely the valve opening wire, valve closing wire, ground wire and feedback wire, which is very suitable for this system. The working process is as follows: when the valve opening wire and the ground wire are connected to the power supply, the valve automatically rotates to the fully open position and the internal power is automatically cut off; when the valve closing wire and the ground wire are connected to the power supply, the valve automatically rotates to the fully closed position and the internal power is automatically cut off; when the valve is opened or closed, the feedback line will output a high level; when the valve is opened or closed, the feedback line outputs a low level, so it is very simple and efficient to control with a single-chip microcomputer.

The power supply of the valve control circuit is mainly composed of a battery and a power supply voltage detection circuit. The power supply is a 3.6 V battery. Since the minimum operating voltage of the motor is 3 V, a 3.1 V voltage detection chip is used. When the power supply voltage is lower than 3.1 V, the microcontroller interrupt is triggered, the system will close the water inlet valve, and prompt the user to replace the power supply of the valve control circuit.

The driving circuit mainly controls the rotation direction of the valve motor. When the valve needs to be opened or closed, the corresponding circuit can be turned on. When it is detected that the valve has been opened or closed, the power supply of the circuit is turned off to reduce power consumption. As shown in Figure 3, the valve closing circuit (Q2, Q7, Q11) is controlled by the CLO_M terminal. When CLO_M is at a high level, Q2, Q7, and Q11 are turned on, the valve closing terminal is at a high level, and the valve opening terminal is at a low level, and the valve closing operation is performed. When it is detected that the level of the feedback terminal becomes low, the CLO_M terminal is low and the power supply is cut off; the valve opening circuit (Q9, Q10, Q3) is controlled by the OPEN_M terminal, and the working process is similar to the valve closing process.

2.4 Button and LCD display circuit

The main function of the key circuit is to wake up the microprocessor from low power mode and perform card reading. The key circuit of this system uses a simple keyboard composed of 1 resistor, 1 capacitor and 1 key. The output end of the key circuit is connected to the port with edge interrupt function of the microprocessor. When the key is pressed, the microcontroller interrupt is triggered to perform the card reading operation. The resistor in the circuit is a current limiting resistor to prevent the current in the circuit from being too large to damage the port of the microcontroller. The function of the capacitor is to eliminate key jitter.

The LCD display module displays information such as the card number, current heat, and the heat purchased this time. Considering the low power consumption of the system, the LCD12864 chip is selected, and its circuit is shown in Figure 4. It can work at a voltage of 3 V and can display not only English characters but also Chinese characters, achieving full Chinese display of information. Without turning on the backlight, the typical value of the working current is only 1.2 mA. When the module power is turned off when not displaying, the display module consumes very little energy, which is completely suitable for battery-powered low-power systems.


3 Software Design

The software adopts modular design, including main program and interrupt service program. The interrupt service program is shown in Figure 5.


After the main program completes the initialization of the system and other operations, it enters the low-power mode and waits for interruption. The key interrupt service program completes the card reading function, valve switching and other operations. For this prepaid module, the design of the key interrupt service program is mainly the key interrupt service program. In this key interrupt program, the timer is used to control the opening time of the radio frequency card, so that the software operation is more reasonable, the power consumption is small, and the execution efficiency is high.

The heat meter prepayment module designed in this paper takes MFRC522 as the core and realizes the prepayment function in combination with electric valves. By using the interrupt method in software and adding the power control terminal in the hardware circuit, the power supply is controllable, thereby reducing the power consumption of the system, achieving low cost and high efficiency of the system, and realizing the full Chinese and standard dimension display of information. The module has the characteristics of low power consumption and stable operation. It can be easily transplanted to other systems, thereby improving the performance of the product and has a high reference value in practical applications.

Keywords:MFRC522 Reference address:Design of heat meter prepayment module based on MFRC522

Previous article:High Power Factor Power Supply Based on MSP430
Next article:Design of portable terminal for wireless ward call system based on ZigBee

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号