Espurna
EN
SensorsBasicvoltage divideranalogue sensorresistorADCanalogue input

Voltage divider to read a resistive sensor

In 30 secondsA PLC can't read a resistance, but it can read a voltage. Put the sensor in series with a fixed resistor and the voltage at the midpoint changes with the sensor: Vout = Vcc · RS / (RS + Rfixed).

Also available in: Català · Castellano

The problem

Many sensors change their resistance (spring sensors, potentiometers, LDRs, thermistors…). The analogue input of a PLC or an Arduino only reads voltage.

The solution

Connect the sensor in series with a fixed resistor and power it with DC. The voltage at the midpoint is:

Vout = Vcc · RS / (RS + Rfixed)

Example: Vcc = 10 V, Rfixed = 10 kΩ. If the sensor reads 10 kΩ, Vout = 5 V; if it drops to 5 kΩ, Vout ≈ 3.3 V.

The analogue input turns Vout into a number (an ADC) and the program converts it to units with a calibration.

In the cell: sensor S4

When the lifter raises the part, it compresses a spring and the resistance of S4 changes. The PLC reads the divider voltage on channel CIO 2005 and a function block calculates the height. If it’s out of limits, the part goes to reject bin 1.

Choosing the fixed resistor

Sensitivity is highest when Rfixed is close to the sensor’s resistance in the middle of its range.

Interactive demo

Related concepts