Two-wire system sensor interface circuit
By using time-division multiplexing and high-low level technology of PS lines and GND lines in the sensor interface circuit, two-way communication and short-circuit protection between the sensor and the main control circuit are realized, which solves the problem of difficulty in realizing two-way communication in the existing technology and To solve the problem of high power consumption, a sensor interface circuit with simple connection and low power consumption is implemented.
Patent Information
- Application Number
- CN202410631940.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-21
- Publication Date
- 2024-09-03
AI Technical Summary
It is difficult for existing sensor circuits to achieve two-way communication when connected to the main control circuit, which can easily lead to defects such as power supply overload, and the connection lines are complex and the power consumption is high.
Design a two-wire sensor interface circuit to realize power supply, command transmission, information feedback and short-circuit detection through PS line and GND line. It adopts time-division multiplexing and high-low level technology, and the communication sequence is agreed between the main control circuit and the sensor circuit. Realize two-way transmission of information and set up short-circuit protection devices in the sensor network.
It realizes the "one-to-many" networking form and has the significant advantages of short-circuit alarm, plug-and-play, simple connection lines, and extremely low overall power consumption.
Smart Images

Figure CN118584841A
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of digital communication, in particular to a two-wire sensor interface circuit. Background Art
[0002] Sensors are widely used converters that convert physical quantities into electrical signals in the field of automation. The sensor body is combined with the circuit to form a physical quantity information sampling device, which connects various physical quantities with the control system. The sensor body includes gas, liquid, temperature, pressure, flow, etc. The integrated intelligent sensor that combines sensors and circuits is widely used today and is the primary prerequisite for industrial automation and intelligence.
[0003] Common connection methods between sensor circuits and main control circuits include three-wire or four-wire connection of power line, ground line and signal line; or two-wire sensor circuits with current as the medium, but they cannot realize two-way communication, or cannot "one-to-many", or the technical scheme of sensor circuits using the control (consumption) current as a means is more likely to cause defects such as power supply overload of the main control circuit. Summary of the invention
[0004] In view of the problems existing in the prior art, the present invention provides a two-wire sensor interface circuit with short-circuit alarm, plug-and-play, simple connection lines and extremely low overall power consumption.
[0005] The purpose of the present invention is achieved through the following technical solutions.
[0006] A two-wire sensor interface circuit comprises a main control circuit, a sensor circuit, a PS line and a GND line. The main control circuit is embedded with a CPU and related circuits, and controls the PS line to be in a power supply state, a command sending state, a "three-state" state or a special power-off duration state. The main control circuit makes the PS line make a corresponding high-level change according to its agreed communication timing to send command information to the sensor circuit. If the sensor circuit needs to feedback information, the main control circuit changes the PS line from the power supply state to a "weak pull-up" state and is controlled by the sensor circuit. The sensor circuit comprises a voltage stabilizing circuit, an embedded CPU and a signal detection circuit. The voltage stabilizing circuit stores and reduces the voltage of the PS line to provide conditions for the normal operation of the embedded CPU circuit. The embedded CPU detects the voltage value jump and timing on the PS line. If it meets the agreed communication timing, it will be stored and analyzed as information. If feedback information is required and matches the current address, the "on" and "off" states of the PS line are controlled to realize the feedback transmission of digital quantities. If the "power-off time" of the PS line meets the agreed value, the sensor circuit performs related special actions.
[0007] The main control circuit supplies power, sends signals, receives information feedback or sends special power-off duration pulses to the sensor circuit through the PS line and the GND line. The power value output by the main control circuit to the sensor circuit is a slightly higher value of the total power consumption value of the sensor circuit in the system design. The main control circuit and the sensor circuit agree on the communication timing in advance. The CPU controls the PS to send command parameters to all sensor circuits connected to the main control circuit in accordance with this timing and in a multi-byte format to encode the address, command and parameter, thereby forming a "sensor-level" network. If the main control circuit needs the sensor circuit to feedback information, the PS line is "powered off" and changed to a "weak pull-up" state, and the sensor circuit control-feedback information matching the instruction address is accepted to realize bidirectional information transmission. The main control circuit is provided with a short-circuit detection function. As long as a short circuit occurs at one point in the sensor network, the PS line is immediately changed from a power supply state to a weak pull-up state, and the PS line is periodically changed from a weak pull-up state to an instantaneous power supply state to detect whether the short circuit is released.
[0008] The sensor circuit steps down the energy characterized by the voltage value between the PS line and the GND line to provide conditions for the normal operation of its own circuit, and detects whether the voltage value jump timing of the PS line meets the pre-agreed communication baud rate. If so, the voltage value jump timing is converted into a digital value for storage, analysis and corresponding information processing. If the information packet requires the sensor circuit of this address to feedback information, the embedded CPU first determines whether the PS line is in a "power-off" state. If so, it controls whether the PS line and the GND line are "short-circuited" or not, and sends the detection parameter information to the main control circuit; if the power-off time of the PS line voltage value meets a pre-agreed value, it performs a self-reset or opens the auxiliary relay driven by the sensor circuit.
[0009] The two wires between the main control circuit and the sensor circuit are a set of common lines. The main control circuit can be connected to one or more sensor circuits and make the sensor circuit work in micro-power consumption mode. The sensor circuits each have an independent address coding value. If the address coding value length is 8 bits, one main control circuit can carry 255 sensor circuits.
[0010] The communication rate between the main control circuit and the sensor circuit is set during system design, and is a classic communication scheme of 10 Bit, 9600, or a communication method with a special bit number or opposite signal phase.
[0011] The sensor interface circuit has a built-in CPU, and the CPU program has address information, sensor type coding information, and measurement range information. It is an intelligent sensor of a single physical quantity, or a comprehensive intelligent sensor circuit with several functions in one.
[0012] The main control circuit is provided with a short-circuit protection device. If a short circuit occurs in one of the sensor circuit groups, the main control circuit immediately takes short-circuit protection measures and issues a local alarm or sends a message to a higher level.
[0013] Compared with the prior art, the advantages of the present invention are: a two-wire sensor interface circuit applied for by the present invention adopts time-sharing multiplexing combined with high and low level technology to reliably realize the "one to many" networking form, and has many significant advantages such as short-circuit alarm, plug and play, simple connection lines, and extremely low overall power consumption. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 The present invention is a circuit embodiment diagram of a two-wire sensor interface circuit.
[0015] Figure 2 This is a timing diagram of a two-wire sensor interface circuit embodiment of the present invention
[0016] Figure 3 This is a diagram of an embodiment of a two-wire sensor interface circuit—a main control circuit according to the present invention.
[0017] Figure 4 The invention is an embodiment of a two-wire sensor interface circuit - a sensor side circuit. DETAILED DESCRIPTION
[0018] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0019] The present invention applies for a two-wire sensor interface circuit, comprising a main control circuit, a sensor circuit and two wires. The main control circuit puts the two wires in four different working modes of power supply, command signal transmission, feedback information reception or special pulse transmission as needed. The sensor circuit receives circuit energy to provide conditions for its own normal operation, determines whether the wire state meets the expected communication rate, and if so, converts the wire voltage state into digital information and analyzes and determines. If feedback of sensor information is required, the sensor circuit controls the "short circuit" / "disconnection" of the wire and "transfers" the digital information to the main control circuit. If the wire voltage drops for one or several specific different time lengths, the sensor circuit parses it into one or several special command values.
[0020] like Figure 1A two-wire sensor interface circuit is shown, including a main control circuit (main controller), n sensors (circuits / modules), and two connecting wires (named PS line and common ground line GND respectively). The CPU in the main control circuit controls the PS line to be in the power supply stage, send a command string (transmitting stage), receive a sensor feedback information string (credit granting stage) or output a "set pulse" to achieve the agreed function through internal related circuits. The PS line timing method is as follows Figure 2 As shown,
[0021] The command string sent by the main control circuit contains at least one address byte of the sensor circuit, so that the sensor circuit receives the command or information parameter corresponding to its own address. The command string can be composed of several bytes or dozens of bytes to meet the needs of different functions in different occasions. If the command string sent to the PS line requires the sensor circuit to feedback data information value, the main control circuit puts its PS line in a "weak pull-up" state so that it is controlled by the sensor circuit to feedback data information.
[0022] By agreement, the sensor circuit feedback data information is either 3 bytes fixed length or a frame ending with a characteristic character. The main control circuit receives the feedback information and controls the PS line to the power supply state.
[0023] By agreement, the asynchronous communication format between the main control circuit and the sensor circuit is a 10-bit format with 1 start bit, 8 data bits and 1 stop bit, and the baud rate is 9600.
[0024] By agreement, the main control circuit controls the PS line to be powered off for a period of time, such as 5ms, to form a special pulse (Tp), or to reset the entire sensor group and other special functions.
[0025] The working power supply of the sensor circuit comes from the PS line voltage. The CPU embedded in the sensor circuit detects the voltage jump of the PS line through relevant circuits to see if it conforms to the expected communication format. If so, the voltage jump pulse is converted into digital information and analyzed. If the digital information contains the information required to be returned by the main control circuit, the CPU controls the relevant circuit to force the PS line to "short-circuit" or "release" to realize the sending of the digital quantity "0" or "1". If not, it further determines whether the "power-off duration" conforms to the agreed value of the "special pulse" duration. If so, relevant actions are performed.
[0026] like Figure 3 The main control circuit of a two-wire sensor interface circuit is shown in FIG.
[0027] The serial port output line of the main control circuit CPU is defined as MTXD, and the serial port input and output line of the CPU is defined as MRXD.
[0028] When the main control circuit supplies power to the sensor circuit group, the main control circuit CPU makes MTXD a high level, and the transistor T1 is in the on state through the voltage divider control of resistors R1 and R2. The collector of T1 outputs a low level, and the voltage source of the main control circuit is 24V (defined as M24V). The gate voltage (MA) of the PMOS tube T2 is divided by resistors R4 and R3, and the voltage regulator Z1 is limited to a voltage value lower than the M24V voltage of 12V. T2 is turned on, and M24V is powered by the PS line sensor circuit through resistor R5.
[0029] When the main control circuit needs to collect sensor circuit information, the main control CPU controls the on and off of T2 through MTXD level conversion according to the agreed baud rate (such as 9600), and then controls the PS line voltage value 0V (actually 5V) or 24V baud rate, and sends command information to the sensor group. The command information string includes the address, command word and return parameter type of each of the n sensor circuits.
[0030] After sending the instruction information string word, the main control circuit CPU controls MTXD to be low level, T1 is turned off, the voltage at point MA is 24V, T2 is turned off, the power supply to the outside is cut off, and the PS line is in a floating state. The 5V voltage value in the main control circuit is defined as M5V. In order to prevent the PS from charging to M5V when it is in the 24V output state, an isolation diode D1 is set, and the resistor R6 pulls the floating PS line to a 5V high level. The high level is coupled to the + input terminal (defined as MC) of the collector open-drain comparator U1 through the resistor R7. The - input terminal of U1 is connected to a 2.5V comparison voltage (M2.5V). Because the + terminal voltage of U1 is greater than the - terminal voltage, U1 outputs an "open drain" state and is pulled up to a high level by resistor R8; at this stage, if the PS line is "short-circuited" by a sensor circuit, the MC potential is lower than the - terminal potential, and U1 outputs a low level. The change in the U1 output level (MD) is the sensor feedback data string information. This information is received by the serial input terminal MRXD of the main control circuit CPU, such as Figure 2 The reply stage.
[0031] During the PS power supply period, resistor R7 limits the current and Zener diode Z2 limits the amplitude, which plays a role in protecting U1.
[0032] Resistor R5 is set for PS short circuit detection. The signals at both ends of R5 are connected to a differential amplifier. The amplifier output SCD is connected to the ADC channel of the CPU. If there is a short circuit in the sensor circuit group, the voltage value at both ends of R5 will become higher, such as 1V. After the ADC sampling CPU program determines, MTXD is set to a low level, and the M24V output is cut off, so that the PS is in a floating state, which plays a role in short circuit protection.
[0033] The main control circuit CPU controls the duration of the PS "power-off" setting by controlling MTXD, such as powering off an independent 5ms special pulse width, etc., and sends special function instructions to the sensor circuit, such as reset, self-test, etc.
[0034] like Figure 4 The sensor side interface circuit of a two-wire sensor interface circuit is shown.
[0035] The voltage from the public PS line is isolated by diode D1, capacitor C1 stores energy, and DC-DC step-down switching power supply U1 is stabilized to 5V voltage value (defined as S5V) to power the internal circuit of the sensor side. The energy stored in the larger capacity C1 ensures that the sensor circuit can work normally under the worst communication conditions. For example, when the host "command information string" includes 5 bytes and all are 0x00 values,
[0036] The PS circuit is in the power supply stage, and the voltage regulator Z1 "cuts" the PS voltage value, such as cutting it to 12V, and through the voltage divider value of resistors R1 and R2 (such as 5V), one path is connected to the serial port input terminal RXD (defined as SRXD) of the CPU in the sensor circuit, SRXD (receive) is high level, one path is connected to the interrupt input port INT of the CPU, and the other path is connected to the - input terminal of the comparator U2 with open-drain output, and the + terminal of U2 is connected to the reference 2.5V voltage (S2.5V). Because the - terminal voltage of U2 is higher than the + terminal voltage, U2 outputs (SO) a low level. This low level controls the NMOS tube T1 to be cut off. On the other hand, it blocks the output of U3. This state is the same as the state of PS transmitting information "1". When the PS line is in the "0" position of the sending stage (the voltage value is actually 5V), the voltage division value of R1 and R2 is 0V, SRXD receives information "0", U2 outputs the open-drain state and is pulled up to a high level by resistor R3. The high level controls T1 to turn on. Therefore, the voltage value of the PS line is 5V at this time. At this time, T1 is turned on to further lower the 5V voltage value, which further ensures the "0" state on the PS line. That is, the reasonable parameter configuration of Z2, R1 and R2 of the sensor circuit can ensure the accurate reception of serial information packets from the PS line.
[0037] The sensor circuit receives and parses character strings such as command information through the PS line. If feedback information is required, the CPU serial port output TXD (STXD) line inside the sensor circuit is connected to the - end of the comparator U3. If the output information bit is "1", the - end potential of U3 is higher than the + end potential, and U3 outputs a low level. This low level controls T1 to be in the cut-off state, and the PS line is pulled up to a high level by R6 in the main control circuit, and the bit "1" information is transmitted. If the output information bit is "0", the - end potential of U3 is lower than the + end potential, and U3 outputs an open drain state and is pulled up by R3. This high level controls T1 to be in the on state, and the high level of the PS line "pulled up" by R6 in the main control circuit is "short-circuited" to a low level, and the bit "0" information is transmitted.
[0038] The voltage divider value of R1 and R2 is connected to the interrupt port of the CPU. If the voltage divider value is 0V, the CPU will be interrupted. The interrupt program determines whether the 0V duration exceeds the maximum duration of the communication word 0x00. If so, if it is greater than 4.75ms and less than 5.25ms, it indicates that the PS line has sent a characteristic information instruction to the sensor circuit to execute related functions or actions. In the interrupt program, by determining the minimum low-level duration of the PS line, the corresponding baud rate of the system can be calculated, providing a basis for the sensor circuit to achieve "adaptive baud rate".
[0039] The information transmitted on the PS line does not strictly require "in phase" and "out of phase", it is only necessary to invert the received "information" in the CPU of the main control circuit and the sensor circuit.
[0040] The voltage value on the PS line is not limited to 24V. By changing the parameters of R3 and R4 in the main control circuit and the parameters of Z1, R1 and R2 in the sensor circuit, it can be applied to voltage levels such as 15V and 12V.
[0041] The number of sensor circuits that the PS line can carry / drive is determined by the M24V output current and the power consumption of the sensor circuit. Usually, the CPU in the sensor circuit adopts technical measures such as sleep mode to fully reduce the overall power consumption of the circuit, which can reduce the capacity of the energy storage capacitor C1 and increase the number of sensor circuits driven by the PS line.
[0042] In order to improve the power supply efficiency of the PS line, the short-circuit sampling resistor R5 is set to a smaller value. The voltage value at the two ends is amplified by the differential amplifier U2 and then connected to the ADC channel of the CPU.
[0043] The above embodiments are merely examples for clearly illustrating the present invention, and are not intended to limit the implementation methods of the present invention. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. However, these obvious changes or modifications derived from the spirit of the present invention are still within the scope of protection of the present invention.
Claims
1. A two-wire sensor interface circuit, characterized in that: It includes a main control circuit, a sensor circuit, a PS line and a GND line. The main control circuit is embedded with a CPU and related circuits. The PS line is controlled to be in a power supply state, a command sending state, a "three-state" state or a set power-off time state. The main control circuit makes the PS line make corresponding high-level changes according to its agreed communication timing to send command information to the sensor circuit. If the sensor circuit needs to feedback information, the main control circuit changes the PS line from the power supply state to a "weak pull-up" state and is controlled by the sensor circuit. The sensor circuit includes a voltage stabilizing circuit, an embedded CPU and a signal detection circuit. The voltage stabilizing circuit stores energy and reduces the voltage of the PS line to provide conditions for the normal operation of the embedded CPU circuit. The embedded CPU detects the voltage value jump and timing on the PS line. If it meets the agreed communication timing, it will be stored and analyzed as information. If feedback information is required and matches this address, the "on" and "off" states of the PS line are controlled to realize the feedback transmission of digital quantities. If the "power-off time" of the PS line meets the agreed value, the sensor circuit executes the relevant set actions.
2. A two-wire sensor interface circuit as claimed in claim 1, characterized in that: The main control circuit supplies power, sends signals, receives information feedback or sends a set power-off duration pulse to the sensor circuit through the PS line and the GND line. The power value output by the main control circuit to the sensor circuit is a slightly higher value than the total power consumption value of the sensor circuit in the system design. The main control circuit and the sensor circuit agree on the communication timing in advance. The CPU controls the PS to send command parameters to all sensor circuits connected to the main control circuit in accordance with this timing and in a multi-byte format to encode the address, command and parameter, thereby forming a "sensor-level" network. If the main control circuit needs feedback information from the sensor circuit, the PS line is "powered off" and converted to a "weak pull-up" state, and the sensor circuit control-feedback information matching the instruction address is accepted, thereby realizing two-way information transmission; The main control circuit is equipped with a short-circuit detection function. As long as a short circuit occurs at one point in the sensor network, the PS line will immediately change from the power supply state to the weak pull-up state, and periodically change the PS line from the weak pull-up state to the instantaneous power supply state to detect whether the short circuit is relieved.
3. A two-wire sensor interface circuit as claimed in claim 1, characterized in that: The sensor circuit steps down the energy characterized by the voltage value between the PS line and the GND line to provide conditions for the normal operation of its own circuit, and detects whether the voltage value jump timing of the PS line meets the pre-agreed communication baud rate. If so, the voltage value jump timing is converted into a digital value for storage, analysis and corresponding information processing. If the information packet requires the sensor circuit of this address to feedback information, the embedded CPU first determines whether the PS line is in a "power-off" state. If so, it controls whether the PS line and the GND line are "short-circuited" or not, and sends the detection parameter information to the main control circuit; if the power-off time of the PS line voltage value meets a pre-agreed value, it performs a self-reset or opens the auxiliary relay driven by the sensor circuit.
4. A two-wire sensor interface circuit as claimed in claim 1, characterized in that: The two wires between the main control circuit and the sensor circuit are a set of common lines. The main control circuit can be connected to one or more sensor circuits and make the sensor circuit work in micro-power consumption mode. The sensor circuits each have an independent address coding value. If the address coding value length is 8 bits, one main control circuit can carry 255 sensor circuits.
5. A two-wire sensor interface circuit as claimed in claim 1, characterized in that: The communication rate between the main control circuit and the sensor circuit is set during system design, and is a classic communication scheme of 10 Bit, 9600, or a communication method with a set number of bits or a signal phase opposite.
6. A two-wire sensor interface circuit as claimed in claim 1, characterized in that: The sensor interface circuit has a built-in CPU, and the CPU program has address information, sensor type coding information, and measurement range information. It is an intelligent sensor of a single physical quantity, or a comprehensive intelligent sensor circuit with several functions in one.
7. A two-wire sensor interface circuit as claimed in claim 1, characterized in that: The main control circuit is provided with a short-circuit protection device. If a short circuit occurs in one of the sensor circuit groups, the main control circuit immediately takes short-circuit protection measures and issues a local alarm or sends a message to a higher level.
