analog input vs digital input?

Analog input and digital input comparison

Analog input vs digital input

An analog input (AI) tells you how much of a quantity is present; a digital input (DI) tells you whether a defined state is active. An analog input might report a tank level of 63%, while a digital input reports the state of a level switch. For a PLC, the correct input depends on the sensor output and the information needed.

Analog input: measures a value

An AI measures the amplitude of an analog signal. Common ranges include 0–10 V and 4–20 mA, representing voltage and current inputs respectively. The module's ADC converts the measurement into a raw digital value. Software scales it into bar, °C, metres or percent. The analog signal can vary continuously; the PLC reading is limited by sampling and resolution.

Pressure sensors, Pt100 sensors and load cells may require different input circuits. An analog input is not automatically compatible with every sensor. A Pt100 needs an RTD input or suitable transmitter; a load cell needs an appropriate bridge measurement module or amplifier. The word “analog” alone does not establish wiring compatibility.

Digital input: detects a state

A DI interprets its signal as logic 0 or logic 1. Pushbuttons, limit switches, relay contacts, switching-output photoelectric sensors and inductive sensors are common examples. 24 V DC is widely used, but digital inputs do not all accept the same voltage. Logic 0 and 1 do not necessarily mean exactly 0 V and exactly 24 V.

The module recognises specified low and high signal ranges. A voltage between these ranges may not represent a reliable state. A dry contact is used with a suitable supply and input circuit; the contact does not generate voltage itself. A 5 V analog reading may represent half scale, but it does not make a digital input “half active”.

Using both inputs on the same tank

For a linear 4–20 mA level transmitter spanning 0–100 cm, 4 mA = 0 cm, 12 mA = 50 cm and 20 mA = 100 cm. The analog input monitors the measurement range. The calculation is level = (current − 4) / 16 × 100. A separate high-level switch reports only its threshold state; it cannot, by itself, tell you the tank level in centimetres.

In pump control, the analog measurement supports continuous monitoring and, where appropriate, PID control. The digital switch provides a threshold indication or on/off condition. Changes in the measurement can be recorded with a datalogger. The two inputs can serve complementary purposes.

Are PNP/NPN and NO/NC the same thing?

No. PNP/NPN describes the sensor output's electrical arrangement and its sinking/sourcing compatibility. NO/NC describes how the output behaves with no target present and when a target is detected. A PNP sensor can have either NO or NC behaviour. Check the input type, COM connection, supply and sensor wiring diagram together.

Can digital inputs measure speed or position?

Yes, with suitable pulse inputs. Encoder pulses can be counted by a high-speed counter or suitable encoder interface to obtain position and speed. Frequency measurements also depend on pulse timing. A standard filtered DI may miss fast pulses. Check voltage levels, pulse duration, input filtering and maximum permitted frequency together.

Selection and troubleshooting

For AI, consider input type, measurement range, resolution, accuracy, conversion time and signal conditioning. For DI, consider signal voltage, PNP/NPN compatibility, common terminals, leakage current and filter time. Both can be affected by wiring and electromagnetic interference; digital inputs are not completely immune to noise.

For incorrect readings, follow sensor output → module status → raw value → software interpretation. Confusing the 0–20 mA and 4–20 mA settings causes scaling errors on AI. Incorrect NO/NC interpretation or COM wiring can produce the wrong DI state. Do not apply a 24 V control signal to a 0–10 V analog input. Wire-break and out-of-range diagnostics depend on module support and configuration.