1 Introduction
With the rapid development of social science and technology, resource shortage is becoming increasingly serious, especially water resources, which are closely related to human survival. With the rapid development of my country's information industry, it has become possible to realize the electronic, information and networking of tap water fee management. The intelligentization of water meter system can greatly improve the work efficiency of water supply management departments, save costs, improve water supply facilities, and improve the quality of drinking water for residents. This paper takes a smart card water meter control system as the research object, which combines control technology, computer technology and other technologies, and is a cross-disciplinary electronic information system.
2 Overall structure of smart water meter control system
The intelligent water meter control system specifically realizes the functions of automatic water flow measurement, TM card reading and writing, valve control, alarm display, etc. The control system circuit consists of a low-power single-chip microcomputer, a flow meter, an E2PROM storage circuit, a TM card reading and writing circuit, an LCD display control circuit, a valve control detection circuit, a voltage detection circuit, etc. The structural principle is shown in Figure 1.
Figure 1. Schematic diagram of smart water meter control system
When the user inserts the TM card containing the purchased water volume and other information into the card holder on the water meter, the control valve opens the water supply channel under the control of the electronic control system. Every time the user uses a measurement unit (10 liters), the metering circuit sends a set of metering pulse sequences. If the pulse sequence is determined to be valid by the electronic control system, one measurement unit can be subtracted from the purchased water volume. When the remaining water volume reaches the alarm value, the LCD Chinese characters display "Please purchase water"; when the water volume is zero, the control valve automatically closes and the water channel is cut off. At this time, the user must re-hold the card to purchase water. Under normal circumstances, the control valve is in the on state, and the control valve changes from the on state to the off state only when a special event occurs.
3 Hardware Design of Smart Water Meter Control System
The TM card water meter control system consists of a low-power single-chip microcomputer, a flow metering circuit, an E2PROM storage circuit, a TM card reading and writing circuit, an LCD display control circuit, a valve control detection circuit, a voltage detection circuit, a real-time clock circuit, etc.
1. Single chip microcomputer
The microcontroller as the core component of the TM card water meter control system adopts the P87LPC764 microcontroller from the PHILIPS 51LPC series. This microcontroller has fast running speed, flexible programming, low power consumption, and comes with 4K bytes of OTP program memory, 128 bytes of RAM, and a 32-byte user code area that can be used to store sequence codes and set parameters. It also has rich I/O functions and strong interrupt capabilities, and can well meet the requirements of high integration, low cost, and low power consumption of the TM card water meter control system.
2. E2PROM storage circuit
In the smart card water meter control system, the storage of information is a very important aspect. Therefore, in this control system, the memory uses a 2K capacity serial CMOS E2PROM--CAT24WC02, which is a low voltage (1.8 ~ 6V), low power consumption, long life (one million programming and erasing cycles) device, using the I2C bus data transmission protocol, easy to use. It is used to store information such as total water purchase, total water consumption, last water purchase, card number, water meter status, etc. The interface circuit is shown in Figure 2.
Figure 2 I2C device interface circuit
3. TM card reading and writing circuit
The carrier of information, TM card, uses a single bus protocol for communication. All read and write operations are completed through a signal line (bus) and a ground line, so the read and write circuit is extremely simple. I will not elaborate on this in detail. [page]
4. LCD display control circuit
The LCD driver uses HT1621, which is a 128-point, memory-mapped and multifunctional LCD driver. Its unique software configuration features make it suitable for a variety of LCD applications. There are only 4 or 5 pins used to connect the main controller and HT1621. In this design, resistors and PNP transistors are used to control the power supply | regulator of HT1621 to reduce power consumption and extend the service life of the LCD. The LCD is usually closed. When a TM card is inserted and a valid card is confirmed or there are other conditions, the LCD is turned on and displays information such as the current water purchase, water usage, available water, valve status, etc.
5. Water metering circuit
The base meter of the water meter adopts a single-flow rotor-type cold water meter that complies with the ISO4064B standard. The technical parameters are shown in Table 1. The counting mechanism and the measuring mechanism of the meter are driven by magnetic coupling, and a reed switch is used to measure the water volume and send a signal. A pulse is generated every time 10 liters of water flows through. The meter is equipped with a magnetic protection device, which has a strong ability to resist external magnetic interference. The water volume measurement pulse is input into the single-chip microcomputer through an anti-shake circuit composed of capacitors and resistors. For each input pulse, the corresponding water volume is subtracted from the memory.
6. Valve control detection circuit
Valve control is a very sensitive part of the water meter control system. Poor reliability of valve opening and closing will cause great problems to the water supply department. Therefore, we designed an electric ceramic valve with ingenious structure, reliable closing, and DC2.6-3.6V control to effectively solve the problem of unreliable valve closing. As shown in Figure 3, the forward and reverse control circuit of the electric valve, when the forward end inputs a high level and the reverse end inputs a low level, the valve opens; otherwise, the valve closes. When the single-chip microcomputer P1.6 port inputs a low level and the P1.7 port inputs a high level, the transistors Q3, Q5, and Q6 are turned on, and Q2, Q4, and Q7 are turned off. Therefore, the forward end (ON) outputs a high level and the reverse end (OFF) outputs a low level, opening the valve. When it is fully opened, the detection signal is input from the single-chip microcomputer P1.5 port and the action stops. Conversely, the transistors Q2, Q4, and Q7 are turned on, and Q3, Q5, and Q6 are turned off. The forward end outputs a low level and the reverse end outputs a high level, closing the valve. The closed-to-full detection signal is also input from the single-chip microcomputer P1.6 port.
Figure 3 Control circuit of electric valve
7. Power supply voltage detection circuit
In order to improve the reliability and safety of water meter operation, hierarchical power supply voltage real-time detection is adopted, and the voltage real-time detection chip uses RH5VL28 and RH5VL30. When the power supply voltage is normal, the Vout pin of the chip is high level; when the power supply voltage is less than 3.0V, the Vout pin of RH5VL30 outputs a low level. After the single-chip microcomputer detects the signal, it controls the LCD display module to display undervoltage and closes the valve to warn the user to replace the battery; when the power supply voltage is less than 2.8V, the Vout pin of RH5VL28 outputs a low level. After the single-chip microcomputer detects the signal, it completely closes the valve until the user replaces the battery.
8. Power supply and real-time clock circuit
The power consumption of a microcontroller system is often proportional to the power supply voltage. Therefore, in a battery-powered system, a low power supply voltage should be selected as much as possible while meeting performance requirements. To this end, we use the ER14505 DC3.6V/2.0Ah disposable lithium-thionyl chloride battery of Wuhan Lixing Company as the system power supply to fully utilize the low voltage and low power consumption characteristics of the microcontroller and peripheral devices.
In the actual application of TM card water meters, users may not use them for a long time due to some reasons. Therefore, after a long period of micro-current discharge (equivalent to self-discharge during storage), the internal resistance of the battery will increase, and the instantaneous driving ability of the battery will decrease, which is very likely to affect the action of the electronically controlled valve or produce undervoltage, affecting the stability of the system. But at the same time, the battery may still have enough capacity to use. If the battery is replaced for this reason, the cost of using the water meter will increase. To solve this problem, we added a clock circuit to the control system. Every month, the clock chip (PCF8563) generates an interrupt. After the microcontroller receives it, it controls the valve to open and close, so that the battery can generate a relatively large current discharge at a fixed time, reduce the internal resistance of the battery, improve the performance of the battery, and thus improve the stability, reliability and maintenance-freeness of the entire system.
[page]
4. Software Design of Smart Water Meter Control System
If the hardware circuit is the foundation of the control system, then the control software is the soul of the entire system. The quality of the control software design directly affects the performance of the system. In this system, considering the size of the internal program memory of the P87LPC764 microcontroller, the running speed, the readability and maintainability of the program, etc., 51 assembly language is used and the modular method is used for compilation.
The software of the TM card water meter control system mainly consists of the main program, interrupt service program, subprogram, etc. The main program mainly includes the initialization, self-test, and power-off state of the single-chip microcomputer and interface chip; the interrupt service program includes water metering interrupt, card insertion interrupt, magnetic interference input interrupt, undervoltage interrupt, and monthly alarm interrupt; the subprogram mainly includes LCD display, memory reading and writing, and delay program. The entire water meter control system is usually in the power-off state. When there is an external interrupt signal, it wakes up from sleep and executes the program. Figure 4 is the main program flow of the control system. The P87LPC764 single-chip microcomputer has a strong interrupt function, a four-priority interrupt structure, and can support up to 11 interrupt sources. In this control system, considering that the single-chip microcomputer is usually in power-off mode, the interrupt type used by the system should have the ability to wake up the P87LPC764 single-chip microcomputer. Therefore, the interrupts used in the control system all adopt the simple KBI interrupt with wake-up function in P87LPC764, and set the priority for each interrupt source, such as the water metering interrupt priority is set to the highest.
Figure 4 Control system main program flow chart
5 System anti-interference design
1. In order to prevent users from using electromagnetic interference to steal water, an additional measure to prevent artificial electromagnetic interference is added. That is, a reed switch is placed side by side with the metering signal-transmitting reed switch, but its trigger switch value is slightly higher than that of the signal-transmitting reed switch. Therefore, when the user uses electromagnetic interference, as long as the magnetic force exceeds a certain limit, the anti-electromagnetic interference reed switch is closed, and the single-chip computer detects this signal and can perform corresponding operations, effectively preventing artificial electromagnetic interference.
2. Connect decoupling capacitors, i.e., 10μF electrolytic capacitors and 0.1μF capacitors, between the power supply and ground of the circuit board to eliminate power supply interference. In the smart water meter system where the power supply quality is not very high, relatively good results have been achieved.
3. The circuit board is a highly integrated collection of devices, signal lines, and power lines in the circuit system. The quality of the circuit board design has a great impact on the anti-interference ability, so the design of the printed circuit board must comply with the anti-interference design principles.
Previous article:Design of low-cost ECG monitoring system based on 51 single-chip microcomputer
Next article:Research and design of ultrasonic distance measurement system based on 51 single chip microcomputer
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
- Feedback and Op Amp in Circuits
- Why are the photos of Ukraine taken by US satellites in color but China in black and white?
- Prize-giving event | Stand on NI's shoulders and explore the mysteries of data together!
- A summary of the most downloaded electronic technical materials this week (2020.6.8~12)
- MPPT solar lithium battery charger based on single chip microcomputer
- Data sharing: A brief review of the 2018 National Undergraduate Electronic Design Competition TI Cup and sharing of preparation experience
- STM32 assignment question
- LIS331DLH three-axis acceleration sensor package and code
- EEWORLD University - EOS and ESD on ADC
- NodeMcuEsp8266-L298N drives DC motor