Single-line communication system and method

Through the design of a single-wire communication system and a shared ground wire, the problem of large space occupied by multi-wire communication methods is solved, the communication equipment is made lighter and smaller, and the cost is reduced.

CN115051889BActive Publication Date: 2024-08-27AUTEL INTELLIGENT TECHNOLOGY CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210731060.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-24
Publication Date
2024-08-27
Estimated Expiration
2042-06-24

AI Technical Summary

Technical Problem

The multi-line communication method of existing communication equipment takes up a lot of space and is costly, making it difficult to achieve lightweight and miniaturization of the structure.

Method used

A single-wire communication system is used to connect the master device and the slave device through a single-wire communication bus and share a ground wire to form a communication loop. The voltage divider resistor is used to detect the plug-in and unplug status and identity information of the slave device, and data is sent through the single-wire communication bus.

Benefits of technology

It realizes the simplification of the communication loop, reduces the wiring scale and occupied space, reduces the design cost, and is suitable for the needs of equipment miniaturization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115051889B
    Figure CN115051889B
Patent Text Reader

Abstract

The embodiment of the present invention relates to the field of communication technology, and discloses a single-line communication system and method, the system includes a master device and a slave device, the master device includes at least a first DC power supply, a first voltage-dividing resistor and a first control unit, the slave device includes at least a second voltage-dividing resistor and a second control unit, the master device and the slave device are connected through a single-line communication bus and a common ground line forms a communication loop to realize signal transmission, and the master device can determine whether the slave device is connected and idle through the voltage value on the single-line communication bus, and send data to the slave device through the single-line communication bus, and the slave device feeds back a response signal after receiving the data. The single-line communication system provided by the embodiment of the present invention can realize the detection of whether the slave device is inserted through two voltage-dividing resistors, and the communication loop is simple, the wiring scale is small, and the space occupied is small.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of communication technology, and in particular to a communication system and method. Background Art

[0002] There are many ways to exchange information between devices, which are mainly divided into three categories: one-way / simplex communication, two-way alternating / half-duplex communication and two-way simultaneous / full-duplex communication. Currently, most of the information transmission methods in the two-way communication solutions on the market adopt multi-wire methods, such as Controller Area Network (CAN), Universal Serial Bus (USB), Ethernet, two-wire serial bus (Inter-Integrated Circuit, I2C), etc.

[0003] In the process of implementing the embodiments of the present invention, the inventors found that there are at least the following problems in the above-mentioned related technologies: the demand for lightweight and miniaturized structure of communication equipment is gradually increasing in the market. Due to the limitation of structural space, it is necessary to minimize the wiring scale and reduce the design cost. Multi-line communication mode requires the use of more wires and occupies more space. It is difficult to further reduce the wiring scale and occupied space. Summary of the invention

[0004] The embodiments of the present application provide a single-line communication system and method.

[0005] The purpose of the embodiment of the present invention is achieved through the following technical solutions:

[0006] To solve the above technical problems, in the first aspect, a single-wire communication system is provided in an embodiment of the present invention, comprising: a master device and a slave device, wherein the master device and the slave device are connected via a single-wire communication bus and share a ground line to form a communication loop, wherein the master device at least comprises: a first DC power supply, a first voltage-dividing resistor and a first control unit, wherein the first DC power supply is connected to one end of the first voltage-dividing resistor, the other end of the first voltage-dividing resistor is connected to one end of the single-wire communication bus, the signal detection end, the signal receiving end and the signal output end of the first control unit are all connected to one end of the single-wire communication bus and the ground end of the first control unit is connected to the ground line, and the slave device at least comprises: a second voltage-dividing resistor and a second control unit, the second voltage-dividing resistor is connected in parallel between the other end of the single-wire communication bus and the ground line, the signal detection end, the signal receiving end and the signal output end of the second control unit are all connected to the other end of the single-wire communication bus and the ground end of the second control unit is connected to the ground line.

[0007] In some embodiments, the first control unit at least includes: a first transmitting operational amplifier circuit, whose power supply terminal is connected to the first DC power supply, and whose output terminal is connected to one end of the single-wire communication bus; a first microcontroller, whose ground terminal is connected to the ground wire; a first digital-to-analog converter, whose input terminal is connected to the signal output terminal of the first microcontroller, and whose output terminal is connected to the input terminal of the first transmitting operational amplifier circuit; a first analog-to-digital circuit, whose input terminal is connected to one end of the single-wire communication bus; a first analog-to-digital converter, whose input terminal is connected to the output terminal of the first analog-to-digital circuit, and whose output terminal is connected to the signal input terminal of the first microcontroller; a first DC comparator, whose input terminal is connected to one end of the single-wire communication bus, and whose output terminal is connected to the first detection terminal of the first microcontroller; a plug-in comparator, whose input terminal is connected to one end of the single-wire communication bus, and whose output terminal is connected to the second detection terminal of the first microcontroller.

[0008] In some embodiments, the master device further includes: a first switch connected between the first DC power supply and the first voltage-dividing resistor; and a second switch connected between the first transmitting operational amplifier circuit and the other end of the first voltage-dividing resistor.

[0009] In some embodiments, the slave device also includes a second DC power supply, and the second control unit at least includes: a second transmitting op amp circuit, whose power supply terminal is connected to the output terminal of the second DC power supply; a second microcontroller, whose ground terminal is connected to the ground line; a second digital-to-analog converter, whose input terminal is connected to the signal output terminal of the second microcontroller, and whose output terminal is connected to the input terminal of the second transmitting op amp circuit; a second analog-to-digital circuit, whose input terminal is connected to the other end of the single-wire communication bus; a second analog-to-digital converter, whose input terminal is connected to the output terminal of the second analog-to-digital circuit, and whose output terminal is connected to the signal input terminal of the second microcontroller; a second DC comparator, whose input terminal is connected to the other end of the single-wire communication bus, whose output terminal is connected to the third detection terminal of the second microcontroller, and whose ground terminal is connected to the ground line.

[0010] To solve the above technical problems, in the second aspect, a single-wire communication method is provided in an embodiment of the present invention, which is applied to a master device in a single-wire communication system as described in the first aspect, and the method includes: collecting the voltage value of the single-wire communication bus, and determining whether there is a slave device connected to the single-wire communication bus according to the voltage value; if so, obtaining the identity information of the slave device and detecting whether the single-wire communication bus is in an idle state; if so, sending data to the slave device via a digital signal or an analog signal.

[0011] In some embodiments, determining whether there is a slave device connected to the single-wire communication bus based on the voltage value includes: when the voltage value of the single-wire communication bus is within a first voltage range, determining that the single-wire communication bus is connected to the slave device; when the voltage value of the single-wire communication bus is higher than the first voltage range, determining that the single-wire communication bus is not connected to the slave device.

[0012] In some embodiments, sending data to the slave device via a digital signal or an analog signal includes: packing the data to be sent into a data packet, wherein the data packet includes a start flag and data information; sending a notification signal, a data packet and / or an end signal to the slave device in sequence via the single-wire communication bus; determining within a preset response time after the data is sent that a response signal fed back by the slave device is received; if so, determining that the transmission is over; if not, resending the data and ending after the sending cycle exceeds a preset number of times.

[0013] In some embodiments, the detecting whether the single-wire communication bus is in an idle state includes: when data needs to be sent, sending a notification signal and judging whether the slave device sends a notification signal based on the voltage value of the single-wire communication bus; if so, giving priority to receiving the data sent by the slave device; after receiving the data sent by the slave device, feeding back a response signal to the slave device and sending the data.

[0014] In some embodiments, packing the data to be sent into a data packet also includes: when there are more than four consecutive identical bit data, inserting an inverted bit of the bit data between the fourth bit and the fifth bit; and inserting a parity bit at the end of the transmission of all bit data.

[0015] In some embodiments, packaging the data to be sent into a data packet further includes: modulating the duty cycle to a preset ratio, and configuring different transmission frequencies according to the data to be sent to obtain a pulse width modulation signal containing data information.

[0016] To solve the above technical problems, in the third aspect, an embodiment of the present invention provides a single-wire communication method, which is applied to a slave device in a single-wire communication system as described in the first aspect, and the method includes: determining a transmission mode according to a voltage value of a notification signal and receiving data sent by the master device; after the data is received, sending a response signal to the master device via the single-wire communication bus.

[0017] In some embodiments, when data needs to be sent to the master device, the data to be sent is packaged into a data packet, and a notification signal, a data packet and an end signal are sequentially sent to the master device via the single-wire communication bus.

[0018] In some embodiments, determining the transmission mode according to the voltage value of the notification signal and receiving the data sent by the master device also includes: determining a transmission error when more than four consecutive identical bit data are received; and checking whether the data transmission is accurate based on the parity bit at the end of the transmission of all received bit data.

[0019] In some embodiments, determining the transmission mode according to the voltage value of the notification signal and receiving the data sent by the master device further includes: when the received data packet is a pulse width modulation signal, decoding to obtain data information according to the frequency of the pulse width modulation signal.

[0020] Compared with the prior art, the beneficial effects of the present invention are as follows: Different from the prior art, a single-line communication system and method are provided in an embodiment of the present invention, the system includes a master device and a slave device, the master device includes at least a first DC power supply, a first voltage-dividing resistor and a first control unit, the slave device includes at least a second voltage-dividing resistor and a second control unit, the master device and the slave device are connected via a single-line communication bus and a common ground line forms a communication loop to realize signal transmission, and the master device can determine whether the slave device is connected and idle through the voltage value on the single-line communication bus, and send data to the slave device through the single-line communication bus, and the slave device feeds back a response signal after receiving the data. The single-line communication system provided in an embodiment of the present invention can detect whether a slave device is inserted through two voltage-dividing resistors, and the communication loop is simple, the wiring scale is small, and the space occupied is small. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements / modules and steps with the same reference numerals in the drawings are represented as similar elements / modules and steps. Unless otherwise specified, the figures in the drawings do not constitute proportional limitations.

[0022] Figure 1 is a structural schematic diagram of a single-line communication system provided in Embodiment 1 of the present invention;

[0023] Figure 2 is a structural schematic diagram of another single-line communication system provided in Embodiment 1 of the present invention;

[0024] Figure 3 It is a flowchart of a single-line communication method provided in Embodiment 2 of the present invention;

[0025] Figure 4 yes Figure 3 A schematic diagram of a sub-process of step S12 in the single-line communication method shown;

[0026] Figure 5 yes Figure 3A schematic diagram of a sub-process of step S13 in the single-line communication method shown;

[0027] Figure 6 It is the voltage waveform on the single-wire communication bus when the master device transmits digital signals;

[0028] FIG7( a ) is a voltage waveform diagram on a single-wire communication bus when the master device transmits an analog signal normally;

[0029] FIG7( b ) is a voltage waveform diagram on the single-wire communication bus when the master device transmits an analog signal and the slave device does not respond;

[0030] Figure 8 It is a flowchart of a single-line communication method provided in Embodiment 3 of the present invention;

[0031] Fig. 9 It is a flowchart of another single-line communication method provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0032] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several variations and improvements may be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

[0033] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0034] It should be noted that, if there is no conflict, the various features in the embodiments of the present invention can be combined with each other, all within the scope of protection of the present application. In addition, although the functional module division is performed in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a different order from the module division in the device or the flow chart. In addition, the words "first", "second", etc. used herein do not limit the data and the execution order, but only distinguish between the same items or similar items with basically the same functions and effects. It should be noted that when an element is described as "connected" to another element, it can be directly connected to another element, or there can be one or more centered elements between them.

[0035] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in this specification and in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used in this specification includes any and all combinations of one or more of the related listed items.

[0036] In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0037] Specifically, the embodiments of the present invention are further described below in conjunction with the accompanying drawings.

[0038] Embodiment 1

[0039] The embodiment of the present invention provides a single-line communication system, see Figure 1 , which shows the structure of a single-line communication system provided by an embodiment of the present invention. The single-line communication system 10 includes: a master device 100 and a slave device 200. The master device 100 and the slave device 200 are connected via a single-line communication bus CB and share a ground wire GND to form a communication loop. The embodiment of the present invention uses a single-line communication bus CB for signal transmission and a communication loop is formed by sharing a ground wire GND, which reduces the demand for transmission cables, thereby reducing the space required for wiring, and is conducive to the miniaturization of the device. In addition, the single-line communication method is also superior to the multi-line communication method in terms of device identity (Identity Document, ID) recognition, working status transmission, communication protocol negotiation, etc.

[0040] The main device 100 includes at least: a first DC power supply DC1, a first voltage-dividing resistor R1 and a first control unit 110, the first DC power supply DC1 is connected to one end of the first voltage-dividing resistor R1, the other end of the first voltage-dividing resistor R1 is connected to one end of the single-wire communication bus CB, the signal detection end, the signal receiving end and the signal output end of the first control unit 110 are all connected to one end of the single-wire communication bus CB and the ground end of the first control unit 110 is connected to the ground wire GND.

[0041] The slave device 200 at least includes: a second voltage-dividing resistor R2 and a second control unit 210, the second voltage-dividing resistor R2 is connected in parallel between the other end of the single-wire communication bus CB and the ground line GND, the signal detection end, the signal receiving end and the signal output end of the second control unit 210 are all connected to the other end of the single-wire communication bus CB and the ground end of the second control unit 210 is connected to the ground line GND.

[0042] The master device 100 and the slave device 200 provided in the embodiment of the present invention can both package and decode data through the control unit (the first control unit 110 and the second control unit 210). Information transmission can be initiated by the master device 100 or the slave device 200, thereby realizing peer-to-peer communication. For example, in application scenarios such as monitoring, the master device 100 can periodically issue query requests to query the peripheral status of the slave device 200, and the slave device 200 can also actively report the emergency status when an emergency occurs. It should be noted that in order to enable the master device 100 and the slave device 200 to detect the occupancy status of the single-wire communication bus CB in a timely manner, the master device 100 and the slave device 200 can be configured to use different bus occupancy voltages, thereby realizing bus occupancy conflict detection.

[0043] In addition, since the first voltage-dividing resistor R1 and the second voltage-dividing resistor R2 can divide the power output by the first DC power supply DC1, the plug-in detection and identity recognition of the slave device 200 can be achieved by detecting the voltage value on the single-wire communication bus CB.

[0044] In some embodiments, see Figure 2 , which shows the structure of another single-line communication system provided by an embodiment of the present invention, wherein the first control unit 110 includes at least: a first transmitting operational amplifier circuit 111, a first microcontroller MCU1, a first digital-to-analog converter DAC1, a first analog-to-digital circuit 112, a first analog-to-digital converter ADC1, a first DC comparator COMP1 and a plug-in comparator COMP2.

[0045] The first transmitting operational amplifier circuit 111 has a power supply end connected to the first DC power supply DC1, and an output end connected to one end of the single-wire communication bus CB; the first transmitting operational amplifier circuit 111 can convert the signal output by the first digital-to-analog converter DAC1 into a signal suitable for transmission on the single-wire communication bus CB. The first transmitting operational amplifier circuit 111 can be an existing circuit provided with an operational amplifier and used to output signals, which will not be described in detail here.

[0046] The first microcontroller MCU1 has its ground terminal connected to the ground wire GND; the first microcontroller MCU1 is a logic controller / control unit / control module in the master device 100 that controls the bus communication and signal transmission, and is structurally provided with at least a processor and a memory, wherein the memory stores programs and parameters required in the process of executing the communication method, and the processor can call the relevant programs and parameters in the memory for calculation and processing according to the detected data, and output corresponding control instructions and data, so that the master device 100 can communicate with the slave device 200. Specifically, the communication method executable by the first microcontroller MCU1 provided in the embodiment of the present invention is shown in the following embodiment 2.

[0047] It should be noted that the number of the master device 100 and the slave device 200 can be one or more, and each corresponding device is also provided with a corresponding microcontroller / microcontroller unit (MCU) to realize data interaction between one or more master devices 100 and one or more slave devices 200.

[0048] The first digital-to-analog converter DAC1 has its input end connected to the signal output end of the first microcontroller MCU1, and its output end connected to the input end of the first transmitting operational amplifier circuit 111; the first digital-to-analog converter DAC1 is used to adjust the voltage signal transmitted on the single-wire communication bus CB so that the voltage signal carries the data information to be transmitted.

[0049] The input end of the first analog-to-digital circuit 112 is connected to one end of the single-wire communication bus CB. The first analog-to-digital circuit 112 can process the signal carried on the single-wire communication bus CB and convert it into a signal recognizable by the first analog-to-digital converter ADC1. The first analog-to-digital circuit 112 can be an existing circuit that can perform preliminary processing on the collected analog signal, which will not be described in detail here.

[0050] The input end of the first analog-to-digital converter ADC1 is connected to the output end of the first analog-to-digital circuit 112, and the output end is connected to the signal input end of the first microcontroller MCU1; in the main device 100, the information (analog signal) carried by the single-line communication bus CB is sampled (converted into a digital signal) by the first analog-to-digital circuit 112 and the first analog-to-digital converter ADC1, and then software-decoded by the first microcontroller MCU1, which can support and be compatible with a variety of transmission information, such as analog signals and digital signals, to achieve efficient interactive data.

[0051] The first DC comparator COMP1 has its input end connected to one end of the single-wire communication bus CB, and its output end connected to the first detection end of the first microcontroller MCU1; the first microcontroller MCU1 can realize request detection for the slave device 200 through the first DC comparator COMP1.

[0052] The plug-in comparator COMP2 has an input end connected to one end of the single-wire communication bus CB, and an output end connected to the second detection end of the first microcontroller MCU1; the first microcontroller MCU1 can detect the plug-in and pull-out of the slave device 200 through the plug-in comparator COMP2. Both the first DC comparator COMP1 and the plug-in comparator COMP2 can be used to detect the expected voltage signal on the single-wire communication bus CB, and notify the first microcontroller MCU1 to process it in time when it is detected. By setting the first DC comparator COMP1 and the plug-in comparator COMP2, the workload of the first microcontroller MCU1 can be reduced, and the message response is more timely.

[0053] In some embodiments, please see Figure 2 The master device further includes: a first switch K1 connected between the first DC power supply DC1 and the first voltage-dividing resistor R1; and a second switch K2 connected between the first transmitting operational amplifier circuit 111 and the other end of the first voltage-dividing resistor R1. The first switch K1 can be used to achieve overall control of the on-off of the single-line communication system 10, and the second switch K2 can be used to timely disconnect the master device 100 from sending data when the slave device 200 sends data first.

[0054] In some embodiments, please see Figure 2 The slave device 200 also includes a second DC power supply DC2, and the second control unit 210 includes at least: a second transmitting operational amplifier circuit 211, a second microcontroller MCU2, a second digital-to-analog converter DAC2, a second analog-to-digital circuit 212, a second analog-to-digital converter ADC2 and a second DC comparator COMP3.

[0055] Preferably, the second DC power supply DC2 and the first DC power supply DC1 can be the same power supply and a 12V DC power supply can be selected, or the power supply setting mode and power, voltage, etc. can be selected according to actual needs. The first DC power supply DC1 is used to provide voltage and electrical energy suitable for bus transmission.

[0056] The power supply end of the second transmitting operational amplifier circuit 211 is connected to the output end of the second DC power supply DC2; the second transmitting operational amplifier circuit 211 can convert the signal output by the second digital-to-analog converter DAC2 into a signal suitable for transmission on the single-wire communication bus CB. The second transmitting operational amplifier circuit 211 can be an existing circuit equipped with an operational amplifier and used to output signals, which will not be described in detail here.

[0057] The second microcontroller MCU2 has its ground terminal connected to the ground wire GND; the second microcontroller MCU2 is a logic controller / control unit / control module for controlling the bus communication and signal transmission in the slave device 200, and is structurally provided with at least a processor and a memory, wherein the memory stores the programs and parameters required in the process of executing the communication method, and the processor can call the relevant programs and parameters in the memory for calculation and processing according to the detected data, and output the corresponding control instructions and data, so that the slave device 200 can communicate with the master device 100. Specifically, the communication method executable by the second microcontroller MCU2 provided in the embodiment of the present invention is shown in the following embodiment three.

[0058] It should be noted that, in the single-line communication system provided by the embodiment of the present invention, intelligent devices and non-intelligent devices can be compatible, so as to take into account factors such as design cost and functional requirements. Specifically, when the second microcontroller MCU2 is provided in the slave device 200, it can be understood that the slave device 200 can support intelligent devices, and complex communication can be achieved by regulating the voltage on the single-line communication bus CB. In some other embodiments, the second control unit 210 may also not include the second microcontroller MCU2, that is, the slave device 200 may also be set to an operating environment without the second microcontroller MCU2. At this time, the slave device 200 only supports non-intelligent devices, such as batteries, cables, etc., which can be used for identity recognition (ID recognition). By configuring the resistance values ​​of the second voltage-dividing resistor R2 and other resistors in the slave device 200 to meet different application requirements, the cost is lower than the operating environment of intelligent devices.

[0059] The second digital-to-analog converter DAC2 has its input end connected to the signal output end of the second microcontroller MCU2, and its output end connected to the input end of the second transmitting operational amplifier circuit 211; the second digital-to-analog converter DAC2 is used to adjust the voltage signal transmitted on the single-wire communication bus CB so that the voltage signal carries the data information to be transmitted.

[0060] The input end of the second analog-to-digital circuit 212 is connected to the other end of the single-wire communication bus CB. The second analog-to-digital circuit 212 can process the signal carried on the single-wire communication bus CB and convert it into a signal recognizable by the second analog-to-digital converter ADC2. The second analog-to-digital circuit 212 can be an existing circuit that can perform preliminary processing on the collected analog signal, which will not be described in detail here.

[0061] The second analog-to-digital converter ADC2 has its input end connected to the output end of the second analog-to-digital circuit 212, and its output end connected to the signal input end of the second microcontroller MCU2; in the slave device 200, the information (analog signal) carried by the single-line communication bus CB is sampled (converted into a digital signal) by the second analog-to-digital converter ADC2 and then software-decoded by the second microcontroller MCU2, which can support multiple transmission information, such as analog signals and digital signals.

[0062] The second DC comparator COMP3 has an input end connected to the other end of the single-wire communication bus CB, an output end connected to the third detection end of the second microcontroller MCU2, and a ground end connected to the ground wire GND. The second microcontroller MCU2 can detect the request of the master device 100 through the second DC comparator COMP3, that is, the second microcontroller MCU2 can be used to detect the expected voltage signal on the single-wire communication bus CB, and notify the second microcontroller MCU2 to process it in time when it is detected, thereby reducing the workload of the second microcontroller MCU2 and making the message response more timely.

[0063] Embodiment 2

[0064] The embodiment of the present invention provides a single-line communication method, which is applied to the master device in the single-line communication system as described in the first embodiment. Figure 3 , which shows a process of a single-line communication method provided by an embodiment of the present invention, the method includes but is not limited to the following steps:

[0065] Step S11: collecting the voltage value of the single-wire communication bus, and determining whether there is a slave device connected to the single-wire communication bus according to the voltage value; if so, jumping to step S12;

[0066] In an embodiment of the present invention, the determination of whether there is a slave device connected to the single-wire communication bus according to the voltage value includes: when the voltage value of the single-wire communication bus is within a first voltage range, determining that the single-wire communication bus is connected to the slave device; when the voltage value of the single-wire communication bus is higher than the first voltage range, determining that the single-wire communication bus is not connected to the slave device. The value of the first voltage range depends on the voltage divider size of the voltage divider resistor in the master device and the slave device in the communication loop, and can be adjusted according to actual needs.

[0067] Specifically, based on the above-mentioned embodiment 1 and Figure 1 and Figure 2 For example, and assuming that the first DC power supply DC1 used is a 12V power supply, the master device 100 connects the first DC power supply DC1 to the communication bus. When the slave device 200 is not connected, the voltage value on the single-line communication bus CB is 12V; when the slave device 200 is connected, the master device 100 and the slave device 200 form a loop through the ground wire GND, and the 12V power supply is divided by the first voltage-dividing resistor R1 and the second voltage-dividing resistor R2. Therefore, the trigger voltage of the plug-in comparator COMP2 can be set according to the voltage-dividing value of the first voltage-dividing resistor R1 and the second voltage-dividing resistor R2, that is, whether it is within the first voltage range, to detect whether the slave device 200 is inserted. Assuming that the voltage dividing value of the first voltage dividing resistor R1 and the voltage dividing value of the second voltage dividing resistor R2 are both set to 1V, the first voltage range is set to 1V to 10V. When it is detected that the voltage value on the single-wire communication bus CB is higher than 1V and lower than 10V, the plug-in comparator COMP2 will be triggered to output a high level, and the first microcontroller MCU1 determines that the bus is in an active state and a slave device 200 is connected; when it is detected that the communication bus is near 12V, the plug-in comparator COMP2 outputs a low level, and the first microcontroller MCU1 determines that the slave device 200 is not plugged in or has been unplugged.

[0068] Step S12: Obtain the identity information of the slave device and detect whether the single-wire communication bus is in an idle state; if so, jump to step S13;

[0069] Within a preset time range after detecting the access of the slave device 200, the single-wire communication bus CB is not used for communication, but for detecting the identity information of the inserted slave device 200, i.e., ID detection. Specifically, when the slave device 200 is an intelligent device, the slave device 200 can actively report the ID after insertion, or the slave device 200 can respond after the master device 100 sends a request to obtain the ID; when the slave device 200 is a non-intelligent device, the first microcontroller MCU1 can collect the voltage on the single-wire communication bus CB through the first analog-to-digital converter ADC1, calculate the resistance value of the second voltage-dividing resistor R2 in the slave device 200 according to the voltage, and thus determine the identity information of the slave device 200 according to the resistance value. Among them, the preset time range can be set according to the request speed of the master device 100 and / or the response speed of the slave device 200, for example, set to 500ms, and can be set according to actual needs.

[0070] After obtaining the identity information of the slave device, it is also necessary to detect whether the single-wire communication bus is in an idle state to determine whether data can be sent. For details, see Figure 4 , which shows Figure 3 A sub-process of step S12 in the single-line communication method, wherein detecting whether the single-line communication bus is in an idle state comprises:

[0071] Step S121: when data needs to be sent, a notification signal is sent and it is determined whether the slave device sends a notification signal according to the voltage value of the single-wire communication bus; if so, jump to step S122;

[0072] Step S122: preferentially receiving the data sent by the slave device;

[0073] Step S123: After receiving the data sent by the slave device, feeding back a response signal to the slave device and sending the data.

[0074] In the embodiment of the present invention, since in the actual application environment, the communication task performed by the master device 100 is usually a routine task, and the slave device 200 needs to actively report peripheral monitoring information to the master device 100 is usually an emergency situation, therefore, the sending priority of the slave device 200 can be set to be higher than the priority of the master device 100, and the occupied voltage of the notification signal issued by the master device 100 should be different from the occupied voltage of the notification signal issued by the slave device 200, so that when the master device 100 and the slave device 200 request the bus at the same time, both parties can detect the notification signal output by the other party on the bus, and the master device 100 automatically exits the bus request when detecting that the notification signal is issued by the slave device, and the slave device 200 preferentially seizes the sending right of the bus. For example, when the occupied voltage of the notification signal issued by the master device 100 is 4V and the occupied voltage of the notification signal issued by the slave device 200 is 5V, the master device 100 detects the 5V voltage, temporarily exits the sending request, outputs a response signal after the slave device 200 sends the data, and then sends the data to the slave device 200.

[0075] Step S13: Send data to the slave device via a digital signal or an analog signal.

[0076] In an embodiment of the present invention, after determining that there is a slave device connected to the single-line communication system to form a communication loop with the master device, and the single-line communication bus is in an idle state, the master device can send data to the slave device via a digital signal or an analog signal. Among them, the single-line communication loop provided in the first embodiment of the present invention is compatible with both analog signal transmission and digital signal transmission. When the data transmitted between the master device and the slave device is relatively simple, analog signals can be used for transmission, and the transmission and detection speeds are faster; when the data transmitted between the master device and the slave device is relatively complex and / or the data volume is large, data signals can be used for transmission, and the amount of information transmitted is large. For details, please refer to Figure 5 , which shows Figure 3 A sub-process of step S13 in the single-line communication method shown, wherein the sending of data to the slave device via a digital signal or an analog signal comprises:

[0077] Step S131: Packing the data to be sent into a data packet, wherein the data packet includes a start flag and data information;

[0078] Step S132: sending a notification signal, a data packet and / or an end signal to the slave device in sequence via the single-wire communication bus;

[0079] Step S133: after the data transmission is completed, determine whether a response signal fed back by the slave device is received within a preset response time; if so, jump to step S134; if not, jump to step S135;

[0080] Step S134: Determine that the transmission is completed;

[0081] Step S135: resend the data and end the sending cycle after the sending cycle exceeds a preset number of times.

[0082] When using data signals for transmission, please also refer to Figure 6 , which shows a voltage waveform diagram on a single-line communication bus when a master device transmits a digital signal in an embodiment of the present invention. Figure 6 In the example shown, data is sent using a 2.5V / 3.5V voltage, 2.5V represents logic 1, 3.5V represents logic 0, and the voltage deviation is within 100mv. When sending data, first, a level Vreq (4V) that lasts for more than 100ms is constructed on the bus as a notification signal to notify the slave device to prepare for reception. After the slave device detects the 4V signal, it is ready to enter the data receiving state; then, the master device first sends a start flag (low level 2V) that occupies 1 bit, and then sends data information (2.5V / 3.5V voltage); after the data information transmission is completed, the master device sends an end signal (3.5V, at least lasting 100ms); after receiving the end signal, the slave device sends a response signal (4V voltage) to the master device, and the transmission ends after the master device receives the response signal; and if the master device does not receive the response signal within the preset response time, such as if the response signal is not received for more than 100ms, the master device can resend the data (the sending process is the same as the first time).

[0083] In order to prevent signal transmission errors and detect the accuracy of transmitted data, inverted bits and check bits can also be inserted into the data information. Specifically, the data to be sent is packaged into a data packet, including: when there are more than four consecutive identical bit data, inserting the inverted bit of the bit data between the fourth bit and the fifth bit; inserting a parity bit at the end of the transmission of all bit data to check the accuracy of data transmission. For example, for 5 consecutive 1s, a 0 needs to be inserted after the 4th 1; or, for 6 consecutive 0s, a 1 needs to be inserted after the 4th 0. In the slave device, the inserted bit needs to be removed, and when the slave device receives more than 4 consecutive identical bits, a transmission error can be determined.

[0084] When an analog signal is used for transmission, the data to be sent is packaged into a data packet, including: modulating the duty cycle to a preset ratio, and configuring different transmission frequencies according to the data to be sent, so as to obtain a pulse width modulation signal containing data information. Please refer to Figure 7 (a) and Figure 7 (b), wherein Figure 7 (a) shows a voltage waveform on a single-line communication bus when the master device normally transmits an analog signal in an embodiment of the present invention, and Figure 7 (b) shows a voltage waveform on a single-line communication bus when the master device transmits an analog signal and the slave device does not respond in an embodiment of the present invention. In the examples shown in Figures 7 (a) and 7 (b), first, as with a digital signal, a level V3 lasting more than 100ms is constructed on the bus as a notification signal to notify the slave device to prepare for reception, and a start mark (low level V1) of half a cycle is sent; then, the first microcontroller MCU1 in the master device controls the first digital-to-analog converter DAC1 to modulate the duty cycle of the signal to 50%, and configure different transmission frequencies according to the data to be sent, outputting a pulse width modulation (Pulse Width Modulation (PWM) signal, the slave device can obtain data information after decoding the pulse width modulation signal; and the slave device gives a response signal after decoding, and the master device stops transmitting after detecting the response signal; or, if no response signal is received within a preset response time, the master device can resend the data; further, as shown in FIG7(b), if no response signal is received for more than three times during the sending cycle, it ends automatically.

[0085] exist Figure 6 In the examples shown in FIG. 7(a) and FIG. 7(b), in order to be compatible with digital signal transmission and analog signal transmission, the notification signal (bus request) voltage of the master device is 4.5V, and the notification signal (bus request) voltage of the slave device is 5.5V. The slave device can distinguish whether it is a digital signal communication mode or an analog signal communication mode according to the voltage size of the notification signal. Figure 6 The voltage distribution of FIG. 7(a) and FIG. 7(b) during the analog signal and analog signal transmission process is shown in Table 1 below:

[0086]

[0087] Table 1

[0088] It should be noted that when analog signal transmission is adopted, there is no need to send an end signal; and the voltage selection of the data information and the start mark in the data packet, the voltage selection of the notification signal and the end signal, and the voltage selection of the answering device can be set according to the actual application scenario and the model selection of each component in the single-line communication system shown in Example 1, without being bound by the limitations of the embodiments of the present invention.

[0089] Embodiment 3

[0090] The embodiment of the present invention provides a single-line communication method, which is applied to a slave device in the single-line communication system as described in the first embodiment. Figure 8 , which shows a process of a single-line communication method provided by an embodiment of the present invention, the method includes but is not limited to the following steps:

[0091] Step S21: determining a transmission mode according to a voltage value of a notification signal and receiving data sent by the master device;

[0092] In the embodiment of the present invention, please refer to the above-mentioned embodiment 2. After receiving the notification signal, the data transmission method can be determined as a digital signal or an analog signal according to the voltage value of the notification signal. After determination, the data is further processed according to different signal transmission methods.

[0093] For data transmitted by digital signals, after receiving a data packet with a start flag and an end flag, the data transmission is determined to be complete. When receiving consecutive identical bit data, when receiving the fifth bit of the same bit data and the fifth bit is the inverted bit of the same bit data, the inserted inverted bit is deleted to obtain accurate data information; when receiving more than four consecutive identical bit data, a transmission error is determined; and the data transmission is checked to be accurate based on the parity bit at the end of the transmission of all received bit data.

[0094] For data transmitted by analog signals, when the received data packet is a pulse width modulated signal, the data information is decoded according to the frequency of the pulse width modulated signal. Specifically, by analyzing the waveform of a complete pulse width modulated signal, that is, the duration occupied by a complete high and low level, the frequency of the signal can be calculated and the transmitted data can be decoded.

[0095] Step S22: After the data is received, a response signal is sent to the master device via the single-wire communication bus.

[0096] After receiving the data sent by the analog signal or the digital signal, a response signal is sent to the single-wire communication bus so that the master device can detect the response signal. Specifically, see the above-mentioned embodiment 2, specifically see steps S13 and Figure 6 , FIG. 7(a), FIG. 7(b) and Table 1, a high level response is output after the signal transmission is completed.

[0097] In some embodiments, see Fig. 9 , which shows the process of another single-line communication method provided by an embodiment of the present invention, the method also includes:

[0098] Step S23: When data needs to be sent to the master device, the data to be sent is packaged into a data packet, and a notification signal, a data packet and an end signal are sequentially sent to the master device via the single-line communication bus.

[0099] In the embodiment of the present invention, in addition to receiving data from the master device, the slave device can also send data to the master device. The process of sending data is similar to that of the master device, except that the request voltage for bus occupation is different. Please refer to the above-mentioned embodiment 2 and its accompanying drawings, and no further details are given here. Among them, the request voltages for the master device and the slave device to occupy the bus are different, which is beneficial for the master device to detect whether the bus is preempted.

[0100] A single-wire communication system and method are provided in an embodiment of the present invention. The system includes a master device and a slave device. The master device includes at least a first DC power supply, a first voltage-dividing resistor and a first control unit. The slave device includes at least a second voltage-dividing resistor and a second control unit. The master device and the slave device are connected via a single-wire communication bus and a common ground line forms a communication loop to realize signal transmission. The master device can determine whether the slave device is connected and idle through the voltage value on the single-wire communication bus, and send data to the slave device through the single-wire communication bus. After receiving the data, the slave device feeds back a response signal. The single-wire communication system provided in an embodiment of the present invention can detect whether a slave device is inserted through two voltage-dividing resistors, and the communication loop is simple, the wiring scale is small, and the space occupied is small.

[0101] It should be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0102] Through the description of the above implementation methods, ordinary technicians in this field can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, it can also be implemented by hardware. Ordinary technicians in this field can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0103] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them. Under the concept of the present invention, the technical features in the above embodiments or different embodiments may also be combined, the steps may be implemented in any order, and there are many other changes in different aspects of the present invention as described above, which are not provided in detail for the sake of simplicity. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they may still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A single-line communication system, characterized in that: include: A master device and a slave device, wherein the master device and the slave device are connected via a single-line communication bus and share a common ground line to form a communication loop, The master device at least includes: a first DC power supply, a first voltage-dividing resistor and a first control unit, wherein the first DC power supply is connected to one end of the first voltage-dividing resistor, the other end of the first voltage-dividing resistor is connected to one end of the single-line communication bus, the signal detection end, the signal receiving end and the signal output end of the first control unit are all connected to one end of the single-line communication bus, and the grounding end of the first control unit is connected to the ground line, The slave device at least comprises: a second voltage-dividing resistor and a second control unit, the second voltage-dividing resistor is connected in parallel between the other end of the single-wire communication bus and the ground line, the signal detection end, the signal receiving end and the signal output end of the second control unit are all connected to the other end of the single-wire communication bus, and the ground end of the second control unit is connected to the ground line; The first control unit at least comprises: A first transmitting operational amplifier circuit, whose power supply end is connected to the first DC power supply, and whose output end is connected to one end of the single-line communication bus; A first microcontroller, a ground terminal of which is connected to the ground line; A first digital-to-analog converter, whose input end is connected to the signal output end of the first microcontroller, and whose output end is connected to the input end of the first transmitting operational amplifier circuit; A first analog-to-digital circuit, an input end of which is connected to one end of the single-wire communication bus; A first analog-to-digital converter, whose input end is connected to the output end of the first analog-to-digital circuit, and whose output end is connected to the signal input end of the first microcontroller; A first DC comparator, whose input end is connected to one end of the single-line communication bus, and whose output end is connected to a first detection end of the first microcontroller; The plug-in comparator has an input end connected to one end of the single-wire communication bus and an output end connected to the second detection end of the first microcontroller.

2. The single-line communication system according to claim 1, characterized in that: The main device also includes: A first switch connected between the first DC power supply and the first voltage-dividing resistor; The second switch is connected between the first transmitting operational amplifier circuit and the other end of the first voltage-dividing resistor.

3. The single-line communication system according to claim 1, characterized in that: The slave device further includes a second DC power supply, and the second control unit at least includes: A second transmitting operational amplifier circuit, whose power supply terminal is connected to the output terminal of the second DC power supply; a second microcontroller, a ground terminal of which is connected to the ground line; a second digital-to-analog converter, whose input end is connected to the signal output end of the second microcontroller, and whose output end is connected to the input end of the second transmitting operational amplifier circuit; A second analog-to-digital circuit, an input end of which is connected to the other end of the single-wire communication bus; A second analog-to-digital converter, whose input end is connected to the output end of the second analog-to-digital circuit, and whose output end is connected to the signal input end of the second microcontroller; The second DC comparator has an input end connected to the other end of the single-wire communication bus, an output end connected to the third detection end of the second microcontroller, and a ground end connected to the ground line.

4. A single-line communication method, characterized in that: Applied to a master device in a single-line communication system according to any one of claims 1 to 3, the method comprising: Collecting a voltage value of the single-wire communication bus, and determining whether there is a slave device connected to the single-wire communication bus according to the voltage value; If so, obtaining the identity information of the slave device and detecting whether the single-wire communication bus is in an idle state; If so, data is sent to the slave device via a digital signal or an analog signal.

5. The single-line communication method according to claim 4, characterized in that: The determining, according to the voltage value, whether there is a slave device connected to the single-wire communication bus comprises: When the voltage value of the single-wire communication bus is within a first voltage range, determining that the single-wire communication bus is connected to the slave device; When the voltage value of the single-wire communication bus is higher than the first voltage range, it is determined that the single-wire communication bus is not connected to the slave device.

6. The single-line communication method according to claim 4, characterized in that: The sending of data to the slave device via a digital signal or an analog signal comprises: Packing the data to be sent into a data packet, wherein the data packet includes a start flag and data information; Sending a notification signal, a data packet and / or an end signal to the slave device in sequence via the single-wire communication bus; After the data is sent, determining within a preset response time that a response signal fed back by the slave device is received; If so, determine that the transmission is complete; If not, the data is resent and ends after the sending cycle exceeds the preset number of times.

7. The single-line communication method according to claim 6, characterized in that: The detecting whether the single-line communication bus is in an idle state comprises: When data needs to be sent, a notification signal is sent and judging whether the slave device sends a notification signal according to the voltage value of the single-wire communication bus; If so, preferentially receiving the data sent by the slave device; After receiving the data sent by the slave device, a response signal is fed back to the slave device and the data is sent.

8. The single-line communication method according to claim 6, characterized in that: The step of packaging the data to be sent into a data packet further includes: When there are more than four consecutive identical bit data, inserting an inverted bit of the bit data between the fourth bit and the fifth bit; A parity bit is inserted at the end of the transmission of all bits of data.

9. The single-line communication method according to claim 6, characterized in that: The step of packaging the data to be sent into a data packet further includes: The duty cycle is modulated to a preset ratio, and different transmission frequencies are configured according to the data to be sent to obtain a pulse width modulation signal containing data information.

10. A single-line communication method, characterized in that: Applied to a slave device in a single-wire communication system according to any one of claims 1 to 3, the method comprising: determining a transmission mode according to a voltage value of a notification signal and receiving data sent by the master device; After the data is received, a response signal is sent to the master device via the single-wire communication bus.

11. The single-line communication method according to claim 10, characterized in that: When data needs to be sent to the master device, the data to be sent is packaged into a data packet, and a notification signal, a data packet and an end signal are sequentially sent to the master device via the single-line communication bus.

12. The single-line communication method according to claim 10, characterized in that: The method of determining the transmission mode according to the voltage value of the notification signal and receiving the data sent by the master device further includes: When more than four consecutive identical bits are received, a transmission error is determined; The parity bit at the end of the transmission of all received bits of data is used to verify that the data transmission is accurate.

13. The single-line communication method according to claim 10, characterized in that: The method of determining the transmission mode according to the voltage value of the notification signal and receiving the data sent by the master device further includes: When the received data packet is a pulse width modulation signal, data information is obtained by decoding according to the frequency of the pulse width modulation signal.