DEV Community

What 4-20mA actually means (and why your zero is at 4)

The temperature in your database was, at some point, a current in a wire. Not as a metaphor. Actual milliamps through copper. Almost everything your code knows about a physical process traveled as an electrical current through a cable before it became a number, and the rules for that journey were written in the 1950s.

The standard is called 4-20mA. It is old, it is analog, and it still carries most of the world’s industrial sensor data. I have pulled the cables for it as an electrician and consumed the numbers from it as a developer, and the two jobs taught me very different things about the same signal. This post is what I wish the developer side knew.

Words in this post, in plain language:

  • Transmitter: the measurement converter mounted on or near the sensor. It turns the sensor’s raw signal (the resistance of a PT100, for example) into a standardized 4-20 mA current.
  • PLC (programmable logic controller): the industrial computer that runs the control logic of a plant. It reads inputs, executes its program and sets outputs, over and over, in real time. In this post we care about its analog inputs.
  • Span: the measuring range the transmitter is configured with, meaning which physical values 4 and 20 mA correspond to. For example 0-200Β°C.
  • Frequency drive: power electronics that control the speed of a motor by varying the frequency and voltage it is fed. Found on everything from fans to pumps, and it returns in the noise section below.

Why your zero is at 4

A 4-20mA sensor

Comments

No comments yet. Start the discussion.