CN114627635A - Infrared communication method, gas meter and terminal equipment - Google Patents

Infrared communication method, gas meter and terminal equipment Download PDF

Info

Publication number
CN114627635A
CN114627635A CN202011468187.XA CN202011468187A CN114627635A CN 114627635 A CN114627635 A CN 114627635A CN 202011468187 A CN202011468187 A CN 202011468187A CN 114627635 A CN114627635 A CN 114627635A
Authority
CN
China
Prior art keywords
data
gas meter
communication
infrared
processed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011468187.XA
Other languages
Chinese (zh)
Inventor
方丁伟
梁佳星
徐晓静
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Goldcard Smart Group Co Ltd
Original Assignee
Goldcard Smart Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Goldcard Smart Group Co Ltd filed Critical Goldcard Smart Group Co Ltd
Priority to CN202011468187.XA priority Critical patent/CN114627635A/en
Publication of CN114627635A publication Critical patent/CN114627635A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G08SIGNALLING
    • G08CTRANSMISSION SYSTEMS FOR MEASURED VALUES, CONTROL OR SIMILAR SIGNALS
    • G08C23/00Non-electrical signal transmission systems, e.g. optical systems
    • G08C23/04Non-electrical signal transmission systems, e.g. optical systems using light waves, e.g. infrared
    • GPHYSICS
    • G08SIGNALLING
    • G08CTRANSMISSION SYSTEMS FOR MEASURED VALUES, CONTROL OR SIMILAR SIGNALS
    • G08C17/00Arrangements for transmitting signals characterised by the use of a wireless electrical link
    • G08C17/02Arrangements for transmitting signals characterised by the use of a wireless electrical link using a radio link

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Measuring Volume Flow (AREA)

Abstract

The application provides an infrared communication method, a gas meter and terminal equipment. The method comprises the following steps: the receiving circuit obtains the external infrared signal through the decoding chip. The receiving circuit outputs the infrared signal as communication data, and the communication data comprises the infrared data after structuring. And the controller analyzes the communication data according to a preset structure rule to obtain decoded data. And controlling to extract target data from the decoded data according to actual needs. The target data may be configuration data of the gas meter. The method reduces the maintenance complexity of the gas meter, saves the cost, and improves the reliability and stability of communication.

Description

Infrared communication method, gas meter and terminal equipment
Technical Field
The application relates to an infrared communication technology, in particular to an infrared communication method, a gas meter and terminal equipment.
Background
With the development of communication technology, the interaction between devices is more convenient. Currently, common short-distance communication methods include bluetooth, infrared, Zigbee, wifi, NFC, EnOcean, and the like. The infrared communication mode is a communication mode which is low in cost, small in size, low in power consumption, convenient to connect, simple and easy to use, and is widely applied to communication between instruments and other equipment. Wherein, the instrument can be a gas meter, a water meter, an automobile instrument and the like.
Taking a gas meter as an example, when a gas meter is overhauled, it is usually necessary to connect the gas meter device through a terminal device. The gas meter communicates by using infrared signals, and the terminal equipment communicates by using Bluetooth signals. In the prior art, a bluetooth-to-infrared tool is usually installed in the gas meter to realize interaction between the gas meter and the terminal device. When the gas meter needs to perform data interaction with the terminal equipment, the Bluetooth-to-infrared tool converts Bluetooth information sent by the terminal equipment into infrared information, and the Bluetooth-to-infrared tool converts infrared information sent by the gas meter into Bluetooth information.
However, in the process, the use of the bluetooth-to-infrared tool not only increases the cost of the gas meter, but also makes the maintenance process of the gas meter more complicated, and has the problem of low maintenance efficiency.
Disclosure of Invention
The application provides an infrared communication method, a gas meter and terminal equipment, which are used for solving the problems of complex gas meter maintenance and low maintenance efficiency in the gas meter maintenance process in the prior art.
In a first aspect, the present application provides an infrared communication method, which is applied to a gas meter, where the gas meter includes a receiving circuit and a controller, and the method includes:
acquiring communication data through the receiving circuit;
decoding the communication data by using a preset decoding rule to obtain decoded data;
and extracting target data from the decoded data, wherein the target data comprises configuration information of the gas meter.
Optionally, the obtaining, by the receiving circuit, communication data includes:
acquiring data to be processed, wherein the data to be processed is an infrared signal;
preprocessing the data to be processed to obtain processed data, wherein the preprocessing comprises removing 38KHz carriers in the data to be processed;
and generating communication data according to the high level, the low frequency and the duration of each pulse in the infrared waveform of the processed data.
Optionally, the preset decoding rule is an NEC protocol rule.
Optionally, the data to be processed includes two pieces of same data information stored continuously.
Optionally, the data to be processed further includes a stop bit, where the stop bit is the last bit of the data to be processed, and is used to indicate that the data to be processed is received or the processing is completed.
Optionally, before extracting the target data from the data code, the method further includes:
and checking the data code according to the data code and the data anticode.
Optionally, before extracting the target data from the data code, the method further includes:
and decrypting the decoded data according to a preset encryption rule to obtain decrypted decoded data.
Optionally, the gas meter further includes a transmitting circuit, which is applied to the transmitting circuit, and the method includes:
determining an infrared waveform of the data to be transmitted according to the data to be transmitted, wherein the infrared waveform comprises the level and the duration of each pulse;
and transmitting the data to be transmitted.
In a second aspect, the present application provides an infrared communication method applied to a terminal device, where the method includes:
acquiring a user instruction, wherein the user instruction is an operation instruction selected by a user through a display interface of the terminal equipment, and the user instruction is used for indicating the gas meter to execute corresponding operation;
generating first communication data according to the user instruction;
and sending the first communication data to the gas meter.
Optionally, the method is applied to a terminal device, and the method further includes:
acquiring second communication data, wherein the second communication data is data fed back by the gas meter;
parsing the second communication data;
and displaying the analysis result of the second communication data.
In a third aspect, the present application provides a gas meter, including: a receiving circuit and a controller;
the receiving circuit is used for receiving data to be processed and preprocessing the data to be processed to obtain communication data, wherein the data to be processed is an infrared waveform;
and the controller is used for realizing the infrared communication method in any one of the possible designs of the first aspect and the first aspect according to the communication data.
In a fourth aspect, the present application provides a terminal device, including:
the acquisition module is used for acquiring a user instruction, wherein the user instruction is an operation instruction selected by a user through a display interface of the terminal equipment, and the user instruction is used for indicating the gas meter to execute corresponding operation;
the generating module is used for generating first communication data according to the user instruction;
and the sending module is used for sending the first communication data to the gas meter.
The receiving module is used for acquiring second communication data, and the second communication data is data fed back by the gas meter;
the analysis module is used for analyzing the second communication data;
and the display module is used for displaying the analysis result of the second communication data.
According to the infrared communication method, the gas meter and the terminal equipment, the infrared communication system comprises a receiving circuit and a controller; the receiving circuit acquires an external infrared signal through the decoding chip; the receiving circuit outputs the infrared signal as communication data, and the communication data comprises the infrared data after structuring; the controller analyzes the communication data according to a preset structure rule to obtain decoded data; and controlling to extract target data from the decoded data according to actual needs. The target data can be a means of configuring data of the gas meter, so that the gas meter can directly realize interaction with terminal equipment through infrared signals, the cost of converting original Bluetooth into infrared tooling in the gas meter is saved, the maintenance complexity is reduced, and the reliability and the stability of infrared communication are enhanced.
Drawings
In order to more clearly illustrate the technical solutions in the present application or the prior art, the following briefly introduces the drawings needed to be used in the description of the embodiments or the prior art, and obviously, the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without inventive labor.
Fig. 1 is a schematic view of a communication scene of a gas meter according to an embodiment of the present application;
fig. 2 is a flowchart of an infrared communication method according to an embodiment of the present disclosure;
fig. 3 is a flowchart of another infrared communication method according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a receiving circuit according to an embodiment of the present disclosure;
fig. 5 is a flowchart of another infrared communication method according to an embodiment of the present application;
fig. 6 is a flowchart of another infrared communication method according to an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of a transmitting circuit according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a gas meter according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a terminal device according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a communication system according to an embodiment of the present application.
Detailed Description
To make the purpose, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be clearly and completely described below with reference to the drawings in the present application, and it is obvious that the described embodiments are some, but not all embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The technical solution of the present application will be described in detail below with specific examples. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments.
With the development of communication technology, the interaction between devices is more convenient. Currently, common short-distance communication methods include bluetooth, infrared, Zigbee, wifi, NFC, EnOcean, and the like. The infrared communication mode is a communication mode which is low in cost, small in size, low in power consumption, convenient to connect, simple and easy to use, and is widely applied to communication between instruments and other equipment. The meter can be an intelligent gas meter, an intelligent water meter, an automobile meter and the like.
Taking a gas meter as an example, when the gas meter realizes communication in an infrared communication mode, the realization principle mainly comprises the sending and receiving of infrared signals. The infrared signal is mainly sent by controlling and outputting 38KHz Pulse Width Modulation (PWM) carrier sending data through an infrared light-emitting diode and a timer. The infrared signal receiving mainly realizes the data receiving through an infrared receiving tube and an IRM3638T infrared decoding chip. Besides, on the basis of the hardware equipment, the gas meter uses a serial port with 9600 baud rate for communication. In the process of maintaining the equipment by after-sales maintenance personnel, based on the serial port, the gas meter needs to be converted into an infrared tool through Bluetooth to realize data interaction with the terminal equipment.
The Bluetooth frequency band used for data interaction is the 2.4GHz ISM frequency band. In the gas meter, a sampling Bluetooth module is connected with a controller in the gas meter through serial ports TX and RX. A controller in the gas meter needs to be provided with a serial port with a uniform baud rate to send and receive AT instructions. The gas meter starts the Bluetooth through the key. After the bluetooth of the gas meter is started, the terminal device starts the bluetooth to search, and then pairing of the devices is achieved through a Universal Unique Identifier (UUID). The UUID is a 128-bit string ID for uniquely identifying the gas meter and the terminal device. And when the UUIDs used by the gas meter and the terminal equipment are consistent, the gas meter and the terminal equipment are successfully matched.
The hardware equipment for receiving and transmitting data in the gas meter is 38KHz carrier wave infrared equipment. At the moment, in order to acquire data in the gas meter, a Bluetooth-to-infrared tool is installed in the gas meter on the basis of infrared equipment. The Bluetooth-to-infrared tool is composed of a single chip microcomputer, an infrared receiving and transmitting tube and a Bluetooth module and used for achieving the function of transmitting signals. The terminal equipment is connected with the Bluetooth-to-infrared tool first, and data communication is achieved through Bluetooth. Then, the Bluetooth-to-infrared tool transmits the received Bluetooth data to the gas meter, so that the data on the gas meter can be acquired.
In practice, bluetooth is a not yet fully mature technology, which, although described as promising, has yet to be rigorously checked for practical use. Moreover, the communication rate of bluetooth is not very high, and the transmission is relatively slow. In addition, the ISM band used by bluetooth is an open band, which is very easy to be interfered during the use process, and the problem of reduced communication quality exists. For example, when bluetooth is used, nearby devices such as microwave ovens, wireless telephones, scientific instruments, industrial equipment, or medical equipment may be turned on, and the use of such equipment may interfere with bluetooth. Moreover, the use of the Bluetooth-infrared tool makes the data acquisition step of the gas meter relatively complex, and is not beneficial to the operation of the user by the after-sales personnel. Meanwhile, a special Bluetooth-to-infrared tool is used, so that the cost of the gas meter is increased inevitably.
In order to solve the problems, the application provides an infrared communication method, a gas meter and terminal equipment. Wherein, the gas table uses infrared carrier to communicate.
In the gas meter, the infrared signal is still transmitted by controlling and outputting 38KHz PWM carrier wave transmission data through an infrared light-emitting diode and a timer. The infrared signal receiving still realizes the data receiving through the infrared receiving tube and the infrared decoding chip of the IRM 3638T. On the basis, the controller detects the high and low levels and the duration of the input data through the interrupt and the timer to generate communication data. Wherein the encoding rule of the input data is determined according to the NEC protocol. The gas meter decodes the communication data by using a preset decoding rule to obtain decoded data, wherein the decoded data comprises a data code and a data anticode. And extracting target data required by the gas meter from the decoded data by the gas meter. Meanwhile, the gas meter encodes output data into an infrared waveform comprising high and low levels and duration through an interrupt and a timer according to the NEC protocol. By using the method, the cost of converting original Bluetooth into infrared tooling in the gas meter is saved, the maintenance complexity is reduced, and the reliability and stability of infrared communication are enhanced.
In the terminal equipment, the user realizes the communication with the gas meter through the APP installed in the terminal equipment. Specifically, an administrator transplants open-source NEC protocol source codes into the terminal equipment by using an android underlying API and an infrared device carried by the administrator. Meanwhile, the administrator abstracts the corresponding sending module and receiving module in the APP so as to realize the interaction between the terminal equipment and the gas meter.
Fig. 1 shows a communication scene schematic diagram of a gas meter device according to an embodiment of the present application. As shown, the gas meter communicates with a mobile phone. The gas meter can be an intelligent gas meter, such as an intelligent gas meter, an intelligent water meter, an automobile gas meter, and the like. The terminal device can be a tablet, a notebook, a server and the like besides a mobile phone. The gas meter and the mobile phone realize infrared communication through an NEC protocol.
In the gas meter, the hardware circuit may include a receiving circuit and a transmitting circuit. The transmitting circuit is connected with a serial port transmitting pin of a Micro Controller Unit (MCU). The transmitting circuit uses a timer to output a 38KHz Pulse Width Modulation (PWM) carrier wave, and uses the PWM carrier wave to realize data transmission. The receiving circuit comprises an IRM3638T decoding chip. And after receiving the infrared data, the receiving circuit removes the 38KHz carrier wave in the infrared data. The receiving circuit transmits the infrared data with the 38KHz carrier removed to a pin of the MCU.
Wherein the data format of the infrared data is determined according to the NEC protocol. In the infrared data, the infrared data having a bit value of "0" is represented by 560us of carriers +560us of idle. Infrared data having a bit value of "1" appears as a 560us carrier +1.68ms idle.
In the gas meter, a software part is mainly used for realizing the analysis and generation of infrared data. The specific process is mainly realized by a controller, and comprises the steps of setting receiving pins and transmitting pins as interrupts of rising edges and falling edges. And after the triggering interruption, the controller uses a timer to time. And the controller determines the data waveform of the infrared data according to the time length or realizes the analysis of the infrared data.
In the interaction process, the mobile phone mainly realizes interaction with the gas meter through the mobile phone APP. The APP can comprise NEC protocol source codes, an android underlying API and an API of a mobile phone infrared device. The transmitting function and the receiving function of the infrared data are abstracted from the APP, so that a user can directly realize data interaction with the gas meter through the APP.
In the present application, a gas meter is used as an execution subject to execute the infrared communication method of the following embodiments. Specifically, the execution subject may be a hardware device of the gas meter, or a software application in the gas meter, or a computer-readable storage medium or a chip on which the software application implementing the following embodiments is installed.
Fig. 2 shows a flowchart of an infrared communication method according to an embodiment of the present application. On the basis of the embodiment shown in fig. 1, as shown in fig. 2, a gas meter is taken as an execution subject, and the method of this embodiment may include the following steps:
s101, communication data are obtained through a receiving circuit.
In this embodiment, the receiving circuit obtains the external infrared signal through the decoding chip. After the decoding chip acquires the infrared signal, the preprocessing of the infrared signal is realized through a receiving circuit, and the infrared signal without the carrier wave of 38KHz is obtained. The receiving circuit outputs the infrared signal through the HWRX pin to structure the infrared signal. The controller retrieves the structured infrared data, i.e., the communication data, output by the HWRX pin.
S102, decoding the communication data by using a preset decoding rule to obtain decoded data.
In this embodiment, the controller acquires communication data. The communication data comprises structured infrared data. Specifically, the communication data includes a time point of each interrupt and a time period from each interrupt to the next interrupt.
Where the interrupts include rising edge interrupts and falling edge interrupts, each interrupt identifying the end of a bit value and the start of the next bit value. Wherein, the time length from each interruption to the next interruption is determined according to the bit value and the NEC protocol.
Typically during use of the infrared signal, a logic "1" is 2.25ms, with a pulse time of 560 us. A logic "0" is 1.12ms, pulse time 560 us. The controller may decode the data according to the length of the burst. Specifically, the controller parses a communication data structure including an interrupt and a time length into decoded data composed of "0" and "1". Further, the controller may further parse the decoded data according to actual requirements or computational power to obtain decoded data of a further upper layer.
In one example, the decoding rule is preset to be a NEC protocol rule.
The NEC protocol includes a high-level pulse of 9ms, a low-level pulse of 4.5ms, an address code of 8 bits, a data code of 8 bits, and a data code of 8 bits.
S103, extracting target data from the decoded data, wherein the target data comprises configuration information of the gas meter.
In this embodiment, the controller decodes the communication data acquired by the receiving circuit according to S102, and obtains decoded data. And controlling to extract target data from the decoded data according to actual needs. For example, the target data may be configuration data of the gas meter.
In the infrared communication method provided by the application, the infrared communication system comprises a receiving circuit and a controller. The receiving circuit obtains the external infrared signal through the decoding chip. The receiving circuit outputs the infrared signal as communication data, and the communication data comprises the infrared data after structuring. And the controller analyzes the communication data according to a preset structure rule to obtain decoded data. And controlling to extract target data from the decoded data according to actual needs. The target data may be configuration data of the gas meter. In the application, the infrared signals are acquired and directly analyzed, so that the gas meter can directly realize interaction with the terminal equipment through the infrared signals, the cost of converting original Bluetooth into an infrared tool in the gas meter is saved, the maintenance complexity is reduced, the reliability and stability of infrared communication are enhanced, and the after-sale maintenance steps are simplified.
Fig. 3 is a flowchart illustrating another infrared communication method according to an embodiment of the present disclosure. On the basis of the embodiments shown in fig. 1 and fig. 2, as shown in fig. 3, a gas meter is taken as an execution subject, and the method of this embodiment may include the following steps:
s201, acquiring data to be processed, wherein the data to be processed is an infrared signal.
In this embodiment, the hardware portion of the gas meter includes a receiving circuit. The receiving circuit comprises a decoding chip. The decoding chip is used for acquiring an external infrared signal, namely the data to be processed in the step.
Wherein the decoding chip can be as shown in the decoding chip D91 in fig. 4. The decoding chip D91 has the use model of IRM3638T, and the received carrier frequency is 38 kHz. The decoding chip is used for receiving an infrared signal sent by the outside and outputting the infrared signal to the microcontroller to realize the decoding of the infrared signal. The IRM3638T decoding chip is a miniaturized chip suitable for an infrared control system. The decoding chip integrates a pin diode and a preamplifier. The three-pin tube type LED lamp comprises three pin tubes, namely a first pin tube OUT, a second pin tube GND and a third pin tube VS.
In one example, the data to be processed includes two pieces of identical data information stored in succession. Namely, the data to be processed comprises two-pass NEC protocol data, and the data content comprises: a 9ms preamble, a 4.5ms idle, an 8 bit address code, an 8 bit address complement, an 8 bit data code, an 8 bit data complement, a 9ms preamble, a 4.5ms idle, an 8 bit address code, an 8 bit address complement, an 8 bit data code, and an 8 bit data complement. Wherein, the NEC protocol data is transmitted twice in one communication data, and the reliability and stability of the communication data can be effectively improved. On one hand, two-pass NEC protocol data in the communication data can be mutually checked, and the accuracy of the data is ensured. On the other hand, when part of the data is damaged in the transmission process, complete data can be acquired through mutual complementation of two data passes.
In one example, the communication data further includes a stop bit. The stop bit is the last bit of the communication data. When the stop bit is resolved, the controller determines that the resolution of the communication data is finished.
S202, preprocessing the data to be processed to obtain processed data, wherein the preprocessing comprises removing 38KHz carriers in the data to be processed.
In this embodiment, after the receiving circuit obtains the data to be processed through the decoding chip D91, the receiving circuit sends the data to be processed through the pin of the decoding chip D91.
And in the process of sending the data to be processed, the receiving circuit preprocesses the data to be processed, removes 38KHz carrier waves in the data to be processed and obtains processed data.
In this receiver circuit, as shown in fig. 4, three pins of the decoding chip D91 are connected as follows:
wherein, the OUR pin is connected with the HWTX (RP) pin. When the decoding chip D91 does not receive the infrared carrier signal, the OUT pin outputs a high level. When the decoding chip D91 receives the infrared carrier signal, the OUT pin outputs a low level. The HWTX (RP) pin is a special RP pin in an infrared serial port TX pin. The static state output of this pin is a low voltage, i.e., a bit value of "0".
And the GND pin is grounded.
Wherein, VS pin tube is connected with hardware center HW CTR.
Both ends of the resistor R93 are connected to the two connection lines, respectively. One of the connecting lines is a connecting line between the OUR pin and the HWTX (RP) pin. The other connecting line is a connecting line of a VS pin tube and a hardware center HW CTR. The resistor R93 may have a rating of 10K.
In this case, both ends of the capacitor C90 are also connected to the two connecting lines, respectively. Wherein, a connecting line VS pin tube is connected with the connecting line of hardware center HW CTR. The other connecting wire is a connecting wire for grounding a GND pin tube. The capacitance C90 may be sized to be 0.1 uF.
And S203, generating communication data according to the high level, the low frequency and the duration of each pulse in the infrared waveform of the processed data.
In this embodiment, the infrared signal may be mainly displayed by an infrared waveform, which includes high-level and low-level bands. In the receiving circuit, when the decoding chip D91 does not receive the infrared carrier signal, the OUT pin outputs a high level. When the decoding chip D91 receives the infrared carrier signal, the OUT pin outputs a low level. Therefore, the hwtx (rp) pin outputs a corresponding level according to the high level or the low level received by the decoding chip D91.
The receive circuit triggers an interrupt when the level of the hwtx (rp) pin output rises or falls. When the interrupt is triggered, the timer starts counting. The timer records the time interval from each interrupt being triggered to the next interrupt being triggered. The controller acquires the interrupt trigger time and the time interval of the interrupt, and determines that the data is the communication data.
And S204, decoding the communication data by using a preset decoding rule to obtain decoded data.
S205, extracting target data from the data codes, wherein the target data comprises configuration information of the gas meter.
Steps S204 to S205 are similar to steps S102 to S103 in the embodiment of fig. 2, and are not described herein again.
In the infrared communication method provided by the application, the infrared communication system comprises a receiving circuit and a controller. The receiving circuit comprises a decoding chip. The decoding chip is used for acquiring external data to be processed. The receiving circuit preprocesses the data to be processed, removes 38KHz carrier waves in the data to be processed, and obtains processed data. The controller acquires an interrupt trigger time and a time interval of the interrupt, and determines that the data is a composed data structure as communication data. And the controller analyzes the communication data according to a preset structure rule to obtain decoded data. And controlling to extract target data from the decoded data according to actual needs. The target data may be configuration data of the gas meter. In the application, by acquiring the data to be processed and converting the data to be processed into the communication data, the data to be processed can be analyzed inside the gas meter, the cost of converting original Bluetooth into an infrared tool in the gas meter is saved, the maintenance complexity is reduced, and the reliability and the stability of infrared communication are enhanced.
Fig. 5 is a flowchart illustrating another infrared communication method according to an embodiment of the present application. On the basis of the embodiments shown in fig. 1 to fig. 4, as shown in fig. 5, a gas meter is taken as an execution subject, and the method of this embodiment further includes:
s301, communication data are obtained through a receiving circuit.
Step S301 is similar to the step S101 in the embodiment of fig. 2, and this embodiment is not described herein again.
S302, decoding the communication data by using a preset decoding rule to obtain decoded data.
Step S302 is similar to step S102 in the embodiment of fig. 2, and details of this embodiment are not repeated here.
And S303, checking the data code according to the data code and the data inverse code.
In this embodiment, the specific format of the data in the communication data is NEC protocol data. The NEC protocol data comprises a 9ms guiding code, a 4.5ms idle code, an 8-bit address code, an 8-bit data code and an 8-bit data code.
The data code corresponds to the data code, and the address code corresponds to the address code. Therefore, in order to improve the accuracy of data transmission, the decoding may be checked after the communication data is decoded.
When the verification is successful, the controller may determine that the data code and/or address code is the correct data code and/or address code. When the check fails, the controller may determine that an exception exists in the data code and/or the address code.
When the check fails, the controller may send an exception report. The exception report may be used to request the terminal device to send the data to be processed to the gas meter again. Or, the abnormal report can be used for reminding an operator to send the data to be processed to the gas meter again through the terminal equipment.
S304, according to the preset encryption rule, decrypting the decoded data to obtain the decrypted decoded data.
In this embodiment, the data to be processed sent by the terminal device to the gas meter may also be encrypted data. After the gas meter completes the analysis of the data to be processed, the controller can decrypt the decoded data according to a preset encryption rule. The encryption rule may be an existing encryption rule or an improved encryption rule. The communication between the terminal equipment and the gas meter can improve the communication safety through the encryption rule.
In this embodiment, steps S303 and S304 are not limited by the described operation sequence, and may be performed in other sequences or simultaneously. In this embodiment, steps S303 and S304 may be executed by only one step, or by both steps, or by neither step.
S305, extracting target data from the data codes, wherein the target data comprises configuration information of the gas meter.
Step S305 is similar to the step S103 in the embodiment of fig. 2, and details of this embodiment are not repeated here.
In the infrared communication method provided by the application, the infrared communication system comprises a receiving circuit and a controller. The receiving circuit obtains the external infrared signal through the decoding chip. The receiving circuit outputs the infrared signal as communication data, and the communication data comprises the infrared data after structuring. And the controller analyzes the communication data according to a preset structure rule to obtain decoded data. The controller can use the data code and the data code reversal, and the address code reversal in the decoded data to realize the verification of the data code and/or the address code. The controller can also decrypt the decoded data according to a preset encryption rule to obtain decrypted decoded data. And controlling to extract target data from the decoded data according to actual needs. The target data may be configuration data of the gas meter. In the application, the reliability, the safety and the accuracy of the decoded data are improved by checking and/or decrypting the decoded data.
Fig. 6 is a flowchart illustrating another infrared communication method according to an embodiment of the present disclosure. On the basis of the embodiments shown in fig. 1 to fig. 5, as shown in fig. 6, a gas meter is taken as an execution subject, and the method of this embodiment further includes:
s401, according to data to be sent, determining an infrared waveform of the data to be sent, wherein the infrared waveform comprises the level and the duration of each pulse.
In this embodiment, the gas meter further includes a transmitting circuit. When the gas meter needs to send data to the terminal equipment, the gas meter converts the data to be sent into an infrared signal through the sending circuit. The infrared signal is embodied as an infrared waveform including the level and duration of each pulse.
The transmitting circuit may be specifically as shown in fig. 7. The transmitting circuit comprises two pins of HWTX (RP) and PWM (RP), three resistors of R90, R91 and R92, two triodes of Q90 and Q91, and a light-emitting diode of D90.
HWTX (RP) is a special RP pin in an infrared serial port TX pin. Pwm (RP) is a special RP pin of the infrared 38kPWM pins. The static state output of the two pins is low voltage, i.e. the bit value is "0".
One end of the resistor R90 is connected to the pin hwtx (rp), and the other end is connected to the transistor Q90. Resistor R92 has one end connected to pin pwm (rp) and the other end connected to transistor Q91. The rule of the resistor R90 and the resistor R92 may be 10K.
The transistor Q90 has one end connected to the resistor R90, one end connected to the connection line between the transistor Q91 and the resistor R92, and the other end connected to ground. One end of the triode Q91 is connected with the resistor R92, one end of the triode Q91 is connected with the light emitting diode D90, and the other end of the triode Q91 is grounded. The transistor Q90 and the transistor Q91 may be used in a model BC 817.
One end of the light emitting diode D90 is connected with the triode Q91, and the other end is connected with the resistor R91. The LED can be used in the types of IR26-21C, L110, TR8 and the like.
S402, sending data to be sent, wherein the sending mode is PWN carrier wave of 38 KHz.
In this embodiment, the light emitting diode in the transmitting circuit transmits the level and duration of each pulse in the form of an infrared signal. The terminal equipment can acquire data by receiving the infrared signals sent by the light emitting diode. Wherein, the carrier wave is PWN carrier wave of 38KHz when the infrared signal is transmitted.
Fig. 8 shows a schematic structural diagram of a gas meter provided in an embodiment of the present application, and as shown in fig. 8, the gas meter 10 of this embodiment may include:
and the receiving circuit 11 is used for receiving the data to be processed and preprocessing the data to be processed to obtain communication data, wherein the data to be processed is an infrared waveform.
A controller 12, configured to implement the infrared communication method according to any one of the embodiments shown in fig. 1 to 7 according to the communication data.
In an example, the gas meter 10 further includes a transmitting circuit 13, configured to determine an infrared waveform of data to be transmitted according to the data to be transmitted, and transmit the data to be transmitted to a terminal device.
The gas meter 10 provided in the embodiment of the present application may implement the above method embodiment, and for concrete implementation principles and technical effects, reference may be made to the above method embodiment, which is not described herein again.
Fig. 9 shows a schematic structural diagram of another terminal device provided in an embodiment of the present application. As shown in fig. 9, the terminal device 20 of the present embodiment may include:
the obtaining module 21 is configured to obtain a user instruction, where the user instruction is an operation instruction selected by a user through a display interface of a terminal device, and the user instruction is used to instruct a gas meter to execute a corresponding operation.
The generating module 22 is configured to generate the first communication data according to a user instruction.
And the sending module 23 is configured to send the first communication data to the gas meter.
In one example, the terminal device may further include:
and the receiving module is used for acquiring second communication data, and the second communication data is data fed back by the gas meter.
And the analysis module is used for analyzing the second communication data.
And the display module is used for displaying the analysis result of the second communication data.
In one example, the presentation module may be an interactive interface on the terminal device. The interactive interface is used for displaying a control instruction of the gas meter to a user and displaying gas meter feedback data acquired by the terminal equipment.
The terminal device 20 provided in the embodiment of the present application may execute the above method embodiment, and for concrete implementation principles and technical effects, reference may be made to the above method embodiment, which is not described herein again.
Fig. 10 shows a schematic structural diagram of a gas meter communication system according to an embodiment of the present application. On the basis of the embodiments shown in fig. 8 and 9, as shown in fig. 10, the communication system 30 of the present embodiment may include:
and the terminal device 31 is configured to send communication data to the gas meter or receive communication data sent by the gas meter. And the user realizes the control and the check of the gas meter through the terminal equipment.
And the gas meter 32 is used for acquiring and analyzing the communication data sent by the terminal and sending the communication data to the terminal equipment. The gas meter can realize the control of the gas meter according to the communication data sent by the terminal equipment. For example, performing self test operations, feeding back parameter information, etc. The gas meter can also send communication data to the terminal equipment.
The communication system 30 provided in the embodiment of the present application may implement the above method embodiment, and for details of the implementation principle and technical effect, reference may be made to the above method embodiment, which is not described herein again.
The present application also provides a computer-readable storage medium, in which a computer program is stored, and the computer program is used for implementing the methods provided by the above-mentioned various embodiments when being executed by a processor.
The computer-readable storage medium may be a computer storage medium or a communication medium. Communication media includes any medium that facilitates transfer of a computer program from one place to another. Computer storage media may be any available media that can be accessed by a general purpose or special purpose computer. For example, a computer readable storage medium is coupled to the processor such that the processor can read information from, and write information to, the computer readable storage medium. Of course, the computer readable storage medium may also be integral to the processor. The processor and the computer-readable storage medium may reside in an Application Specific Integrated Circuit (ASIC). Additionally, the ASIC may reside in user equipment. Of course, the processor and the computer-readable storage medium may also reside as discrete components in a communication device.
The computer-readable storage medium may be implemented by any type of volatile or nonvolatile Memory device or combination thereof, such as Static Random-Access Memory (SRAM), Electrically-Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk or optical disk. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
Embodiments of the present application further provide a chip, which includes a memory and a processor, where the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that a device in which the chip is installed executes the method in the above various possible embodiments.
It should be understood that the Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present invention may be embodied directly in a hardware processor, or in a combination of the hardware and software modules within the processor.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the division of the modules is only one logical division, and the actual implementation may have another division, for example, a plurality of modules may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or modules, and may be in an electrical, mechanical or other form.
Modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present application may be integrated into one processing unit, or each module may exist alone physically, or two or more modules are integrated into one unit. The unit formed by the modules can be realized in a hardware form, and can also be realized in a form of hardware and a software functional unit.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. Which when executed performs steps comprising the method embodiments described above. And the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same. Although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: it is also possible to modify the solutions described in the previous embodiments or to substitute some or all of them with equivalents. And the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (11)

1. An infrared communication method is characterized by being applied to a gas meter, wherein the gas meter comprises a receiving circuit and a controller, and the method comprises the following steps:
acquiring communication data through the receiving circuit;
decoding the communication data by using a preset decoding rule to obtain decoded data;
and extracting target data from the decoded data, wherein the target data comprises configuration information of the gas meter.
2. The method of claim 1, wherein the obtaining communication data by the receiving circuit comprises:
acquiring data to be processed, wherein the data to be processed is an infrared signal;
preprocessing the data to be processed to obtain processed data, wherein the preprocessing comprises removing 38KHz carriers in the data to be processed;
and generating communication data according to the high level, the low frequency and the duration of each pulse in the infrared waveform of the processed data.
3. The method according to claim 2, wherein the data to be processed comprises two pieces of same data information stored in succession.
4. The method according to claim 3, further comprising a stop bit in the data to be processed, wherein the stop bit is a last bit of the data to be processed and is used for indicating that the data to be processed is received or the processing is completed.
5. The method according to any of claims 1-4, wherein the preset decoding rule is a NEC protocol rule.
6. The method according to any one of claims 1 to 4, wherein before extracting the target data from the decoded data, the method further comprises:
checking a data code in the decoded data according to a data anticode in the decoded data;
and decrypting the decoded data according to a preset encryption rule to obtain decrypted decoded data.
7. The method of claim 1, wherein the gas meter further comprises a transmitting circuit, and the transmitting circuit is applied to the method, and the method comprises:
determining an infrared waveform of the data to be transmitted according to the data to be transmitted, wherein the infrared waveform comprises the level and the duration of each pulse;
and transmitting the data to be transmitted.
8. An infrared communication method is applied to terminal equipment, and the method comprises the following steps:
acquiring a user instruction, wherein the user instruction is an operation instruction selected by a user through a display interface of the terminal equipment, and the user instruction is used for indicating the gas meter to execute corresponding operation;
generating first communication data according to the user instruction;
and sending the first communication data to the gas meter.
9. The method of claim 8, applied to a terminal device, further comprising:
acquiring second communication data, wherein the second communication data is data fed back by the gas meter;
parsing the second communication data;
and displaying the analysis result of the second communication data.
10. A gas meter, characterized in that, the gas meter includes: a receiving circuit and a controller;
the receiving circuit is used for receiving data to be processed and preprocessing the data to be processed to obtain communication data, wherein the data to be processed is an infrared waveform;
a controller for implementing the infrared communication method according to any one of claims 1 to 7 based on the communication data.
11. A terminal device, characterized in that the terminal device comprises:
the first acquisition module is used for acquiring a user instruction, wherein the user instruction is an operation instruction selected by a user through a display interface of the terminal equipment, and the user instruction is used for indicating the gas meter to execute corresponding operation;
the generating module is used for generating first communication data according to the user instruction;
and the sending module is used for sending the first communication data to the gas meter.
CN202011468187.XA 2020-12-14 2020-12-14 Infrared communication method, gas meter and terminal equipment Pending CN114627635A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011468187.XA CN114627635A (en) 2020-12-14 2020-12-14 Infrared communication method, gas meter and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011468187.XA CN114627635A (en) 2020-12-14 2020-12-14 Infrared communication method, gas meter and terminal equipment

Publications (1)

Publication Number Publication Date
CN114627635A true CN114627635A (en) 2022-06-14

Family

ID=81897518

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011468187.XA Pending CN114627635A (en) 2020-12-14 2020-12-14 Infrared communication method, gas meter and terminal equipment

Country Status (1)

Country Link
CN (1) CN114627635A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1873720A (en) * 2006-06-15 2006-12-06 陈绍荣 Method for remote controlling fuel gas meter
CN201751920U (en) * 2009-12-21 2011-02-23 成都九洲电子信息系统有限责任公司 Computer infrared remote control system
CN103051417A (en) * 2012-11-30 2013-04-17 浙江西盈科技有限公司 Fixed code length complementary type coding method for infrared remote controller
CN105118285A (en) * 2015-09-25 2015-12-02 广州视睿电子科技有限公司 Anti-interference infrared remote-control decoding method and system
CN105679004A (en) * 2016-01-06 2016-06-15 深圳市创维群欣安防科技有限公司 Method and system for controlling multiple slave devices with main device
CN109345806A (en) * 2018-11-01 2019-02-15 常州弘度智能科技有限公司 A kind of anti-interference decoding method applied to Digiplex
CN110910629A (en) * 2019-11-04 2020-03-24 杭州海兴电力科技股份有限公司 Infrared remote control signal decoding method and system based on single chip microcomputer and metering device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1873720A (en) * 2006-06-15 2006-12-06 陈绍荣 Method for remote controlling fuel gas meter
CN201751920U (en) * 2009-12-21 2011-02-23 成都九洲电子信息系统有限责任公司 Computer infrared remote control system
CN103051417A (en) * 2012-11-30 2013-04-17 浙江西盈科技有限公司 Fixed code length complementary type coding method for infrared remote controller
CN105118285A (en) * 2015-09-25 2015-12-02 广州视睿电子科技有限公司 Anti-interference infrared remote-control decoding method and system
CN105679004A (en) * 2016-01-06 2016-06-15 深圳市创维群欣安防科技有限公司 Method and system for controlling multiple slave devices with main device
CN109345806A (en) * 2018-11-01 2019-02-15 常州弘度智能科技有限公司 A kind of anti-interference decoding method applied to Digiplex
CN110910629A (en) * 2019-11-04 2020-03-24 杭州海兴电力科技股份有限公司 Infrared remote control signal decoding method and system based on single chip microcomputer and metering device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
何书森等: "《实用电子线路设计速成》", pages: 442 - 443 *

Similar Documents

Publication Publication Date Title
CN112217831B (en) Information interaction method, device and equipment for Internet of things equipment
EP2924669B1 (en) Method and apparatus for transmitting infrared signal and remote controller
CN113595961A (en) Protocol conversion method and system, and gateway device
CN104036628A (en) Intelligent remote controller based on Bluetooth and quick pairing method
US20130178160A1 (en) Systems for facilitating wireless communication and related methods
EP2887225B1 (en) Communication with accessories
CN104796888A (en) Method for connecting WI-FI network by intelligent hardware terminal based on sound waves and system for realizing same
CN108040355B (en) Network access method and system
WO2018049892A1 (en) Data transmission method and apparatus, and terminal
TWI783851B (en) Bluetooth communication system capable of increasing generation efficiency of cypher keys required for data transmission between bluetooth host device and bluetooth device set, and related bluetooth device set
US10959214B2 (en) Information processing method, communication device, and computer storage medium for ensuring correct generation of a check bit
CN113840266A (en) Bluetooth pairing method, device, system, electronic equipment and storage medium
KR20200112494A (en) Electronic apparatus and method for controlling thereof
CN112069008A (en) Equipment debugging information acquisition method and device and equipment debugging information generation method
Yang et al. Inside Radio: An Attack and Defense Guide
US20190197010A1 (en) Data transmission method and mobile terminal
CN103812535A (en) Bluetooth equipment connecting method and Bluetooth equipment
CN104333401A (en) Methods, devices and systems for sending and receiving Bluetooth data
WO2015120759A1 (en) Audio signal transmission method, mobile terminal and intelligent key device
CN105336152A (en) Infrared emitter and infrared remote control method
CN114627635A (en) Infrared communication method, gas meter and terminal equipment
CN111338673B (en) Equipment debugging method and device, electronic equipment and storage medium
CN104113820A (en) Method for data communication between IOS and Bluetooth module
CN103377550B (en) Composite decoding method and device for infrared signal
CN106844115B (en) Simulation verification method for FPGA (field programmable Gate array) serial port function of optical fiber gyroscope

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20220614