Near-infrared communication module and method
By designing a near-infrared communication module that integrates power supply, USB to serial port, infrared transmitting and receiving circuits, the existing modules have solved the problems in data transmission reliability, power supply stability and infrared signal processing, and efficient and reliable data transmission and system stability are achieved.
Patent Information
- Application Number
- CN202411743815.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-30
- Publication Date
- 2025-03-07
AI Technical Summary
The existing near-infrared communication modules have poor data transmission reliability with computers, prone to data loss or errors, and the power supply circuit lacks an effective voltage regulation and protection mechanism, signal conversion is not efficient enough, compatibility is poor, and the infrared transmitting and receiving circuit design is unreasonable, which affects the communication distance and effect.
A near-infrared communication module including a power supply circuit, a USB to serial port circuit, an infrared transmitting circuit and an infrared receiving circuit was designed. The power supply circuit adopts a voltage regulator composed of a linear regulator and a capacitor. The USB to serial port circuit uses a CH340N chip. The infrared transmitting and receiving circuit is composed of a PNP transistor and an infrared transmitting/receiving tube. It is integrated on the same circuit board to add protection circuits to prevent voltage spikes.
It realizes efficient and reliable data transmission between the computer and the near-infrared communication module, ensures data integrity and accuracy, improves the system's maintainability and scalability, ensures power supply stability and security, and optimizes the transmission and reception effects of infrared signals.
Smart Images

Figure CN119583985A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of near infrared communication, and in particular to a near infrared communication module and method. Background Art
[0002] Near-infrared photoelectric communication technology is a technology that uses light waves in the near-infrared spectrum for data transmission. Near-infrared light generally refers to electromagnetic waves with a wavelength range of 700 nanometers to 1400 nanometers. Near-infrared photoelectric communication technology has a variety of applications, including indoor wireless communication, short-distance data transmission, optical Internet networks and other fields. Near-infrared photoelectric communication is suitable for short-distance data transmission, especially short-distance data transmission of electric energy meters. There is no electrical connection between near-infrared photoelectric communication and the electric energy meter, thus avoiding the risk of electric shock. Near-infrared light will not penetrate the case of the electric energy meter and the housing of the photoelectric communication tool, thereby reducing the risk of signal interference.
[0003] In the prior art, the technical problems existing in the near-infrared communication module are mainly manifested in the following aspects: First, the reliability of data transmission between the computer is poor, and data loss or errors are prone to occur, which affects the accuracy and stability of communication. In the prior art, the near-infrared communication module adopts a decentralized design, and each circuit component is distributed in different positions, which makes maintenance difficult and is not easy to expand or upgrade functions according to needs. Second, the power supply circuit of the near-infrared communication module lacks an effective voltage stabilization and protection mechanism, resulting in unstable power supply voltage, which is easily affected by external interference such as voltage spikes, thereby affecting the normal operation and safety performance of the module. Third, the signal conversion between the near-infrared communication module and the computer is not efficient enough, and the compatibility is poor, resulting in poor data transmission or inability to communicate effectively with other devices or systems. Fourth, the infrared transmission and receiving circuit design of the near-infrared communication module is unreasonable, resulting in insufficient transmission power or low receiving sensitivity, affecting the communication distance and effect.
[0004] Therefore, it is of great significance to design a near-infrared communication module and method to solve the above problems. Summary of the invention
[0005] In order to solve the problems existing in the background technology, the present invention provides a near-infrared communication module, which includes a power supply circuit, a USB to serial port circuit, an infrared transmitting circuit and an infrared receiving circuit. The power supply circuit provides a stable power supply for the entire infrared communication module. The USB to serial port circuit serves as an interface between a communication tool and a computer, converts a USB signal into a serial port signal, and communicates with the infrared transmitting and receiving circuits; the infrared transmitting circuit transmits a near-infrared light signal, which is received by the infrared receiving circuit and converted into a serial port signal, and transmitted to the computer for processing; wherein:
[0006] The power supply circuit is provided with a voltage stabilizing circuit composed of a linear voltage regulator U2, a capacitor CV1, and a capacitor CV2. The input end of the linear voltage regulator U2 is connected to the USB input power supply 5V; the output end of the linear voltage regulator U2 is a regulated power supply, and the capacitors CV1 and CV2 are respectively connected between the output end of U2 and the ground to filter and stabilize the voltage;
[0007] The USB to serial port circuit is composed of a USB to serial port chip CH340N and a capacitor C2. The UD+ pin of the CH340N chip is connected to the USB signal terminal UD+; the UD- pin of the CH340N chip is connected to the USB signal terminal UD-; the GND pin of the CH340N chip is grounded; the VCC pin of the CH340N chip is connected to the regulated power supply output by the linear regulator U2, and the capacitor C2 is connected in parallel between the VCC pin and the ground; the TXD pin of the CH340N chip is the data transmission pin, which is connected to the infrared transmission circuit; the RXD pin of the CH340N chip is the data reception pin, which is connected to the infrared receiving circuit;
[0008] The infrared transmitting circuit is composed of a PNP transistor QI1, a resistor RI1, a resistor RI2, a resistor RI3 and an infrared transmitting tube DI1; the emitter of the transistor QI1 is connected to the voltage-regulated power supply output by the linear voltage regulator U2; the base of the transistor QI1 is connected to the TXD pin of the CH340N chip through the resistor RI1; the collector of the transistor QI1 is connected to the anode of the infrared transmitting tube DI1 through the resistor RI3, and the cathode of the infrared transmitting tube DI1 is grounded; the resistor RI2 is connected in parallel with the infrared transmitting tube DI1 to adjust the transmitting current;
[0009] The infrared receiving circuit is composed of a PNP transistor QI2, a resistor RI4, a resistor RI5 and an infrared receiving tube DI2; the emitter of the transistor QI2 is connected to the regulated power supply output by the linear regulator U2; the base of the transistor QI2 is grounded through the resistor RI5 and connected to the infrared receiving tube DI2; the collector of the transistor QI2 is connected to the RXD pin of the CH340N chip and one end of the resistor RI4, and the other end of the resistor RI4 is grounded.
[0010] In the preferred solution, the power supply circuit also includes a protection circuit, which consists of a bidirectional TVS tube D1, a bidirectional TVS tube D2 and a bidirectional TVS tube D3; one end of the bidirectional TVS tube D1 is connected to the USB input power 5V, and the other end is grounded; one end of the bidirectional TVS tube D2 is connected to the USB signal terminal UD+, and the other end is grounded; one end of the bidirectional TVS tube D3 is connected to the USB signal terminal UD-, and the other end is grounded.
[0011] In a preferred solution, the power supply circuit, the USB to serial port circuit, the infrared transmitting circuit and the infrared receiving circuit are integrated on the same circuit board, and the circuit board is connected to a USB communication interface.
[0012] The method for communicating using a near infrared communication module comprises the following steps:
[0013] S1, the computer is connected to the near-infrared communication module through the USB interface, provides a 5V DC power supply for the near-infrared communication tool, and sends data to the near-infrared communication tool;
[0014] S2, the power supply circuit receives 5V power from the computer; the voltage is stabilized to 3.3V through the linear regulator U2 and capacitors CV1 and CV2; bidirectional TVS tubes D1, D2, and D3 are used to protect the circuit from voltage spikes;
[0015] S3, the CH340N chip of the USB to serial port circuit receives the USB signal from the computer; under the power supply of 3.3V, the USB signal is converted into a serial port signal; the TXD pin outputs the serial port data to the infrared transmitting circuit, and the RXD pin receives the serial port data from the infrared receiving circuit;
[0016] When the TXD pin of the infrared transmitting circuit CH340N chip outputs a high level, the PNP transistor QI1 is turned on; the current passes through resistors RI1, RI3 and the infrared transmitting tube DI1, causing DI1 to emit a near-infrared light signal; the resistor RI2 is connected in parallel with DI1 to adjust the transmitting current and optimize the transmitting power;
[0017] When the infrared receiving tube DI2 of the infrared receiving circuit receives a near-infrared light signal, a current is generated; the current passes through the resistor RI4 and the PNP transistor QI2, making QI2 conductive; the collector of QI2 is connected to the RXD pin of the CH340N chip, passing the received signal to the CH340N; the CH340N chip converts the received serial port signal into a USB signal and transmits it back to the computer through the USB interface.
[0018] In a preferred solution, the specific process of step S2 includes:
[0019] The linear regulator U2 receives a 5V input power supply, and filters it through the capacitors CV1 and CV2 at the input and output ends of the linear regulator U2 to remove high-frequency noise and ripple in the power supply. The linear regulator U2 adjusts its internal resistance according to the difference between the input voltage and the output voltage to ensure that the output is a stable voltage of 3.3V; the bidirectional TVS tube D1, the bidirectional TVS tube D2, and the bidirectional TVS tube D3 protect the circuit from voltage spikes, one end of D1 is connected to the USB input power supply 5V, and the other end is grounded; when a positive voltage spike appears in the input power supply, the tube D1 is turned on and the excess voltage is introduced into the ground line; D2 and D3 are connected to the USB signal terminals UD+ and UD- respectively, and the other ends are grounded; when positive and negative voltage spikes appear at the signal end, D2 and D3 are turned on respectively and the excess voltage is introduced into the ground line.
[0020] The specific process of step S3 is:
[0021] S31, USB signal reception and analysis: The computer sends data through the USB interface and is received by the CH340N chip; USB data includes a data packet header, data payload, and check digit; the CH340N chip analyzes the received USB signal, identifies the data packet header in the signal, extracts the data payload, and verifies the check digit to ensure the integrity and accuracy of the data;
[0022] S32, data encoding and decoding: Before converting the USB signal into a serial port signal, the CH340N chip encodes the data and converts the binary data into a format suitable for serial port transmission; when receiving the serial port signal from the infrared receiving circuit, the CH340N chip also decodes the data and restores the binary data in the serial port signal to the original data payload according to the preset protocol and rules;
[0023] S33, format conversion: When converting USB signals to serial port signals, the CH340N chip will adjust the data transmission format, baud rate, data bit length, and stop bit number parameters according to the protocol requirements of the serial port communication to ensure the compatibility and reliability of the serial port signal; when converting the serial port signal back to a USB signal, the CH340N chip performs format conversion, re-encapsulates the data load in the serial port signal into a USB data packet, and adds the corresponding header and check bit to meet the requirements of USB communication;
[0024] S34, serial port signal output and reception: The converted serial port signal is output through the TXD pin of the CH340N chip; the TXD pin is connected to the infrared transmitting circuit, and the serial port data is sent to the infrared transmitting circuit in the form of electrical signals for further processing; at the same time, the RXD pin of the CH340N chip receives the serial port data from the infrared receiving circuit; these data come from other near-infrared communication devices or sensors, and are transmitted to the CH340N chip after being processed by the infrared receiving circuit;
[0025] S35, infrared transmission and reception: When the TXD pin of the CH340N chip outputs a high level, it triggers the PNP transistor QI1 in the infrared transmission circuit to turn on, and then the infrared transmitting tube DI1 emits a near-infrared light signal; this process is carried out in parallel with the signal conversion process of the CH340N chip; after receiving the near-infrared light signal, the infrared receiving tube DI2 will generate current and trigger the PNP transistor QI2 to turn on, and transmit the signal to the RXD pin of the CH340N chip, so that the CH340N chip receives the serial port data from other devices and performs corresponding processing;
[0026] S36, USB signal return: After receiving the serial port data from the infrared receiving circuit, the CH340N chip converts the data into USB signals again; this process is the opposite of the conversion process from USB signals to serial port signals; the converted USB signals are transmitted back to the computer through the USB interface; the computer receives the data or confirmation information returned by the near-infrared communication tool, completing the entire communication process.
[0027] The beneficial effects achieved by the present invention are:
[0028] First, the present invention designs a communication method including the steps of connecting a computer to a near-infrared communication module via a USB interface, voltage stabilization of a power supply circuit, conversion of USB signals into serial port signals, infrared emission and reception, and conversion of serial port signals back into USB signals. This method realizes efficient and reliable data transmission between a computer and a near-infrared communication module, while ensuring the integrity and accuracy of the data.
[0029] Second, the power circuit, USB to serial port circuit, infrared transmitting circuit and infrared receiving circuit are integrated on the same circuit board to form an independent near-infrared communication module. The modular design improves the maintainability and scalability of the system, facilitates integration into various devices, and reduces development and maintenance costs.
[0030] Third, a voltage stabilization circuit consisting of a linear regulator U2, capacitors CV1 and CV2, and a protection circuit consisting of bidirectional TVS tubes D1, D2, and D3 are used to ensure power stability and prevent voltage spikes. A stable 3.3V power supply is provided, and the protection circuit effectively prevents damage to the circuit caused by voltage spikes, improving the reliability and safety of the system.
[0031] Fourth, the USB to serial port chip CH340N is used to realize the conversion between USB signal and serial port signal, and the capacitor C2 is used for filtering. This simplifies the communication interface between the computer and the near infrared communication module, improves the efficiency and compatibility of data transmission, and the filtering capacitor ensures the stability of the signal.
[0032] Fifth, the infrared transmitting circuit is composed of PNP transistor QI1, resistors RI1, RI2, RI3 and infrared transmitting tube DI1, and the infrared receiving circuit is composed of PNP transistor QI2, resistors RI4, RI5 and infrared receiving tube DI2. It realizes efficient transmission and reception of near-infrared light signals, adjusts the transmission current to optimize the transmission power, and ensures the receiving sensitivity. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 is a circuit diagram of a power supply circuit of the present invention.
[0034] Figure 2The present invention is a circuit diagram of a USB to serial port circuit.
[0035] Figure 3 This is the circuit diagram of the infrared transmitting circuit.
[0036] Figure 4 This is the circuit diagram of the infrared receiving circuit.
[0037] Figure 5 The present invention is a flow chart of the communication between an electric energy meter and a computer using a communication photoelectric head equipped with a near-infrared communication module of the present invention. DETAILED DESCRIPTION
[0038] The technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the present invention. In addition, the forms of the various structures recorded in the following embodiments are merely illustrative, and the present invention is not limited to the various structures recorded in the following embodiments. All other embodiments obtained by ordinary technicians in this field without making creative work belong to the scope of protection of the present invention.
[0039] Reference Figure 1 - Figure 5 A near-infrared communication module includes a power supply circuit, a USB to serial port circuit, an infrared transmitting circuit and an infrared receiving circuit. A near-infrared communication tool includes a power supply circuit, a USB to serial port circuit, an infrared transmitting circuit and an infrared receiving circuit.
[0040] Power supply circuit (with Figure 1 ) includes a voltage stabilizing circuit and a protection circuit. The voltage stabilizing circuit includes a linear voltage regulator U2 and capacitors CV1 and CV2. The input end of the linear voltage regulator U2 is connected to the USB input power supply 5V, and the capacitor CV2 is connected between the input end of U2 and the ground; the output end of the linear voltage regulator is the communication tool power supply 3.3V, and the power supply CV1 is connected between the output end of U2 and the ground. The capacitance values of capacitors CV1 and CV2 are set according to the specification of the linear voltage regulator U2. The protection circuit includes bidirectional TVS tubes D1, D2, and D3. One end of the bidirectional TVS tube D1 is connected to the USB input power supply 5V, and the other end is grounded; one end of the bidirectional TVS tube D2 is connected to the USB signal terminal UD+, and the other end is grounded; one end of the bidirectional TVS tube D3 is connected to the USB signal terminal UD-, and the other end is grounded.
[0041] USB to serial port circuit (attached Figure 2) includes USB to serial port chip CH340N and capacitor C2. USB to serial port chip CH340N has two power supply working modes: 5V power supply working mode and 3.3V power supply working mode. If 5V power supply working mode is selected, a capacitor with the same capacitance as capacitor C2 needs to be connected between V3 pin (pin 8) of CH340N chip and ground. Because the chip withstand voltage peak is low, this communication tool design uses 3.3V power supply working mode. The UD+ pin (pin 1) of the CH340N chip is connected to the USB signal terminal UD+; the UD- pin (pin 2) of the CH340N chip is connected to the USB signal terminal UD-; the GND pin (pin 3) of the CH340N chip is grounded; the RTS# pin (pin 4) of the CH340N chip is vacant; the VCC pin (pin 5) of the CH340N chip is connected to the output power supply 3.3V of the linear regulator and one end of the capacitor C2, and the other end of the capacitor C2 is grounded; the TXD pin (pin 6) of the CH340N chip is connected to the resistor RI1; the RXD pin (pin 7) of the CH340N chip is connected to the collector of the transistor QI2 and the resistor RI4; the CH340N chip outputs the power supply 3.3V of the linear regulator.
[0042] Infrared transmitter circuit (attached Figure 3 ) includes PNP transistor QI1, resistors RI1, RI2, RI3, and infrared emitting tube DI1. The emitter of transistor QI1 is connected to the linear regulator output power supply 3.3V; the base of transistor QI1 is connected to resistor RI1, and the other end of resistor RI1 is connected to the TXD pin (pin 6) of the CH340N chip; the collector of transistor QI1 is connected to resistor RI3, and the other end of resistor RI3 is connected to the anode of infrared emitting tube DI1, and the cathode of infrared emitting tube DI1 is grounded; resistor RI2 is connected in parallel with infrared emitting tube DI1.
[0043] Infrared receiving circuit (attached Figure 4 ) includes a PNP transistor QI2, resistors RI4, RI25, and an infrared receiving tube DI2. The emitter of the transistor QI2 is connected to the cathode of the transistor QI2 and the output power supply 3.3V of the linear regulator; the base of the transistor QI2 is connected to the anode of the transistor QI2 and one end of the resistor RI5, and the other end of the resistor RI5 is grounded; the collector of the transistor QI2 is connected to the RXD pin (pin 7) of the CH340N chip and one end of the resistor RI4, and the other end of the resistor RI4 is grounded.
[0044] The power supply circuit, the USB to serial port circuit, the infrared transmitting circuit and the infrared receiving circuit are integrated on the same circuit board, and the circuit board is connected with a USB communication interface.
[0045] Embodiment 1: This embodiment introduces a method for communication using the near infrared communication module of the present invention, comprising the following steps:
[0046] S1, the computer is connected to the near-infrared communication module through the USB interface, provides a 5V DC power supply for the near-infrared communication tool, and sends data to the near-infrared communication tool;
[0047] S2, the power supply circuit receives a 5V power supply from the computer; the voltage is stabilized to 3.3V through the linear regulator U2 and capacitors CV1 and CV2; the bidirectional TVS tubes D1, D2, and D3 are used to protect the circuit from voltage spikes; the linear regulator U2 receives a 5V input power supply, and filters it through the capacitors CV1 and CV2 at the input and output ends of the linear regulator U2 to remove high-frequency noise and ripple in the power supply. The linear regulator U2 adjusts its internal resistance according to the difference between the input voltage and the output voltage to ensure that the output is a stable voltage of 3.3V; the bidirectional TVS tubes D1, D2, and D3 protect the circuit from voltage spikes, one end of D1 is connected to the USB input power supply 5V, and the other end is grounded; when a positive voltage spike appears in the input power supply, the D1 tube is turned on and the excess voltage is introduced into the ground wire; D2 and D3 are connected to the USB signal terminals UD+ and UD- respectively, and the other ends are grounded; when positive and negative voltage spikes appear at the signal terminal, D2 and D3 are turned on respectively, and the excess voltage is introduced into the ground wire.
[0048] S3, the CH340N chip of the USB to serial port circuit receives the USB signal from the computer; under the power supply of 3.3V, the USB signal is converted into a serial port signal; the TXD pin outputs the serial port data to the infrared transmitting circuit, and the RXD pin receives the serial port data from the infrared receiving circuit;
[0049] When the TXD pin of the infrared transmitting circuit CH340N chip outputs a high level, the PNP transistor QI1 is turned on; the current passes through resistors RI1, RI3 and the infrared transmitting tube DI1, causing DI1 to emit a near-infrared light signal; the resistor RI2 is connected in parallel with DI1 to adjust the transmitting current and optimize the transmitting power;
[0050] When the infrared receiving tube DI2 of the infrared receiving circuit receives a near-infrared light signal, a current is generated; the current passes through the resistor RI4 and the PNP transistor QI2, making QI2 conductive; the collector of QI2 is connected to the RXD pin of the CH340N chip, and the received signal is transmitted to the CH340N; the CH340N chip converts the received serial port signal into a USB signal and transmits it back to the computer through the USB interface. The specific detailed process is as follows:
[0051] S31, USB signal reception and analysis: The computer sends data through the USB interface and is received by the CH340N chip; USB data includes a data packet header, data payload, and check digit; the CH340N chip analyzes the received USB signal, identifies the data packet header in the signal, extracts the data payload, and verifies the check digit to ensure the integrity and accuracy of the data;
[0052] S32, data encoding and decoding: Before converting the USB signal into a serial port signal, the CH340N chip encodes the data and converts the binary data into a format suitable for serial port transmission; when receiving the serial port signal from the infrared receiving circuit, the CH340N chip also decodes the data and restores the binary data in the serial port signal to the original data payload according to the preset protocol and rules;
[0053] S33, format conversion: When converting USB signals to serial port signals, the CH340N chip will adjust the data transmission format, baud rate, data bit length, and stop bit number parameters according to the protocol requirements of the serial port communication to ensure the compatibility and reliability of the serial port signal; when converting the serial port signal back to a USB signal, the CH340N chip performs format conversion, re-encapsulates the data load in the serial port signal into a USB data packet, and adds the corresponding header and check bit to meet the requirements of USB communication;
[0054] S34, serial port signal output and reception: The converted serial port signal is output through the TXD pin of the CH340N chip; the TXD pin is connected to the infrared transmitting circuit, and the serial port data is sent to the infrared transmitting circuit in the form of electrical signals for further processing; at the same time, the RXD pin of the CH340N chip receives the serial port data from the infrared receiving circuit; these data come from other near-infrared communication devices or sensors, and are transmitted to the CH340N chip after being processed by the infrared receiving circuit;
[0055] S35, infrared transmission and reception: When the TXD pin of the CH340N chip outputs a high level, it triggers the PNP transistor QI1 in the infrared transmission circuit to turn on, and then the infrared transmitting tube DI1 emits a near-infrared light signal; this process is carried out in parallel with the signal conversion process of the CH340N chip; after receiving the near-infrared light signal, the infrared receiving tube DI2 will generate current and trigger the PNP transistor QI2 to turn on, and transmit the signal to the RXD pin of the CH340N chip, so that the CH340N chip receives the serial port data from other devices and performs corresponding processing;
[0056] S36, USB signal return: After receiving the serial port data from the infrared receiving circuit, the CH340N chip converts the data into USB signals again; this process is the opposite of the conversion process from USB signals to serial port signals; the converted USB signals are transmitted back to the computer through the USB interface; the computer receives the data or confirmation information returned by the near-infrared communication tool, completing the entire communication process.
[0057] Embodiment 2, this embodiment introduces the detailed process of communication between an electric energy meter and a computer through a communication photoelectric head equipped with a near-infrared communication module of the present invention through a specific application case, wherein an infrared transmitting circuit and an infrared receiving circuit are integrated inside the electric energy meter.
[0058] The communication photoelectric head equipped with the near-infrared communication module is inserted into the computer through the USB interface, and the computer is installed with the WIN11 operating system. The USB interface of the computer detects the new device and tries to load the corresponding driver.
[0059] The near-infrared communication module uses the USB-to-serial chip CH340N, and the Windows 11 system automatically tries to load the driver of CH340N. If the system does not have the driver pre-installed, the user needs to manually install it from the computer device manager or download the driver from the official website for installation. After installing the driver, open the host computer software for the energy meter communication. The host computer software communicates with the near-infrared communication module through the USB interface. The energy meter integrates an infrared transmitting circuit and an infrared receiving circuit, which sends the data of the energy meter through a near-infrared light signal and receives data from a computer or other device. Aim the communication photoelectric head at the near-infrared communication module on the energy meter. Make sure that the distance between the photoelectric head and the communication module is within the effective communication range and that there are no obstacles blocking the light path.
[0060] When the host computer software sends data, the computer transmits the data to the near-infrared communication module through the USB interface. The near-infrared communication module converts the USB signal into a serial port signal through the USB to serial port circuit. After the infrared transmitting circuit receives the serial port signal, it converts it into a near-infrared light signal and transmits it through the photoelectric head. After the near-infrared communication module on the electric energy meter receives the light signal, it converts it into a serial port signal through the infrared receiving circuit. The electric energy meter processes the received data internally and responds as needed. After the electric energy meter processes the received data, it generates response data as needed.
[0061] The response data is converted into a near-infrared light signal by the infrared transmitting circuit of the near-infrared communication module on the electric energy meter and transmitted. The near-infrared communication module on the computer receives the light signal through the infrared receiving circuit and converts it into a serial port signal. The USB to serial port circuit converts the serial port signal into a USB signal and transmits it to the computer through the USB interface. The host computer software processes and displays the response data after receiving it. The host computer software confirms that the communication is successful and can proceed to the next step or disconnect.
[0062] The whole process demonstrates the high efficiency and safety of data transmission between the electric energy meter and the computer by the near infrared communication module. Through the coordinated work of the USB to serial port circuit, infrared transmitting circuit and infrared receiving circuit, reliable data transmission is achieved. At the same time, near infrared optical communication avoids the electric shock hazard and signal interference caused by electrical connection, and improves the safety and reliability of communication.
[0063] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A near infrared communication module, characterized in that: It includes: Power supply circuit, USB to serial port circuit, infrared transmitting circuit and infrared receiving circuit. The power supply circuit provides stable power for the entire infrared communication module. The USB to serial port circuit serves as an interface between the communication tool and the computer, converts USB signals into serial port signals, and communicates with the infrared transmitting and receiving circuits. The infrared transmitting circuit transmits near-infrared light signals, which are received by the infrared receiving circuit and converted into serial port signals, and transmitted to the computer for processing. Among them: The power supply circuit is provided with a voltage stabilizing circuit composed of a linear voltage regulator U2, a capacitor CV1, and a capacitor CV2. The input end of the linear voltage regulator U2 is connected to the USB input power supply 5V; the output end of the linear voltage regulator U2 is a regulated power supply, and the capacitors CV1 and CV2 are respectively connected between the output end of U2 and the ground to filter and stabilize the voltage; The USB to serial port circuit is composed of a USB to serial port chip CH340N and a capacitor C2. The UD+ pin of the CH340N chip is connected to the USB signal terminal UD+; the UD- pin of the CH340N chip is connected to the USB signal terminal UD-; the GND pin of the CH340N chip is grounded; the VCC pin of the CH340N chip is connected to the regulated power supply output by the linear regulator U2, and the capacitor C2 is connected in parallel between the VCC pin and the ground; the TXD pin of the CH340N chip is the data transmission pin, which is connected to the infrared transmission circuit; the RXD pin of the CH340N chip is the data reception pin, which is connected to the infrared receiving circuit; The infrared transmitting circuit is composed of a PNP transistor QI1, a resistor RI1, a resistor RI2, a resistor RI3 and an infrared transmitting tube DI1; the emitter of the transistor QI1 is connected to the voltage-regulated power supply output by the linear voltage regulator U2; the base of the transistor QI1 is connected to the TXD pin of the CH340N chip through the resistor RI1; the collector of the transistor QI1 is connected to the anode of the infrared transmitting tube DI1 through the resistor RI3, and the cathode of the infrared transmitting tube DI1 is grounded; the resistor RI2 is connected in parallel with the infrared transmitting tube DI1 to adjust the transmitting current; The infrared receiving circuit is composed of a PNP transistor QI2, a resistor RI4, a resistor RI5 and an infrared receiving tube DI2; the emitter of the transistor QI2 is connected to the regulated power supply output by the linear regulator U2; the base of the transistor QI2 is grounded through the resistor RI5 and connected to the infrared receiving tube DI2; the collector of the transistor QI2 is connected to the RXD pin of the CH340N chip and one end of the resistor RI4, and the other end of the resistor RI4 is grounded.
2. A near infrared communication module according to claim 1, characterized in that: The power supply circuit also includes a protection circuit, which consists of a bidirectional TVS tube D1, a bidirectional TVS tube D2 and a bidirectional TVS tube D3; one end of the bidirectional TVS tube D1 is connected to the USB input power 5V, and the other end is grounded; one end of the bidirectional TVS tube D2 is connected to the USB signal terminal UD+, and the other end is grounded; one end of the bidirectional TVS tube D3 is connected to the USB signal terminal UD-, and the other end is grounded.
3. A near infrared communication module according to claim 2, characterized in that: The power supply circuit, the USB to serial port circuit, the infrared transmitting circuit and the infrared receiving circuit are integrated on the same circuit board, and the circuit board is connected with a USB communication interface.
4. A method for communication using the near infrared communication module as claimed in claim 3, characterized in that: The steps include: S1, the computer is connected to the near-infrared communication module through the USB interface, provides a 5V DC power supply for the near-infrared communication tool, and sends data to the near-infrared communication tool; S2, the power supply circuit receives 5V power from the computer; the voltage is stabilized to 3.3V through the linear regulator U2 and capacitors CV1 and CV2; bidirectional TVS tubes D1, D2, and D3 are used to protect the circuit from voltage spikes; S3, the CH340N chip of the USB to serial port circuit receives the USB signal from the computer; under the power supply of 3.3V, the USB signal is converted into a serial port signal; the TXD pin outputs the serial port data to the infrared transmitting circuit, and the RXD pin receives the serial port data from the infrared receiving circuit; When the TXD pin of the infrared transmitting circuit CH340N chip outputs a high level, the PNP transistor QI1 is turned on; the current passes through resistors RI1, RI3 and the infrared transmitting tube DI1, causing DI1 to emit a near-infrared light signal; the resistor RI2 is connected in parallel with DI1 to adjust the transmitting current and optimize the transmitting power; When the infrared receiving tube DI2 of the infrared receiving circuit receives a near-infrared light signal, a current is generated; the current passes through the resistor RI4 and the PNP transistor QI2, making QI2 conductive; the collector of QI2 is connected to the RXD pin of the CH340N chip, passing the received signal to the CH340N; the CH340N chip converts the received serial port signal into a USB signal and transmits it back to the computer through the USB interface.
5. The detection method according to claim 4, characterized in that: The specific process of step S2 includes: The linear regulator U2 receives a 5V input power supply, and filters it through the capacitors CV1 and CV2 at the input and output ends of the linear regulator U2 to remove high-frequency noise and ripple in the power supply. The linear regulator U2 adjusts its internal resistance according to the difference between the input voltage and the output voltage to ensure that the output is a stable voltage of 3.3V; the bidirectional TVS tube D1, the bidirectional TVS tube D2, and the bidirectional TVS tube D3 protect the circuit from voltage spikes, one end of D1 is connected to the USB input power supply 5V, and the other end is grounded; when a positive voltage spike appears in the input power supply, the tube D1 is turned on and the excess voltage is introduced into the ground line; D2 and D3 are connected to the USB signal terminals UD+ and UD- respectively, and the other ends are grounded; when positive and negative voltage spikes appear at the signal end, D2 and D3 are turned on respectively and the excess voltage is introduced into the ground line.
6. The method according to claim 4, characterized in that: The specific process of step S3 is: S31, USB signal reception and analysis: The computer sends data through the USB interface and is received by the CH340N chip; USB data includes a data packet header, data payload, and check digit; the CH340N chip analyzes the received USB signal, identifies the data packet header in the signal, extracts the data payload, and verifies the check digit to ensure the integrity and accuracy of the data; S32, data encoding and decoding: Before converting the USB signal into a serial port signal, the CH340N chip encodes the data and converts the binary data into a format suitable for serial port transmission; when receiving the serial port signal from the infrared receiving circuit, the CH340N chip also decodes the data and restores the binary data in the serial port signal to the original data payload according to the preset protocol and rules; S33, format conversion: When converting USB signals to serial port signals, the CH340N chip will adjust the data transmission format, baud rate, data bit length, and stop bit number parameters according to the protocol requirements of the serial port communication to ensure the compatibility and reliability of the serial port signal; when converting the serial port signal back to a USB signal, the CH340N chip performs format conversion, re-encapsulates the data load in the serial port signal into a USB data packet, and adds the corresponding header and check bit to meet the requirements of USB communication; S34, serial port signal output and reception: The converted serial port signal is output through the TXD pin of the CH340N chip; the TXD pin is connected to the infrared transmitting circuit, and the serial port data is sent to the infrared transmitting circuit in the form of electrical signals for further processing; at the same time, the RXD pin of the CH340N chip receives the serial port data from the infrared receiving circuit; these data come from other near-infrared communication devices or sensors, and are transmitted to the CH340N chip after being processed by the infrared receiving circuit; S35, infrared transmission and reception: When the TXD pin of the CH340N chip outputs a high level, it triggers the PNP transistor QI1 in the infrared transmission circuit to turn on, and then the infrared transmitting tube DI1 emits a near-infrared light signal; this process is carried out in parallel with the signal conversion process of the CH340N chip; after receiving the near-infrared light signal, the infrared receiving tube DI2 will generate current and trigger the PNP transistor QI2 to turn on, and transmit the signal to the RXD pin of the CH340N chip, so that the CH340N chip receives the serial port data from other devices and performs corresponding processing; S36, USB signal return: After receiving the serial port data from the infrared receiving circuit, the CH340N chip converts the data into USB signals again; this process is the opposite of the conversion process from USB signals to serial port signals; the converted USB signals are transmitted back to the computer through the USB interface; the computer receives the data or confirmation information returned by the near-infrared communication tool, completing the entire communication process.