Therefore, many domestic water meter manufacturers are currently exploring new product innovations, most of which use single-chip microcomputer technology. The practical research of smart water meter systems has become one of the hot topics in the current instrument industry. This article introduces the design of a smart water meter based on the MSP430F413 single-chip microcomputer.
This paper takes the intelligent IC card water meter system as the research object, focusing on the application and development of low-power intelligent instruments based on the MSP430F413 ultra-low power single-chip computer. The paper first proposes the overall design of the intelligent water meter system using IC card technology; designs the hardware circuit structure of the system control and studies the implementation of the software control process. Using the combination of software and hardware, the low power consumption, anti-interference design and security issues of the system are analyzed and studied
.
TI's MSP430 F413 series microcontroller is an ultra-low power mixed signal controller, which includes a series of devices, which are composed of various modules for different applications. They have a 16-bit RISC structure, and the 16 registers and constant generators of the CPU enable the MSP430 microcontroller to achieve the highest code efficiency. Flexible clock sources can enable the device to achieve the lowest power consumption. The digitally controlled oscillator (DCO) can quickly wake up the device from low-power mode and be activated to normal working mode in less than 6μs. The 16-bit timer of the MSP430F413 series microcontroller is an ideal configuration for industrial control such as ripple counters, digital motor control, electricity meters, water meters and handheld meters. Its built-in hardware multiplier greatly enhances its functions and provides a range of compatibility with software and hardware, improving data processing capabilities.
How Smart Water Meters Work
The working principle of the smart water meter designed in this paper is as follows: the user first purchases an IC card (user card) and brings the IC card to the charging station to pay for water purchase. The staff will write the purchased water volume and other information into the card. When the user inserts the card into the IC card water meter socket, the microcontroller in the IC card water meter recognizes the IC card password, verifies and confirms that it is correct, adds the purchased water volume in the card to the remaining water volume in the meter (when used for the first time, the remaining water volume is zero), and writes it into the memory in the IC card water meter, thereby controlling the electric valve to open the valve for water supply.
When the user uses water, the impeller with a magnetic sensor rotates under the impact of the water flow. Through magnetic transmission, the plum blossom gear on the upper meter cover rotates and the multi-pole gear rotates, realizing mechanical cumulative measurement. Whenever 0.01m3 is measured, the metering sensor located at 0.01m3 sends a synchronous metering pulse signal to the single-chip microcomputer. At this time, MSP430F413 counts the input valid pulse and calculates the water consumption. The remaining water in the IC card water meter will be reduced by one metering unit accordingly, and the cumulative water consumption will increase by one metering unit. The LCD display shows the remaining water and other related water use data. When the remaining water is lower than a fixed amount (there is a pre-set minimum remaining water value), the alarm system of the IC card water meter starts (the buzzer sounds), reminding the user to go to the water supply department to purchase water again in time. At this time, the words "Please purchase water" are displayed on the LCD display. When the remaining water is -1, the single-chip microcomputer drives the electric valve to automatically close, cut off the water source, stop the water supply and alarm. After the user re-purchases water and reads the card and stores it, the electric valve is opened for water supply. Under normal circumstances, the valve is in the open state. When encountering other special circumstances such as the remaining water volume is -1 or the battery voltage is less than 3V, the valve will change from open to closed.
System design
The intelligent water meter system designed in this paper is mainly composed of a microprocessor, a flow sensor, an electric valve, an IC card reader/writer, an LCD display and a power supply.
Figure 1 Principle block diagram of smart water meter
The hardware structure diagram is shown in Figure 1.
1 System Hardware Design
Figure 2 System hardware block diagram
The system hardware block diagram is shown in Figure 2.
① Power supply low voltage detection circuit
This system uses three 4.5V dry batteries as power supply. After a period of use, the dry batteries will discharge. In order to ensure the normal operation of the entire system, especially the valve, the power supply needs to be detected in real time. When the power cannot meet the system requirements, an alarm will be issued in time to remind the user to replace the battery to avoid unnecessary trouble.
In order to improve the reliability and safety of the operation of the smart water meter, a real-time power supply voltage monitoring circuit is used in the design. As shown in Figure 3. The voltage detection chip uses the Japanese Ricoh R3111H301C low-voltage detection chip. The output voltage of R3111H301C is 3.0V, the maximum operating current is 3.0μA, and the operating current under normal circumstances is only 1.0μA. It is highly integrated and fully meets the requirements of the system's low-power design. When the power supply voltage is normal, the output pin of the chip outputs a high level; when the power supply voltage is less than 3.0V, the output pin outputs a low level, that is, P1.1 outputs a low level, and the P1.1 falling edge interrupt is valid. When the microcontroller detects the signal, it will enter the interrupt service program for processing. At this time, the LCD displays the words "Change Battery", and the buzzer alarms to remind the user to replace the battery. The internal basic timer of MSP430F413 enables the interrupt, and the timing is 1s to detect whether the voltage rises. If it rises, the buzzer will sound an alarm again, and the words "Change Battery" on the LCD will be cleared. If it does not rise, the valve will be closed until the user replaces the battery, and then the valve will be opened again to supply water. Since the working voltage of MSP430F413 is 3.0V, a voltage conversion chip is needed to convert the 4.5V voltage into 3.0V for use by MSP430F413 and other peripheral modules. The RH5RL30AA voltage adjustment chip used in this circuit has a high-precision output voltage and an extremely low working current of only 1.1μA. [page]
② Pulse acquisition circuit
The base water meter in this system adopts a rotor-type cold water meter that complies with the ISO 4064B standard. The counting mechanism and the measuring mechanism of the meter are driven by magnetic coupling, and a reed switch sensor is used to measure and send signals. A pulse is generated every time 0.01m3 of water flows through. In order to effectively prevent the phenomenon of multiple counting caused by various possible interference jitters, this design uses double reed switches and double pulses to input the microcontroller counting through an anti-shake circuit composed of capacitors and resistors. Only when the two pulse input segments have pulse inputs in turn will a valid pulse count be generated. The two pulses have an interlocking function, and P1.3 and P1.4 are used as pulse input terminals. Every time a pulse is input, the corresponding amount of water is subtracted from the memory. The meter is equipped with a magnetic protection device, which has a strong ability to resist external magnetic interference. [page]
③ Valve control circuit
Valve control is a very sensitive part of the water meter control system. The poor reliability of opening and closing the valve will cause great problems for the water supply department. This system uses an electric ball valve with an operating voltage of 3V and a current of only 50mA during operation. In the design, a DC motor is used to drive the semi-ball valve to rotate forward or reverse to control the opening and closing of the valve. The P6.6 and P6.7 of the MSP430F413 microcontroller are used to control the forward and reverse rotation of the valve, and the internal comparator (P1.6CA0, P1.7CA1) of the MSP430F413 is used to detect the stall current to control the operation of the motor. When the motor is working normally, CA0>CA1. Once the motor is stalled, the current increases rapidly, and CAOUT=0, to notify the MSP430F413 motor to rotate to the right position. The timer is set to detect whether the motor is in place for 1s, which effectively solves the problem of unreliable valve closing. When a high level is input to the forward end and a low level is input to the reverse end, the valve is opened; otherwise, the valve is closed. When the microcontroller P6.7 port inputs a low level and the P6.6 port inputs a high level, the forward end (ON) outputs a high level and the reverse end (OFF) outputs a low level, opening the valve. When the valve is fully opened, a detection signal is input from the microcontroller P1.5 port and the action stops. Otherwise, the forward end outputs a low level and the reverse end outputs a high level, closing the valve. The microcontroller P1.5 port also inputs a fully closed detection signal.
2 System Software Design
Figure 4 is the main program flow chart. After the microcontroller is powered on and reset, the main program uses a sequential execution method to scan each custom flag bit one by one to check whether an action occurs. If so, it will be transferred to the corresponding subroutine for processing. After processing, it returns to the main program and continues to scan the subsequent flag bits. Finally, it enters a low-power state and waits for the next interrupt wake-up. After waking up, it will cycle again and enter a low-power state again. Since each signal enters in the form of an interrupt, special attention should be paid to the priority of the interrupt and the nesting of the interrupt. A modular approach is used to design each subroutine. Different functional modules are defined according to different functions. The entry and exit, and the calling relationship between each other are clarified for calling. The main software modules are: IC card reading and writing module, LCD display module, metering module, FLASH reading and writing module, low voltage protection module, etc. After power-on, the system is initialized first. Initialization includes clearing the internal memory unit, setting the initial value of the special function register, and setting the LCD display. Then enter the main loop to determine whether the fault and power supply voltage are normal. If everything is normal, open the valve to supply water. No matter what the circumstances, as long as a low voltage signal appears, the system will prompt undervoltage, the buzzer alarm, LCD display, prompting the user to replace the battery: when the remaining water volume is lower than the set value, the system LCD display reminds the user to "please buy water". If the user does not purchase water in time and recharge the card, when the remaining water volume is negative, the system control valve is closed and the water supply is stopped.
Figure 3 Power supply low voltage detection circuit
Figure 4 System software design flow chart
3 System Low Power Design
In the single-chip control system, the power consumption of the system is often proportional to the power supply voltage. When the power supply voltage is high, the power consumption of the system will increase accordingly. Therefore, in the intelligent water meter control system with strict power consumption requirements, a low power supply voltage should be selected as much as possible while ensuring the function. In this system, three alkaline dry batteries with a voltage of 4.5V are selected for power supply. The energy consumption of the intelligent water meter designed in this paper is mainly composed of three parts: the first part is the continuous energy consumption of the liquid crystal of the single-chip microcomputer (CPU) in the controller during normal operation, which is the main power consumption; the second part is the instantaneous energy consumption when the IC card water meter actuator (electric valve) is in action; the third part is the energy consumption of some auxiliary functions of the IC card water meter, such as sound alarm. The first and second parts of the energy consumption of the above-mentioned intelligent water meter account for more than 95% of the total energy consumption. Therefore, the main considerations in the design are: selecting low-power electric valves; selecting low-power devices (CMOS type); selecting low operating voltage and low operating frequency; and selecting low-power system operation mode in software design.
4 System Anti-interference Design
The anti-interference design of this system is considered from two aspects. One is to take appropriate measures in hardware design to suppress and eliminate interference, such as using electromagnetic interference filters, as shown in Figure 5. The other is to take certain measures in system software design to improve the anti-interference ability of the system, so that even if the system is interfered with, it can automatically and quickly resume normal operation. For example: minimize the interrupt source, use a combination of interrupt and query, keep the interrupt open time as short as possible, and turn it on and off at will; artificially insert no-operation instructions in the key parts of the program to protect the CPU from being disassembled when the program is interfered with and the instructions are not disassembled when the program "flies away". Other software measures.
Figure 5 Application of electromagnetic interference filter in the system
Conclusion
Practice has proved that the smart water meter designed in this paper implements a prepaid management method of "buy water first and use water later" for users, which improves the various drawbacks of the traditional management model to a certain extent, conforms to my country's basic national conditions, and has strong applicability value.
Previous article:Design of Portable Heart Rate Meter Based on MSP430
Next article:Digital-to-analog converter AD420 and its interface technology with MSP430
- 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
- Share a book about Cortex M3 core
- msp430 MCU AD conversion
- Fudan Micro FM33LC046N Evaluation + ADC Collection Alarm
- MSP430FR235x-based pulse oximeter system solution
- CCS compilation error: Solution for missing header file
- LWIP uses UDP to send data continuously
- It was very popular in the past, and now it is back, how should this button position be designed?
- Implementing USB source code with Verilog (FPGA)
- How good is Hangshun's chip? Let's see if Huawei 5G uses its chip
- ESP-USB-Bridge turns the ESP32-S2/S3 development board into a JTAG debugger, and cooperates with OpenOCD to debug STM32 and other chips