0 Introduction
With the popularization of IC card applications, it is possible to use IC cards to achieve "prepaid water fee management". The current electronic water meters can be mainly divided into network type and discrete type according to the meter reading method. Since the old water meter system needs to be modified in some occasions, if the network meter reading method is used, the meter reading line needs to be laid, which brings great problems to the construction. The discrete IC card water meter charging system does not need to consider this problem, which provides great convenience for management departments and users.
1 Hardware Circuit Design
This controller uses the MSP430 microcontroller as the control core. The MSP430 series microcontroller is a 16-bit RISC architecture, ultra-low power mixed signal processor launched by TI in the United States since 1996. The power supply uses a low voltage of 1.8 to 3.6 V, and the power consumption is only 0.1 μA in RAM data retention mode, 250 μA/MIPS in active mode, and the IO port leakage current is only 50 nA (general microcontrollers are 1 to 10 μA). It is very suitable for the design of battery-powered equipment such as water, gas, heat, and electricity meters. The microcontroller system diagram is shown in Figure 1. The overall circuit scheme of the system is shown in Figure 2.
1.1 IC card interface circuit design
The German Siemens SLE 4442 card is used to communicate with the single-chip microcomputer to complete the functions of water meter control, user recharge and water volume checking. The IC card interface circuit is the hub for connecting the IC card and the single-chip microcomputer. This design is compatible with both 4442 cards and T5557 cards. The circuit reserves the interface between the single-chip microcomputer and the IC card. The card type can be flexibly selected according to the design needs. The SLE4442 card follows the I2C protocol, and the read and write timing is similar to I2C.
Generally speaking, the IC card can be used as long as it is directly connected to the single-chip microcomputer, but in order to make the design more stable, some resistors are added between the IC card and the single-chip microcomputer to achieve the purpose of protection. In addition, the IO port and the card in place detection require pull-up resistors to ensure that they can operate normally. The water meter standard requires that the water meter must have an anti-static function, so in the design of the IC card holder, a TVS tube is added to ensure that the IC card holder can still work normally after being subjected to static electricity. [page]
1.2 Design of E2PROM circuit
The CAT24WC02 chip is used. It is a 2 Kb serial E2PROM, compatible with the 400kHz I2C bus, with an operating voltage range of 1.8 to 6.0 V, low-power CMOS technology, and has a write protection function. When WP is high, it enters the write protection state. The page write buffer and self-timed erase cycle are 1 000 000 program/erase cycles, and can save data for 100 years. 8-pin DIPSOIC or TSSOP package, the temperature range is divided into commercial grade, industrial grade and automotive grade. This system uses a storage chip to store data in the water meter. The data stored in the E2PROM will not be lost after power failure, thus avoiding data loss caused by power failure, and the reliability is high.
1.3 Design of power supply detection circuit
The power supply detection circuit is mainly used to detect low voltage. When the power supply voltage is too low, it is detected by the low voltage detection circuit, and corresponding operations are performed to avoid unnecessary errors. The specific working principle is shown in Figure 3. When PWR_CHECK_EN is high, this circuit works. At this time, Q9 is turned on, the base of Q8 is low, the VBAT terminal is always high, Q8 is turned on, and the voltage of the WR_CHECK pin is obtained by dividing the voltage of R17 and R20. After that, the voltage of the PWR_CHECK terminal is used as the input terminal of the internal ADC of the MSP430, and compared with the 1.5 V power supply to obtain the comparison result to determine whether it is low voltage. The function of the capacitor is to prevent AD sampling errors caused by voltage mutations. The PWR_CHECK_EN port setting is mainly for low power design. Low voltage detection requires a certain time interval. When detection is not required, this port is set high to save power consumption.
1.4 Design of pulse detection circuit
MSP430F149 microcontroller can provide up to 1 digital I/O interface, namely P1~P7. The I/O port of MSP430 microcontroller has 8 pins. Each I/O pin can be independently set as input or output direction, and each I/O wiring can be read or written independently. The registers of all interfaces can be set or cleared independently. MSP430 series microcontrollers have rich I/O port resources and interrupt resources, among which P1 and P2 ports have interrupt capabilities. In this design, the interrupt capability of P1 and P2 ports can be used to realize the measurement of pulses. Using interrupts to complete measurement is conducive to saving microcontroller resources.
The pulse detection circuit is shown in Figure 4. Four reed switches evenly distributed in a ring are used to count pulses. When a magnet approaches the reed switch, the reed is attracted. At this time, just connect one end of the reed switch to the ground and the other end to the I/O port of the microcontroller. Set the I/O port of the microcontroller to allow interrupts. As the impeller rotates, the magnet in the base meter also rotates. After one circle, the four reed switches are attracted respectively, and the I/O port completes 4 counts through interrupts, thus completing the counting of pulses.
2 Software Design
The software mainly involves system clock configuration, IC card and single-chip microcomputer communication, low voltage detection program, E2PROM related program, alarm program, valve control program, LCD display program, etc. Here we mainly introduce the program design of pulse detection and communication module.
2.1 Pulse detection program
The pulse detection part is an important part of the water meter. It is mainly used for flow measurement. The entire conversion system of the water meter is based on this. The flow rate is an important indicator of the performance of the water meter. The principle of pulse detection is: when a magnet approaches the reed switch, the reed of the reed switch is attracted. According to the fact that when the four reed switches are attracted once, it means that the water flows through one circle (in this program, it is set that when the water flows through five circles, it means 1 m3 of water), the water consumption can be obtained. At this time, the cumulative water consumption is increased by 1 and stored in the E2PROM. The specific flow chart is shown in Figure 5. [page]
2.2 Communication Module Programming
The SLE 4442 card mainly includes three memories: 256×8-bit E2PROM main memory (address 0 to 31 is the protected data area, 24 bytes after 32 to 255 are the application data area, the data reading and writing in this area is not restricted, and the erasure and writing are affected by the encrypted memory data verification results), 32×1-bit PROM protection memory (one-time programming to protect the main memory protection data area, prevent some fixed identification parameters from being changed, and the protection memory is also affected by the encrypted memory data verification results), 4×8-bit E2PROM encryption memory. The card reading and writing process is shown in Figures 6 and 7.
3 Conclusion
This paper discusses the design of an IC card intelligent water meter controller with MSP430 microcontroller as the control core. The controller has the functions of water volume measurement, conversion and recharge, various abnormality inspection, and has RF and M-Bus meter reading expansion interfaces. The system realizes the electronic and intelligent charging of water, changes the unreasonable situation of charging after water use, and promotes the scientific management of water metering and charging. The device has the characteristics of simple operation, low power consumption, convenience, reliability, etc., and has a good prospect for promotion and use.
Previous article:Brief introduction to the timing diagram inside the microcontroller
Next article:Design of serial communication between DSP and single chip microcomputer in high power UPS
Recommended ReadingLatest update time:2024-11-16 16:02
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- National Technology N32 MCU RF Resource Library (official, practical information)
- Raspberry Pi Pico Windows Development Environment - Compile under Visual Studio Code...
- Power circuit problem
- View Circuit-ADC and System (1)
- Teach you to understand the role of resistors in circuits
- EEWORLD University Hall----High-efficiency power architecture for smart door locks, battery-free light switches and wireless sensors
- 【E840-DTU】TCP connection
- Tank-1 test stand description (for burning and testing ESP8266 series)
- How to implement software reset and restart on HGI MCU
- Understanding digital signal processing