February 27, 2019
resource accountingresponsible applicationsTexas Instrumentsarticle integrated circuitsdevelopment tools and materials
The 4-20 mA current loop interface is one of the oldest, and at the same time, the most reliable and noise-resistant standards for transmitting information over long distances. Its main application is industrial automation systems. Recently, due to the spread of digital control methods, a set of communication standards for industrial HART (Highway Addressable Remote Transducer) networks has been developed for systems based on a 4-20 mA current loop. This article is intended to remind you of the physical foundations of the current loop, the features of its implementation and the types of interface.
Any control system, in addition to electronics and actuators, includes a set of interfaces with the help of which all its elements are interfaced into a single whole. It is the interfaces that ensure reliable operation of equipment in real, sometimes very harsh conditions. An analysis of the most popular analog and digital methods of exchanging information with remote elements shows that many of them are based on the use of a current loop (Current Loop). Due to its simplicity, high noise immunity and a number of other positive qualities, the current loop, especially the 4-20 mA interface, has deservedly become one of the most common bases for transmitting information over long distances.
However, today, largely due to the venerable age of this method, the origins of which should be sought in the technical literature of the mid-twentieth century, some developers, especially beginners, do not fully understand all of its features, which leads to annoying design errors. Therefore, basic information about this data transfer method needs to be updated periodically, which is the purpose of this article.
Why current and not voltage?
As is known from the school physics course, the operating mode of a section of an electrical circuit (two-terminal network) is determined by two main parameters: voltage U - the potential difference at its ends, and current I flowing through it (Figure 1). In the general case, the relationship between the values of U and I can be quite complex, because it depends on the internal filling of the two-terminal network, which can contain anything, including sources of electrical energy. However, in the simplest case, for a resistor with resistance R, these two parameters are related by Ohm’s law: U = I × R.
Rice. 1. Basic relations for a resistive two-terminal network
Thus, when using a resistor on the receiving side as an input signal sensor, theoretically there is no difference between the methods of signal transmission - using voltage or using current, because these two parameters are interrelated. Moreover, from a technical point of view, transmitting information using voltage is easier than using current, because most existing sources of electrical energy are voltage sources, and there are many more devices, including semiconductor ones, capable of monitoring or regulating voltage. In addition, a system that transmits information using voltage with an infinitely large resistance of the measuring element (R ⇒ ∞) consumes practically no current (I ⇒ 0). This means that theoretically it can be much more economical, because in this case the signal power P, and therefore the energy consumption for its transmission, can be arbitrarily small (P = U × I ⇒ 0).
Indeed, it is unlikely that anyone will use a current loop to communicate, for example, two microcontrollers located on the same board a few centimeters from each other. However, when it comes to distances greater than ten meters or the transmission of information in a complex electromagnetic environment, the main disadvantages of the current loop when operating over short distances turn into its advantages, and it becomes one of the most reliable and effective methods of transmitting information.
The main advantage of a current loop is the high accuracy of information transfer. In a real communication system, the magnitude of the signal voltage on the receiving side is influenced by the physical parameters of the line, primarily the active resistance of its conductors RL1 and RL2 (Figure 2). Indeed, according to Kirchhoff’s second law, the sum of the voltages in a closed loop must be equal to zero, therefore the voltage UOUTH generated by the transmitter is equal to the sum of the voltage drops across the resistances of the communication line wires UЛ1, UЛ2 and the input resistance of the receiver UВХ. This means that in order to accurately transmit a signal, especially an analog signal, using voltage, it is necessary to adjust the system each time to a specific communication line. Considering that the active resistance of the conductors RL1 and RL2 of the physical line depends on many factors, primarily on temperature, such adjustment must be carried out regularly, depending on the time of day and weather conditions.
Rice. 2. Communication systems based on voltage and current transmission
Unlike voltage, the value of which is different for each section, the current in all elements of an unbranched electrical circuit is the same. This means that the quality of transmitted information (current strength) can be controlled not only on the receiving side, but also on the transmitting side, thereby adapting to all changes in line parameters. Thus, a data transmission system based on a current loop does not require any additional calibration tools or auto-tuning for a specific communication line - this function is automatically performed by the transmitter.
The influence of communication line parameters in a system that transmits information using voltage can theoretically be reduced by increasing the internal resistance of the receiver (ideally R ⇒ ∞). In this case, there will be a decrease in the current in the line, and consequently, a voltage drop across the resistances RL1 and RL2. However, when working with long lines, this will lead to a deterioration in the quality of communication, since in addition to the signal, there is also interference in the system.
Interference is as integral a part of data transmission systems as the transmitter, receiver and communication line. In analog systems, the presence of interference leads to a decrease in the signal-to-noise ratio, and in digital systems, it leads to an increase in the probability of error. In a system based on voltage transmission, the voltage created by the interference UPOM is summed with the output voltage of the transmitter UOUT (Figure 3), so their separation on the receiving side is very difficult. But in a system based on current transmission, any deviations in the output signal, including those caused by interference, can be compensated on the transmitting side. The impact of interference in this case will manifest itself in the form of a change in the voltage at the transmitter output by the value -UPOM, but the current in the line will remain unchanged.
Rice. 3. Effect of interference on various communication systems
This can also be explained differently: in a system based on voltage transmission, the interference energy will be released at the input of the receiver, where it will cause maximum harm, and in a system based on current transmission, it will be released at the output of the transmitter, where the effect of its influence will be minimal. Indeed, since the voltage drop across a section of a resistive circuit is proportional to its resistance, the interference energy should be released in the section that has maximum resistance. In a system based on voltage transmission, the internal resistance of the transmitter RPER (voltage source) should be as small as possible, and the receiver (voltmeter) should be as large as possible (Figure 3). In a system based on current transmission, the opposite is true: the internal resistance of the transmitter (current source) should be as large as possible, and the receiver (ammeter) should be minimal. Thus, theoretically (and practically) communication systems based on current loops have a higher level of noise immunity than communication systems based on voltage transmission.
Unified voltage signal 0-10 V
When using this type of signal to obtain information from a sensor, its entire (sensor) range is divided into a voltage range of 0-10 V. For example, a temperature sensor has ranges of -10...+70 °C. Then at -10 °C the sensor output will be 0 V, and at +70 °C - 10 V. All intermediate values are found from proportion.
The same is true for any other device. For example, if the analog output of a frequency converter is configured to transmit the current engine rotation speed, then 0 V at its output means that the engine is stopped, and 10 V means that the engine is spinning at maximum frequency.
4-20 mA interface
The 4-20 mA interface is based on a current loop with operating current values in the range of 4...20 mA. A change in current value to less than 3.8 mA indicates a line break, and above 20.5 mA indicates a short circuit. Thus, this interface allows you to monitor the integrity of physical connections in the system.
In the general case, the logical correspondence of current levels can be anything, but traditionally a low level corresponds to a low level of the controlled value, and a high level corresponds to a high level. So, for example, the output signal of an analog sensor that controls the filling level of a tank equal to 4 mA will correspond to an empty tank, and 20 mA to a full one. If the tank is half full, the sensor will generate a current of 12 mA (4 + (20 – 4)/2 = 12 mA). In digital binary systems, a current of 4 mA usually corresponds to a logic zero level, and 20 mA to a logic one.
The prototype of the 4-20 mA electrical interface is its pneumatic counterpart with pressure levels of 3...15 psi (0.2...1 bar). Before the widespread adoption of electronics, this was the dominant standard in industry. It was here that the “shifted zero” appeared, when the low signal level differed from the zero value. At one time, this was due to the fact that, firstly, pressure less than 0.2 bar was technically difficult to detect, and secondly, a decrease in pressure below this value indicated the presence of damage.
With the development of electronics, especially in the field of microcontrollers, pneumatic control systems were gradually replaced by electronic automation. However, many devices with pneumatic control interfaces are still produced, such as control valves for pipelines. This is due to the fact that the use of electric drives in them is technically difficult or expensive. In this case, specialized interface converters “current loop 4-20 mA” to “pressure 3-15 psi” (and vice versa) are used, designed to interface the electronic and pneumatic parts of the control system (Figure 4).
Rice. 4. Converters from electrical interface “4-20 mA current loop” to pneumatic “3-15 psi”
The main advantages of the 4-20 mA interface are:
- simplicity - in the simplest case, a remote device can be connected using just two wires;
- high accuracy of signal transmission - since the current is the same in all elements of the transmission system, the transmitter always knows what signal level the receiver will receive;
- high noise immunity due to double current control (both on the transmitting and receiving sides), allowing you to connect remote (sometimes up to tens of kilometers) objects, for example, using standard telephone lines;
- independence of communication quality from line length, which only affects the maximum data transfer rate;
- possibility of self-diagnosis of both line breaks and short circuits;
- theoretically unlimited communication range - in fact, the maximum length of the connecting cable is limited only by the electrical strength of its insulation and the data transfer speed.
All this has led to the widespread use of this interface in practice, especially in industrial systems, and support by a large number of manufacturers, which is another, perhaps its most important advantage.
However, like any other interface, the current loop has a number of disadvantages and limitations that should be taken into account during design. The main one is the ability to transmit only one signal over one cable. With a large number of devices, this can become a problem, since in addition to an increase in the number of cables, unwanted ground loops may appear in the ground circuit, which will negatively affect the noise immunity of the system. Also, with a large number of simultaneously used interfaces, it is necessary to pay special attention to the quality and condition of the cables, since all the advantages of the current loop disappear when the insulation of the transmission lines is damaged.
Another disadvantage of the current loop is the relatively low (by today's standards) information transfer speed, which directly depends on the length of the line. Unlike systems based on voltage transfer, for which the rate of recharging the parasitic capacitance of the cable can be increased, for example, by increasing the power of the transmitter (after all, its short-term maximum output current is theoretically unlimited), the output current of the transmitter for a current loop should not exceed 20 mA. Let the communication system use a standard cable with a linear capacitance equal to 75 pF/m. In this case, a line segment 1 km long will have a capacitance of 75 nF. Let the input resistance of the receiver be 250 Ohms, which, with an output current of 20 mA, provides a voltage at the receiver input of 5 V. In this case, it will take about 18.5 μs to charge the parasitic line capacitance to such a voltage. It is easy to calculate that the maximum transmission speed in this case cannot exceed 54 kbit/s, and it will decrease proportionally as the cable length increases. In real systems, the data transfer rate over the 4-20 mA interface usually does not exceed 9600 kbit/s. However, for most control systems this is quite sufficient.
Main 4-20 mA interface components
Ideally, a specialized controlled current generator would be used to create an information signal. However, technically it turned out to be easier to separate the functions of power supply and signal generation and use two separate units in the system: a power source that provides the system with electrical energy, and a controlled current stabilizer that performs the function of a signal generator (transmitter). It allowed:
- connect the transceiver part of the system to standard power buses (9 V, 12 V, 24 V, and so on);
- flexibly select the required operating voltage level;
- get rid of the connection of the source of electrical energy to the transmitting node.
With this approach, the power source for the transceiver part can generally be located in any part of the system: both in local and remote equipment, and can also be connected as a separate device directly into the communication line cable break (Figure 5).
Rice. 5. Options for building a communication system based on a 4-20 mA interface
The supply voltage of the transceiver part depends on the voltage drop in the communication line. The longer the communication line and the thinner the wire, the higher this parameter should be. For objects located at a considerable distance, the supply voltage can reach 120 V or more.
In general, the power supply voltage should be approximately 10% greater than the total voltage drop across all elements of the transceiver path at maximum current (20 mA). If the supply voltage is lower, then due to the high resistance of the circuit, the controlled current stabilizer simply will not be able to provide the required current. An increased value of this parameter in the worst case, for example, when a cable breaks, can lead to equipment failure.
Remote power supply of remote equipment
Since the voltage drop in the line does not affect the quality of information transmission, the question arises: is it possible to further increase it by selecting part of the signal energy to power remote equipment? It turns out that in some cases this is quite possible. For example, if you add an additional resistance of 500 Ohms to the line on the receiving side (Figure 6), then when current flows across it, a voltage drop from 2 V (at a current of 4 mA) to 10 V (at a current of 20 mA) will form, which is quite sufficient for powering low-power measuring units (in this case, the power at a current of 4 mA will be equal to 8 mW). Obviously, the introduction of an additional voltage drop into the line must be compensated by a corresponding increase in the power supply voltage.
Rice. 6. Remote power supply of remote sensor using current loop
In most cases, the signal power from the 4-20 mA interface current loop is sufficient to power most sensors, such as temperature or humidity sensors, motor rotor position sensors, and other low-power devices. However, if the designer needs to remotely power devices containing more powerful devices, such as a relay or LED-backlit LCD screen, then other options must be used: either a separate power supply or other types of 4-20 mA interface.
HART protocol
This is a development of the Fieldbus protocol, widely used in industry. The underlying basis is a 4-20 mA current loop, which means it can use twisted pairs left over from obsolete protocols. At first, the standard was considered a highly specialized communications interface, but in 1986 it was released to the public. Transmission via HART occurs in complete packets, consisting of:
- Preamble – 5-20 bytes. Serves for synchronization and carrier detection.
- Start byte – 1 byte. Indicates the bus master number.
- Address – from 1 to 5 bytes. Assigned to master, servant and serves as a special sign of batch mode.
- Extension – from 0 to 3 bytes. Its length is indicated in the start byte.
- Command – 1 byte. What the servant must do.
- The number of data bytes is 1 byte. Size of the data field in bytes.
- Data – from 0 to 255 bytes. Data that helps decipher the order of actions.
- The checksum is 1 byte. Contains the result of the logical XOR operation for all bytes except the start and end bytes in the data block.
Of course, the packet structure is typical for digital devices and needs to be decrypted for the correct execution of the command.
Varieties of 4-20 mA interfaces
All the options for using the 4-20 mA interface discussed above related to its two-wire version, which is the simplest and most cost-effective. As mentioned above, the only disadvantage of a two-wire connection is the limited power supply to the remote equipment, associated with the finite value of both the maximum line current (20 mA) and the maximum voltage drop on the receiving side.
This drawback is completely eliminated in the four-wire version of the interface in question, in which a separate node is used to power remote equipment, connected using a separate electrical cable (Figure 7). With this approach, the information part of the system is completely isolated from all other circuits (provided that the transmitter and receiver of the 4-20 mA interface also contain appropriate isolating components), which provides the highest level of protection against electromagnetic interference. In general, the supply voltage of remote equipment can be anything. Most often, constant (12, 24 or 48 V) or alternating (220 V, 50 Hz) voltages are used, which allows the use of standard buses and power supplies for this purpose.
Rice. 7. Four-wire version of 4-20mA interface
Obviously, this connection option is the most complex and expensive, but it allows you to remotely power equipment of theoretically any power and transmit information with the highest level of noise immunity. Of course, in practice, the real power of the connected equipment is limited by the throughput of the electrical cable, and frankly speaking, this method of connection applies only formally to the 4-20 mA interface, because in this case we are actually talking about two independent systems operating in parallel: the power supply system and information transmission system.
The system can be slightly simplified by replacing two two-wire cables with one four-wire one. However, this option in most cases will be a compromise, since the conductors of the electrical part of the cable must most often have a larger cross-section, and at high supply voltages, greater insulation strength, compared to the wires of its information part. And the likelihood of an erroneous connection of equipment when using a four-wire cable increases significantly.
If technical conditions allow, then you can use an intermediate - three-wire version of the interface. Its potential capabilities (high power of remotely connected equipment and level of noise immunity) due to separate power lines and information transmission are similar to the four-wire version, but by eliminating electrical isolation between different parts of the system, this version of the interface turns out to be simpler and more cost-effective. For example, in the three-wire version of the 4-20 mA interface, the transceiver nodes and all other equipment can be powered from a single source (Figure 8).
Rice. 8. Three-wire version of 4-20mA interface
Thus, three- and four-wire 4-20 mA versions allow increasing the power of remotely connected equipment, but this increases both the complexity and cost of the system. In addition, when using systems at hazardous sites, an increase in the level of power supplied to a remote node may cause problems with ensuring the required level of spark, explosion and fire safety. It should also be noted that when using the two-wire version of the 4-20 mA interface, there are practically no problems with certification of equipment for operation in explosive atmospheres, that is, so little energy is supplied to the remote equipment that there are not even conditions for a spark to occur.
Current Loop Standards and Application Examples
Over the entire existence of the current loop, several options for its practical application have been developed, which have become quite widespread. Initially (in the 50s of the twentieth century) a current loop with signal levels of 0-60 mA was used in telegraphy, however, due to unacceptably high (even at that time) energy consumption, already from the beginning of the 60s the maximum current level was reduced to 20 mA. Today, 20 mA is the maximum current value for most interfaces, although, in accordance with GOST 26.011-80, the value of this value, by agreement with the customer, can reach 100 mA.
The current loop is mentioned in a number of domestic standards, for example, IRPS/IFSS (OST 11 305.916-84), GOST 27696-88 or GOST 28854-90 and foreign ones, for example, IEC 62056-21/DIN 66258. However, none of them is specification of the current loop itself. For example, IEC 62056-21 standardizes the communication protocol with electric meters, GOST 27696-88 - interfaces used in industrial robots, and IRPS - the interface for connecting computers with peripheral devices (printers, teletypes, etc.). Thus, most manufacturers use current loop signal levels that have become traditional, although signal levels of 4-20 mA (as well as 0-5 mA and 0-20 mA) are directly specified in GOST 26.011-80 “Measurement and automation equipment. Electrical current and voltage signals are continuous input and output.”
In general, modern interfaces that use a current loop for data transmission differ only in the minimum acceptable signal level, which can be either 0 or 4 mA. In some cases, alternating current in the range of -5...+5 mA (at short distances) or -20...+20 mA can be used to transmit information. All attempts to reduce the maximum current value to reduce power consumption were successful only on short lines, since with low current and a long cable length the data transfer rate drops catastrophically.
The peak of popularity of the current loop occurred in the era of analog telephony, because it was this method of communication that was used to connect wired telephones to PBXs. In telephone systems, the required communication range, reaching several tens of kilometers, is ensured by using an increased supply voltage (24...125 V). The standard frequency band is 0.3...3.4 kHz, and the maximum current in the line usually does not exceed 20 mA.
The current loop with levels of 0-5 mA is a physical layer of the MIDI (Musical Instrument Digital Interface) standard, widely used for data exchange between electronic musical instruments. This format provides data transmission at a speed of 31.25 kbit/s over short distances (within a studio or concert venue).
The main application of a current loop with signal levels of 4-20 mA is industrial automation systems, which require high reliability, which is why they use a “shifted zero” in order to promptly detect a malfunction of the control system and take appropriate measures to prevent an emergency situation.
Recently, due to the widespread adoption of digital control methods, a set of communication standards for industrial HART (Highway Addressable Remote Transducer) networks has been developed for systems based on 4-20 mA current loops. The wired version of this protocol is actually an add-on to the analog 4-20 mA interface and allows you to use the same communication line for simultaneous transmission of both analog (with a bandwidth limitation of up to 25 Hz) and digital signals. Digital data transmission is achieved by mixing high-frequency carriers with an amplitude of ±0.5 mA, modulated in frequency (1200/2200 Hz) or phase (3200 Hz), into the analog signal. When using frequency modulation, the digital channel bandwidth is 1200 bps, and phase modulation, through the use of 8-position keying, allows you to increase this parameter to 9600 bps. At the time of writing, the latest version of the protocol is the 7th protocol (HART 7), described in the document HCF-SPEC-13 . Some fragments of the wired version of this interface are included in the IEC 61158-CPF9 standard, and the wireless version is included in IEC 62591:2010.
MIDI interface
The MIDI format is popular among musicians and is a specialized digital audio recording protocol. At the physical level, it is organized according to a 5 mA current loop circuit. Of course, due to the difference in unit levels, the two transmission standards are not directly compatible. According to Mikhail Guk, MIDI was developed in 1983 and became the de facto rule for connecting synthesizers.
Wikipedia reports that in June 1981, the Roland Corporation submitted the idea of a standard interface to a large synthesizer manufacturer, Oberheim Electronics. Already in October, Smith, Oberheim and Kakihashi discussed this with the boards of Yamaha, Korg and Kawai, and in November at the AES society exhibition they demonstrated the first workable version.
The interface was under development for two years, and in January 1983, Smith connected two analog synthesizers via MIDI. This made it possible to directly transfer arrangements and create new musical compositions. Later, MIDI files were introduced into support for the Windows operating system, allowing authors to directly process melodies, saturating them with new special effects not found in the original synthesizers. The introduction of samples of various instruments allowed the performer to reproduce musical accompaniment of any complexity.
Application of MIDI
MIDI uses 5 mA physical lines. Rarely found 10. Galvanic isolation is carried out through an optocoupler. Signal inversion is recognized as a characteristic feature:
- There is current.
- No current.
Therefore MIDI is not directly compatible with a conventional current loop. Many people saw the physical interface, but did not know the name. Visually, the socket is a dielectric disk with a side cutout; there are 5 holes (DIN) around the perimeter. The structure is surrounded in a circle by a screen. Musicians have three types of interface:
- MIDI-In.
- MIDI Out.
- MIDI Thru.
A MIDI port is sometimes found on the motherboard of a personal computer. In normal mode, unused pins 12 and 15 of the DB-15S gaming adapter port are physically used. The TTL logic used here requires an adapter to interface with standard synthesizers using the current loop protocol. The converter chip is not too complicated; it includes an optocoupler, a diode, and a number of logic elements.
The MIDI port is programmable via UART as a serial COM port. There are sound cards with MIDI on sale or separate expansion cards for free slots.