How Can I Scale My 4-20mA Sensor Data?

Updated Jan 10, 2019

Reported In


  • NI-9203
  • NI-9208

Issue Details

I am reading from a 4-20mA sensor, but I would like to see this data as a scaled value. How can I do this?


With a 4-20 mA sensor it is usual that 4 mA corresponds to 0 percent of range and 20 mA corresponds to 100 percent of range. With the DAQmx drivers you can convert from the current reading to the desired value using custom scales. To use custom scales refer to What Are Custom Scales and How Do I Use Them?

Once you have created a custom scale you must calculate the correct linear equation for the scale. This can be calculated by taking two known points on the linear scale, often the beginning and end of the range, placing them into the equation of a straight line, and solving the two simultaneously. 

For example, you may have a pressure transducer with a range from 0-200 psi. The equation of a straight line is Y = mX + c. Two points on the line are (0.004,0) and (0.020, 200), which correspond to the minimum and maximum respectively. Put the two points into the linear equation and solve the two equations simultaneously to find m = 12500 and c = –50. This is then entered as a custom scale through the DAQmx Scaling VIs or in NI-MAX. The figure below shows the scaling configuration for a custom scale in NI-MAX. 


Additional Information

4-20mA is an analog electrical transmission standard for industrial instrumentation and communication.


Not Helpful