Instrumentation Calculators

Calculator for 4-20mA Signal to 1- 5Volt and PLC 16-bit Raw Count Values

Calculator for 4-20mA Signal to 1- 5Volt and PLC 16-bit Raw Count Values

The converter calculation involves converting analog signals, such as 4-20 mA currents, to meaningful digital values for a PLC’s 16-bit analog-to-digital converter. 

For 4-20 mA to 1-5 volt conversion, the input current is mapped to an output voltage within a defined range. Then, the voltage is scaled to fit the 16-bit ADC range, accounting for both unsigned (0-65535) and signed (-32768 to 32767) representations. 

A scaled voltage is calculated and translated to raw count values. For signed values, a midpoint adjustment ensures proper representation. This process ensures accurate data conversion for sensors or measurements into values usable by PLC systems.

Formula for the calculation 

Let’s try converting a 4-20 mA current signal to a 1-5 volt signal and then finding out the matching PLC 16-bit raw count values for both signed and unsigned formats.

Step 1: Convert 4-20 mA to 1-5 Volt

Assuming you have a current signal (I) in the range of 4 to 20 mA and you want to convert it to a voltage signal (V) in the range of 1 to 5 volts. 

Here’s the formula:

V=Vmin+{(I-Imin)/(Imax-Imin)} X (Vmax-Vmin)

Where 

V is the output voltage in volts (between 1 and 5 volts)

I is the input current in mA (between 4 and 20 mA)

Vmin  is the minimum output voltage (1 volt)

Vmax is the maximum output voltage (5 volts)

Imin is the minimum input current (4 mA).

Step 2: Convert 1-5 Volt to PLC 16-bit Raw Count Value

Assuming your PLC has a 16-bit analog-to-digital converter (ADC) with a range of 0 to 32767 counts.

Unsigned Range

An unsigned 16-bit ADC can represent values from 0 to 65535 (216-1)

The formula to calculate the raw count value (RC) is:

RC=(V/Vmax) x (216-1)

Where

V is the voltage signal in volts (between 1 and 5 volts).

Vmax is the maximum voltage in volts (5 volts).

(216-1) is the maximum count value for a 16-bit PLC ADC (65535 for unsigned).

Signed Range

A signed 16-bit ADC can represent both positive and negative values. It uses a technique called two’s complement representation. The range for a signed 16-bit ADC is from -32768 to 32767.

When you’re converting an analog signal to a raw count value for a signed 16-bit ADC, the key is to understand how the signal’s voltage range maps to this signed range.

Let’s consider the conversion of a voltage signal V to a raw count RC (signed) for a PLC’s signed 16-bit ADC with a range of -32768 to 32767:

RC=(V/Vmax) x {(216)- (215)}

V is the voltage signal in volts (between 1 and 5 volts).

Vmax is the maximum voltage in volts (5 volts).

(216) is the maximum count value for a 16-bit PLC ADC (65535).

(215-1) is half of the total count range, which accounts for the signed range split.

Example calculation

Conversion to Voltage

Input Current (I) = 12 mA

Using V = 1+ {(12-4)/20-4)}x (5−1)

Calculated Voltage (V) = 3 Volts

Conversion to Raw Count (Unsigned)

 Using RC (unsigned) = (â…—) x (216-1)

  RC (unsigned) = (â…—) x 65535

Calculated Unsigned Raw Count (RC) ≈ 39321

Conversion to Raw Count (Signed)

Using RC (signed) = (â…—) x(216)-(215)

RC (signed) = (⅗)×(65536−32768)

Calculated Signed Raw Count (RC) ≈ 19661

In this example, a 12 mA current is converted to 3 volts and then scaled to raw count values for a PLC. The unsigned raw count is approximately 39321, and the signed raw count is approximately 19661.

4-20mA Signal To 1- 5Volt And Plc 16-bit Raw Count Values Calculator 

The below calculator used to calculate 4-20mA signal To 1- 5volt and PLC 16-bit raw count values 

Sundareswaran Iyalunaidu

With over 24 years of dedicated experience, I am a seasoned professional specializing in the commissioning, maintenance, and installation of Electrical, Instrumentation and Control systems. My expertise extends across a spectrum of industries, including Power stations, Oil and Gas, Aluminium, Utilities, Steel and Continuous process industries. Tweet me @sundareshinfohe

Related Articles

Back to top button