The 4
HomeHome > News > The 4

The 4

Apr 18, 2024

The I/O capabilities built into most microcontrollers make it easy to measure the analog world. Say you want to build a data logger for temperature. All you need to do is get some kind of sensor that has a linear voltage output that represents the temperature range you need to monitor — zero to five volts representing 0° to 100°C, perhaps. Hook the sensor up to and analog input, whip up a little code, and you’re done. Easy stuff.

Now put a twist on it: you need to mount the sensor far from the microcontroller. The longer your wires, the bigger the voltage drop will be, until eventually your five-volt swing representing a 100° range is more like a one-volt swing. Plus your long sensor leads will act like a nice antenna to pick up all kinds of noise that’ll make digging a usable voltage signal off the line all the harder.

Luckily, industrial process engineers figured out how to deal with these problems a long time ago by using current loops for sensing and control. The most common standard is the 4-mA-to-20-mA current loop, and here we’ll take a look at how it came to be, how it works, and how you can leverage this basic process control technique for your microcontroller projects.

The now standard 4-20 mA current loop for process control descends directly from an early innovation in industrial automation, pneumatic process control. Before electric controls were widespread, miles of pneumatic lines snaked through factories, providing not only the power to move actuators but also the ability to sense conditions. Process engineers used a pneumatic signaling system based on pressure — 3 PSI and one end of the sensing range, and 15 PSI at the other. Such a sensor would vary the pressure in the line based on the process variable, and could be used as input for a chart recorder, to directly control a valve, or even act in concert with other pneumatic sensors and actuators through sophisticated pneumatic logic controllers.

While pneumatic systems are very much still in use today, especially in industries where things tend to go boom around electricity, 4-20 mA current loop systems became a de facto standard in the 1940s and 1950s. In current loop systems, a transducer monitoring some process variable — temperature, pressure, flow, etc. — is connected to a transmitter. The transmitter is wired in series with a DC power supply — usually 24 volts in industrial settings. The transmitter is responsible for converting the output of the transducer into a current between 4 mA and 20 mA.

Kirchhoff’s Current Law tells us that the current will be the same at every point of the circuit no matter what the voltage is. So, if the voltage drops substantially because the wires to the transmitter are a half a mile long, or if the loop voltage varies because a huge motor started up somewhere else in the factory, it doesn’t matter — the transmitter keeps the current constant for a given process variable.

Current loops aren’t limited to sensors, of course. A wide range of actuators, from valves to motor drives, can be controlled by a 4-20 mA loop. Data acquisition and display are also possible, with chart recorders, gauges, and indicators all available for the loop.

But why is 4 mA — or 3 PSI, for that matter — the lower limit of the loop, rather than zero? Easy: because it provides inherent error detection. If the bottom value of the loop current had been set to zero, it would be impossible to tell the difference between a legitimate lower limit reading on a sensor and a broken loop wire.

So how do you incorporate a 4-20 mA device into your latest Arduino project? Changing the current back to a voltage by putting a resistor in the loop and measuring the voltage drop across it is really all it takes. [AvE] does the math to show us that a 250-ohm resistor gives us a one-volt to five-volt swing, which is perfect for an Arduino’s analog input in the video below (warning — slightly NSFW language ahead).

You might not have as ready access to current loop sensors and actuators as someone who works in industrial automation, and your project might not really take advantage of all the 4-20 mA standard has to offer. But it’s nice to know it’s there when and if you need it.