IC card water meter based on single chip microcomputer design

Publisher:ShimmeringStarLatest update time:2014-08-07 Source: 21ic Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

In my country, IC card water meters appeared around the early 1990s, and have gradually matured after more than 10 years of rapid development. Especially in recent years, with the improvement of design level and the scale of production, they have been used more and more in large and medium-sized cities. IC card water meters are mechatronic products that integrate measurement and control. In addition to the basic functions required by general instruments, they also have their own characteristics. For example, waterproof and moisture-proof measures must be taken for them; for example, IC card water meters must have the characteristics of low cost, low power consumption, small size and high precision, which are the four elements of IC card water meters. In the design process, the design must be based on these four elements to meet the actual application requirements of the product.

1.png

1. Composition of measurement and control circuit and software design of IC card water meter 1.1 Composition of measurement and control circuit of IC card water meter The block diagram of measurement and control circuit is shown in Figure 1. Considering the requirement of low cost, the main chips of this system are AT89C2051-12PI, PCF8564 and AT24C01. Its basic working principle is: using event trigger mechanism, that is, it is usually not powered on, so the power consumption is only the sleep state consumption of PCF8563, about 250nA [1]. There are three types of event trigger modes, namely "counting event" when the reed switch is energized, "card insertion event" when the card operation is performed, and "timing event" when the timer alarm preset in the calendar clock chip occurs. When these three types of events occur, the measurement and control circuit automatically powers on, processes according to the preset working process, and automatically powers off after completion. According to the water consumption of residents, the time required for the measurement and control circuit to work is generally about 0.3 seconds to 1 minute per day. Considering the requirement of low power consumption, it is scientific and reasonable to adopt the event trigger mechanism. Some designs use liquid crystal long-term display. Although the power consumption requirements can be met when calculating the life theoretically, according to the actual operation situation in my country, there is no need for long-term display. Obviously, this design method is not suitable unless the battery characteristics require it, such as when using lithium thionyl chloride batteries. 1.2 Software Design The basic software function block diagram is shown in Figure 2.

2.png

According to the above three types of events, the control board is required to start the working state, help the program first determine what type of event has occurred and refine the type and then handle it separately. For example, in the case of a card operation event, it is again determined which function card requires the operation. Due to the requirements of miniaturization and low cost, the program does not use the C language with large redundancy, but is compiled in assembly language to control the program code within 2K bytes [2], so a small-sized and low-cost single-chip microcomputer can be selected. Some large and medium-sized cities have introduced tiered water prices. The calculation of tiered water prices is mainly completed by software based on calendar clock chips and memory chips. Under the current national conditions, it will take some time for it to be truly implemented on a large scale. When the implementation of tiered water prices leads to an increase in software volume, chips such as AT89C4051-12PI and AT24C16 or even AT24C256 can be used to meet the requirements, and all other hardware designs can remain unchanged. [page]

2 Working principle of sampling power supply module The circuit schematic diagram of sampling power supply module is shown in Figure 3. In Figure 3, Q1 and Q2 form a switch circuit to control the power on and off of the measurement and control board. When GHG1 is attracted by water, a sampling event occurs, and the charging process of C1 begins. The charging current turns on the switch group and powers on, completing the sampling and counting function. When GHG2 is attracted by water, C1 is discharged so that it is effective when the next sampling event occurs. This design can prevent miscounting due to frequent attraction and release of GHG1 caused by unstable water pressure. Another function of C1 is that even if GHG1 is attracted for a long time, the measurement and control board can be kept in a power-off state to ensure low power consumption performance. The function of C4 is to suppress the influence of mechanical jitter of GHG1 on counting. The function of C2 is to provide another trigger pulse when C1 is fully charged but not yet discharged and is attacked by magnetism, so that the measurement and control board can be powered on to close the valve and record the time and number of magnetic attacks. From the above analysis, it can be seen that C1 and C2 should use capacitors with small leakage current as much as possible to improve the working performance of the module.

3.png

3 Dual power supply design The so-called dual power supply means that the measurement and control circuit and valve drive each use a set of batteries. After observing the voltage waveforms of a large number of actual measurement and control boards, it was found that under the condition of single power supply, the voltage sometimes jumps at the moment of motor start-up, generally reaching 1.5V100ms, especially when the battery power is not sufficient. Due to the use of floating voltage working mode, although the system sometimes still works normally, the impact of this pulse interference input on the control system is self-evident. This not only affects the working stability of the microcontroller and other chips, but also causes serious damage to the battery. Such problems are not easy to occur when the battery power is sufficient. After a few years of large-scale installation and use, this problem will bring more serious consequences. Some representative manufacturers have adopted dual power supply design, but adopt a common ground design. This is not only difficult to completely solve the above problems, but may even cause dangerous situations due to the asynchronous voltage of the two sets of batteries. After testing after adopting optocoupler isolation, the voltage of the measurement and control board has only a small ripple superposition when the motor is driven. Even if the battery power is insufficient, there is no voltage jump phenomenon, which ensures the long-term stability of the measurement and control board. Although the material cost has increased, the after-sales service cost has been reduced and the company's credibility has been improved. The overall benefit is satisfactory.

4 Valve fuzzy controller design

4.1 Necessity of fuzzy control With the improvement of measurement accuracy, designers have begun to pay more attention to the other side of measurement and control, namely control, in recent years, such as using intelligent control technology to control valves and using soft start technology of motors to protect the battery life. Although the water meter industry stipulates six-year mandatory inspection, according to the actual operation of our country, IC card water meters should have a longer service life to reflect the value of the product. At present, power consumption is no longer the main contradiction, and the life of the battery itself basically determines the service life of the IC card water meter. What is more critical nowadays is that the corrosion of the valve causes the increase of the driving current, which in turn causes damage to the battery and failure of the valve, thus causing the failure of the IC card water meter. Because of this bottleneck problem, its service life is greatly reduced, and some IC card water meters even fail after only two years of use, which is much lower than the expected life. This fault will become more and more prominent as the service life increases. In the past 10 years, designers have used pilot valves, magnetic booster valves, stainless steel valve cores, ceramic valve cores and lubricants, but the effect is not obvious. There is also a design that uses a timed valve switch, that is, let the time interval be D. If calculated based on a six-year service life, then: D=(2190E1)/E In the formula, E is the total available power of battery pack 2; E1 is the power required to switch the valve once. Although this method can alleviate this problem to a certain extent, the valve corrosion process caused by different times and places is different. It is obviously unscientific to adapt to the complex and changing corrosion conditions with a certain rule. It is not only not conducive to the reasonable use of limited power, but also bound to cause a certain failure rate. The mathematical model of the corrosion situation is difficult or impossible to establish accurately. In this case, the use of fuzzy control theory can often achieve satisfactory results.

4.2 Determination of control variables In order to overcome the shortcoming of the large amount of calculation of fuzzy algorithm, the table lookup method is used for fuzzy control. That is, the MATLAB fuzzy logic toolbox is used for offline design to obtain a fuzzy control table that meets the control requirements and store it in the system memory. This study uses the deviation e=I-Ig between the collected driving current value I of the electric control valve and the set current value Ig and the rate of change of the deviation between two adjacent times as input variables, and the time adjustment amount U of the next switch of the electric control valve as the output variable. A typical double-input single-output PD structure fuzzy controller is established, and the control parameters are set using the fuzzy inference system editor (FIS).

4.3 The fuzzy experiment of variables shows that the safe range of the driving current is between 50 and 100 mA. Under normal circumstances, the electric control valve can be switched on and off once every 10 days to ensure that the valve will not rust. This design selects 75 mA as the given value of the driving current and selects 10 days as the given driving cycle. On this basis, adjustments are made and the adjustment range is set to 2 to 18 days. Then the basic domain of e is set to [-25, 25], the basic domain of ec is also set to [-25, 25], and the basic domain of u is set to [-8, 8]. Due to space limitations, the specific design process is omitted here.

Through the above analysis and the actual use of more than 20,000 IC card water meters in service, the following conclusions can be drawn: (1) The use of dual power supplies can significantly improve the working reliability of the measurement and control board, protect the battery, increase the service life of the IC card water meter and reduce the failure rate. (2) The use of fuzzy control technology can more effectively use limited power and avoid valve rust, completely solving the "valve bottleneck" problem of the service life of IC card water meters.

 

Reference address:IC card water meter based on single chip microcomputer design

Previous article:Using infrared transceiver chip to realize communication between single chip microcomputers
Next article:Design and implementation of radio frequency communication base station based on single chip microcomputer control

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号