0
0
FreertosHow-ToBeginner · 4 min read

How to Interface Pressure Sensor with PLC: Step-by-Step Guide

To interface a pressure sensor with a PLC, connect the sensor's output (analog or digital) to the PLC's input module, configure the input type in the PLC software, and write a program to read and process the sensor data. Use an analog input module for sensors with voltage or current outputs, and scale the raw input to meaningful pressure values in your PLC code.
📐

Syntax

Here is the basic syntax pattern for reading an analog pressure sensor value in a PLC ladder logic program:

  • ANALOG_INPUT: The PLC input channel connected to the sensor.
  • SCALE: Function to convert raw input to pressure units.
  • STORE: Save the scaled value to a variable for further use.
ladder_logic
Pressure_Raw = ANALOG_INPUT(Channel_1)
Pressure_Value = SCALE(Pressure_Raw, Raw_Min, Raw_Max, Pressure_Min, Pressure_Max)
STORE(Pressure_Value, Pressure_Processed)
💻

Example

This example shows how to read a 4-20mA pressure sensor connected to analog input channel 1, scale the raw input to pressure in PSI, and store it in a variable.

structured_text
(* Read raw analog input from channel 1 *)
Pressure_Raw := AI_Channel_1;

(* Scale 4-20mA (corresponding to 0-100 PSI) to pressure value *)
Pressure_Value := (Pressure_Raw - 4.0) * (100.0 / 16.0);

(* Store scaled pressure value *)
Pressure_Processed := Pressure_Value;
Output
If AI_Channel_1 = 12.0 mA, then Pressure_Processed = 50.0 PSI
⚠️

Common Pitfalls

  • Incorrect wiring: Connecting sensor output to wrong PLC input type (digital vs analog) causes no or wrong readings.
  • Ignoring sensor output range: Not scaling raw input leads to meaningless values.
  • Power supply issues: Pressure sensors often need a stable 24V supply; missing this causes sensor failure.
  • Not filtering noise: Analog signals can be noisy; use software filtering or hardware filters.
structured_text
(* Wrong: Using digital input for analog sensor *)
Pressure_Raw := DI_Channel_1;  (* DI = Digital Input, wrong for analog sensor *)

(* Correct: Use analog input *)
Pressure_Raw := AI_Channel_1;
📊

Quick Reference

StepDescription
1Connect sensor output to PLC analog input module.
2Ensure sensor power supply is correct (usually 24V).
3Configure PLC input channel for correct signal type (4-20mA or 0-10V).
4Write PLC code to read raw input value.
5Scale raw input to pressure units (e.g., PSI, bar).
6Use scaled value for control or monitoring.

Key Takeaways

Connect the pressure sensor output to the correct PLC analog input channel.
Always power the sensor with the recommended voltage for accurate readings.
Scale raw analog input values to meaningful pressure units in your PLC program.
Avoid using digital inputs for analog sensor signals to prevent incorrect data.
Implement filtering if sensor readings are noisy for stable measurements.