Design of Smart Water Meter with IC Card Based on 51 Single Chip Computer

1. Design requirements and objectives

(1) Water management function. When the user inserts a valid IC card, the system adds the remaining water volume to the purchased water volume, and saves the balance value to the chip to prevent loss; when the user starts to use water, the system adds the remaining water volume to the The amount of water used is automatically subtracted and stored in the chip to prevent loss.
(2) Display function, using LCD1602 liquid crystal display, you can query the total amount of water and the remaining water available.
(3) Automatic water supply and stop function, when the remaining water used is 0, the valve will be automatically closed; after the recharge is successful, the valve will open again.
(4) Alarm function. When the remaining water volume is reduced to a certain amount, the buzzer and LED lights will send out an alarm message and prompt the user to purchase water.
(5) Anti-disassembly function. When the smart water meter is forcibly disassembled, the anti-disassembly switch in the water meter is triggered, and the microcontroller immediately closes the valve to prevent users from stealing water maliciously.

2. Design ideas and plans

(1) Single-chip selection

Hongjing’s STC89C52 microcontroller is a CMOS 8-bit microcontroller with low power consumption and high performance. It has an 8K programmable Flash ROM, which is fully compatible with the pins and instructions of the 8051 microcontroller, and has 8K bytes of flash memory, 256 Bytes of memory, 32-bit input and output interface, in addition to watchdog timer, 2 data pointers, 3 16-bit timers, counters, 6 vector interrupts, TTL serial port. It can fully meet the functional and performance requirements of this design.

(2) IC card reading and writing module selection

This design uses the more advanced MF522-AN non-contact IC card reader/writer module. This chip is a low-voltage, low-cost, and small non-contact reader/writer card chip developed by NXP for the "three-meter" application. , Widely used in the research and development of smart meters and portable handheld devices.

(3) Display module selection

LCD1602 liquid crystal display: It is a dot matrix liquid crystal module specially used to display numbers, letters and symbols. It consists of two rows of 16 dot matrix character bits. It can not only display numbers, but also English and symbols.

(4) Power supply circuit selection

Linear regulated DC power supply: The output ripple is small, the response speed is fast, the output voltage is lower than the input voltage, and the noise generated during operation is lower, but its efficiency is low, and the heat generation is large, which indirectly adds thermal noise to the system .

Due to the low power consumption of the circuit in this design, the +5V power supply is directly powered by the battery, and the linear stabilized power supply integrated circuit ASM1117-3.3 provides +3.3V power supply for the IC card reading and writing module.

(5) System plan

The hardware design principle of this design is to realize the water control function under the premise of ensuring low power consumption. First, the user goes to the water company to purchase the water fee, and the amount is written into the IC card by the water recharge machine. After returning home, the IC card is placed on the water meter. At this time, the IC card read-write module transmits the amount data in the card to the single-chip microcomputer. The single-chip microcomputer judges whether to open the solenoid valve according to whether there is a balance, and displays the balance in the water meter and the information of the used water volume through the liquid crystal display module; the flow sensor transmits the water consumption data to the single-chip microcomputer, and then calculates the real-time balance through the single-chip microcomputer , When the balance is lower than the set value, the alarm circuit will give a prompt. When the balance is zero, the solenoid valve will be closed until the IC card with the amount is read again. In addition, this design also considers the anti-sabotage function. When someone maliciously opens the water meter cover, the internal anti-theft switch will act, and the single-chip microcomputer will detect the signal. At this time, the solenoid valve will be closed and the alarm will sound.

The IC card smart water meter hardware is mainly composed of five parts:

1. Single-chip microcomputer: adopt STC89C52 single-chip microcomputer;

2. IC card reading and writing module: MF522-AN non-contact IC card reading and writing module;

3. Liquid crystal display module: choose LCD1602 LCD screen;

4. Power module: use 5V battery and ASM1117-3.3 chip to provide power;

5. Interface circuit: It is composed of solenoid valve control circuit, pulse extraction circuit and alarm circuit.

3. Hardware circuit

 

For more MCU design and information, please pay attention to the WeChat public account "Electronic Engineer Growth Diary"! !

Guess you like

Origin blog.csdn.net/weixin_41017942/article/details/105441685