Most current analog sensors produce 4-20mA linear sensor output. In this article you will learn how to convert the leaner sensor output to a measurement reading and how to set the convertion formula in ThingsLog UI.

## Introduction

Analog sensors produce either current or voltage output.

Current sensors are suitable for covering longer distances between the sensor and the data logger and thus have great footprint in industry. Voltage sensors are also widely used. They are typically cheaper, can’t cover long distances but are typically suitable for integrated products where the sensor is embeded into the enclosure of the device.

An example for analog sensors are:Pressure sensors (gauge or absolute), Level sensors, Temperature, Humidity, Weitgth and many others.

### So how to convert the mA signal to a measurement reading

This tool uses the following formula to calculate the current output signal over a 4-20mA scale from a specified measurement input reading and range:

Y = Low Limit + (High Limit – Low Limit) * (X -4) / 16

Y – Measurement reading in the specific dimension (bar, m, °C to °F etc).

X – mA current output of the sensor (should be between 4 and 20mA)

Low Limit – the lower limit of the sensor

High Limit – the upper limit of the sensor

## Examples

Let’s consider that we have a level sensor with range 0 – 4 meter and we get a sensor output of 5 mA.

`Y (m) = 0 + (4 -0)*(5-4)/16 = 0.25 m`

So we have:

Low limit,m = 0 m

High Limit,m = 4 m

X, mA = 5 mA

Let’s consider that we have a temperature sensor with range of -20 to +100 °C and sensor output of 10mA.

` Y ( °C ) = -20 + (100 - -20)*(10-4)/16 = 25 °C `

Low Limit, °C = -20 °C

High Limit, °C = 100 °C

X, mA = 10mA

## How to set conversion formulas in ThingsLog UI Configuration menu

In ThingsLog UI you can set a conversion formula for analog sensor input ports.

Let’s consider the examples above.

### Level sensor configuration

For the 0 -4 m level sensor we have to enter the following formula:

`Y= (4 -0)*(X-4)/16 = 4*(X-4)/16 = 0.25*(x-4)`

With this config the logger will convert the analog current signal to meters and will trigger immediate alarm if the level goes under 1 m or above 3.5 m.

### Temperature sensor configuration

For the -20 +100 °C temperarute current sensor we have the following formulat

`Y ( °C ) = -20 + (100 - -20)*(x-4)/16 = -20 +120*(x-4)/16 = -20 + 7.5*(x-4) = -50 + 7.5*x `