Design of wireless intelligent remote water meter based on PIC16F628A

Publisher:GoldenSunriseLatest update time:2010-12-18 Source: 电子技术 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

O Overview

With the development of radio technology, communication technology and single-chip microcomputer technology, the wireless intelligent remote water meter system has become the leading system for intelligent management in the water meter industry with its advantages of convenient installation, quick maintenance, and no restrictions on installation environment and wiring. The system generally consists of four parts, namely the water company's microcomputer data management system, on-site data downloader (hand copy machine), data concentrator, and wireless remote intelligent water meter. Among them, the wireless intelligent remote water meter is the basic part of the entire system and the information generation unit. It is generally composed of the original base meter with the addition of new sensors and control circuit boards.

1 Functions of wireless intelligent remote water meter

Through extensive market research, it was determined that wireless smart remote water meters should have the following functions: automatic timing or quantitative reporting of water volume; control of water meter valve switching according to concentrator commands; automatic reporting of remote water meters being damaged or interfered with, abnormal water consumption (too much or too little), or insufficient battery power; and parameter setting according to the needs of the management department.

2 Hardware Circuit Design

The wireless communication frequency of the wireless intelligent remote water meter selects the public frequency band (ISM band). The meter is powered by batteries to ensure that the collection and storage of information by the meter is not affected when the city power is cut off. According to the requirements of industry standards, the service life of the battery is more than 6 years, so the design of the entire product must fully consider the power consumption. The battery is selected as a high-energy lithium battery, and the service life of the battery is ensured by selecting low-power devices and setting a precise micro-power working mode. The accuracy of data collection, storage, and transmission is guaranteed by using dual sensors, software error correction, anti-interference technology, and encryption technology.

2.1 Components and functions of wireless intelligent remote water meter

The wireless intelligent remote water meter mainly includes the following units: single chip microcomputer, input acquisition, wireless data transmission, power supply, valve control, and voltage detection unit. Its block diagram is shown in Figure 1.

Block Diagram

2.2 Hardware design of each unit circuit

2.2.1 Input signal acquisition unit

The sensor is a small reed switch with low contact impedance, no standby power consumption and good reliability. As a magnetic sensor, when the magnet enters the critical area of ​​the reed switch, the reed switch will be attracted multiple times, resulting in repeated measurement. In order to improve the accuracy and anti-interference of measurement, a dual sensor design is adopted in the product. No matter how many times a single sensor is attracted, it is calculated as one attraction. Only when two sensors are attracted once each is it considered an effective measurement. The measurement unit of this design is 0.1t. When the two sensors are attracted at the same time, it is considered to be strong external magnetic interference, and the water meter executes the valve closing action. Set the MCU RB0 and RB4 pins as the detection end.

2.2.2 Design of single chip microcomputer

The PICl6F628A chip chosen for the single-chip microcomputer has low power consumption, strong anti-interference ability, convenient programming and debugging, and low price. The instructions of this single-chip microcomputer are single-byte instructions to avoid "flying" of the program and causing "freeze". The highly reliable watchdog has its own RC oscillator, which can avoid program lock and further increase the anti-interference ability. The power consumption of the sleep (power-off) mode is micro-power consumption, and it can be awakened from the sleep state when working. The precise design of its working process can make the power consumption reach the limit of saving. In order to reduce the power consumption of the whole machine, the main clock of the single-chip microcomputer uses the internal clock 4M (achieved by setting BIT3=1 of the power control register PCON), so that the execution time of a single-byte instruction is 1s, and the call and conditional transfer instructions require 2 μs. The single-chip microcomputer is set to work in a sleep state at ordinary times, and it will only be interrupted and awakened when the timing time is reached or there is water volume information. In order to reduce the power consumption of the whole machine, the clock pulse of timer 1 selects the off-chip crystal oscillator circuit. The crystal frequency is 32.768k, the tuning capacitor is 22p, and the internal frequency division is 8 (by setting BIT4 and BIT5 of the control register T1CON = 1). In this way, when the number of pulses is 24225 (5FH, 0FFH), the timing time reaches 10s.

2.2.3 Design of wireless data transmission unit

The wireless data transmission chip selected is the highly integrated, multi-channel RF transceiver chip CCll00, which is easy to control, powerful, small, low-priced, low-power, and highly anti-interference. The pin SPI_SCK of CCll00 is connected to the microcontroller pin RAl (output); SPI_SI is connected to the microcontroller pin RA2 (output); SPI_SO is connected to the microcontroller pin RA3 (input); SPI_CS is connected to the microcontroller pin RA6 (output); GDO0 is connected to the microcontroller pin RA7 (input).

The software design of CC1100 mainly uses Smart Studio, the internal register setting software of the chip provided by TI, to set the CCll00 control register. When configuring the software parameters, it is necessary to select an output power of 10dBm, a center frequency of 433.92MHz, and a data transmission rate of 10kbps. After entering these main parameters, the dedicated configuration software automatically converts the parameter values ​​of all the control registers of CCll00 to the optimal settings of the chip. These parameters are written to the specific registers of CCll00 through the microcontroller according to the agreed address, which can ensure that CCll00 works stably and reliably. In the program design, the settings of the CCll00 control registers should be refreshed regularly to prevent the contents in the registers from changing in a strong external interference environment, so that the chip cannot work properly. In the software design of CCll00, it is necessary to close the working status of other auxiliary devices during the wireless data transmission process to maintain the reliability and stability of the transmitted data.

2.2.4 Design of valve control unit

The chip used to drive the solenoid valve switch is the L9110 chip. This chip has two TTL/CMOS compatible level inputs, which have good anti-interference performance; the two output terminals can directly drive the forward and reverse movement of the motor. It has a large current driving capability, and each channel can pass 800mA of continuous current, and the peak current capability can reach 1.5A; at the same time, it has a low output saturation voltage drop; the built-in clamping diode can release the reverse impact current of the inductive load, and the driving performance is safe and reliable. The MCU RB5 pin is set to close the valve control; the RB3 pin is set to open the valve control; the RB2 pin is set to judge whether the valve is fully opened; and the RBl pin is set to judge whether the valve is fully closed.

2.2.5 Selection and design of power supply voltage detection components

The voltage detection chip is a low-power MCPlll chip. When the power supply voltage is higher than the detection voltage, the MCPlll output remains high; if it is lower than the detection voltage, the output will become low, reminding the power supply to be insufficient. Set the microcontroller pin RA5 as the power supply voltage detection input pin, and the low level is effective. The product sets the detection voltage of MCPlll to 3V; after detecting the low battery voltage and issuing an alarm, it can still ensure that the control circuit board can work normally for more than three months, providing time margin for battery replacement.

The connection diagram of the wireless intelligent remote water meter is shown in Figure 2.

Wireless intelligent remote water meter connection diagram

3 Software Design

The software of the intelligent wireless remote water meter adopts a modular design. The program mainly consists of the following main and subprograms: main program module, timing interrupt processing program module, water volume sampling processing program module, receiving wireless data processing program module, and data transmission program module.

3.1 Main program design

After the intelligent wireless remote water meter is powered on, the system software detects the working status of each functional module one by one. It mainly includes sensor module detection, timer module detection, valve actuator detection, especially the setting of CCll00 working parameters and the result detection after the setting is completed. After these modules are detected normally, the system detection light goes out and the system enters a low-power working state. The system that enters low-power working can only be turned on by interruption. There are two ways to turn on the system from low power to working state: one is when a sensor signal enters, the sensor signal turns on the interrupt system; the other is to turn on the interrupt system after the timer time expires. After the system is turned on, it returns to low power mode after executing the interrupt operation.

3.2 Design of timer interrupt handler

The scheduled start time is once every 10 seconds. After starting, the main function is to turn on the receiver to check whether there is a radio signal coming in. If not, enter the low power state. If yes, determine whether it is a command specified by the protocol. If it is a specified command, execute the corresponding operation, otherwise turn off the receiver and enter low power. The scheduled data is automatically transmitted once every 24 hours, and the scheduled "valve cleaning" is performed once a month.

3.3 Water sampling and processing program design

When the water meter sensor receives a signal, it is filtered by software to determine whether it is a valid signal. If it is an invalid signal, the interrupt is directly exited. If it is a valid signal, counting and water volume calculation are performed, and the data is stored in the memory inside the microcontroller after calculation. Analyze whether the transmitted water volume is reached. If the transmitted water volume is reached, the data is transmitted, otherwise the interrupt is exited.

3.4 Design of wireless data receiving processing program

Set CCll00 to receive state. If there is a receive signal, wait for receiving data and read the received data in CCll00 register. After reading the specified number of bytes of data, decode the data and judge the correctness of the data. If the data is correct, perform the corresponding operation according to the specified command; otherwise, exit the receive state.

4 Conclusion

Through the power supply parameters, radio performance, signal output test, control function test and water meter performance test of the wireless remote transmission intelligent water meter, all its main parameters have met the standards, achieving the technical indicators and performance required during the design. This product has been tried out in Tianjin Water Supply Company, and the accuracy of data collection is more than 92%, with good economic and social benefits.

2010/12/4 20:22:27
Reference address:Design of wireless intelligent remote water meter based on PIC16F628A

Previous article:LED display circuit based on PIC12C508 single chip microcomputer
Next article:Design of SPI interface between PIC microcontroller and serial flash memory

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号