🚧 Under construction — VoTechWorks is being built. A free tech program — complimentary, as our commitment to get America working.
voTechWorksGrade 13 · a vocational technology learning center, by urbanicity
newSchoolWorks.com › VoTechWorks › Manufacturing & Marine › Robotics / Mechatronics › Industrial Sensors and Signal Conditioning for Mechatronics › Lesson 10
MFG-MECH15-04 · Lesson 10 · 14.5 clock hours · lab

Sensor Integration with PLCs and HMIs

Objective. Students configure a PLC program that reads multiple sensor types simultaneously, applies scaling, triggers discrete outputs based on sensor thresholds, and displays real-time values with alarm annunciation on an HMI screen.

⚠ Pending professional review

This lesson, its worked examples and its practice questions has not yet been verified by a licensed engineer or certified journey-level tradesperson or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.

VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.

Sensor Integration with PLCs and HMIs

Why Integration Matters

A mechatronics system is only as useful as the information it delivers to operators and control logic. In this lab you will connect three common sensor types to a PLC, condition their signals, trigger an alarm output, and display live data on an HMI screen. This mirrors real packaging, marine, and manufacturing applications where a single PLC scan must handle discrete presence detection, analog process variables, and temperature feedback all at once.

Safety Before You Start

Before wiring any sensor or module, follow lockout/tagout procedures under OSHA 29 CFR 1910.147. De-energize the panel, apply your personal lock, and verify the absence of voltage with a calibrated meter before touching terminals. Wear appropriate PPE — safety glasses and insulated gloves rated for the panel voltage. All wiring must comply with NFPA 79, the electrical standard for industrial machinery, which governs conductor sizing, color coding, and overcurrent protection inside control enclosures. Do not defeat or bypass machine guarding in accordance with OSHA 1910.212; keep fingers clear of mechanical actuators during the live test phase.

Discrete Proximity Sensor

A proximity sensor produces a simple ON/OFF signal: the output transistor switches when a target enters its sensing range. Most industrial units are three-wire PNP or NPN devices wired to a discrete input (DI) module. In your PLC program, one rung using a normally open (NO) contact reads that input bit. When the target is present the bit is TRUE, energizing the rung output. Ladder diagram in IEC 61131-3 makes this straightforward: place the contact address on the left, a coil on the right.

Analog Pressure Sensor — 4–20 mA Scaling

The pressure transducer outputs a 4–20 mA current loop signal. The PLC analog input (AI) module converts that current to a raw integer — commonly 0–32,767 on a 16-bit unsigned module, or 4,096–20,480 on a 12-bit module scaled to engineering counts. You must convert that raw count to engineering units (for example, 0–150 psi) using a linear scaling formula:

EU = (Raw − Raw_min) / (Raw_max − Raw_min) × (EU_max − EU_min) + EU_min

Many PLC platforms provide a built-in SCALE or SCL instruction that performs this calculation automatically once you enter the raw and engineering limits. Verify the calibration with a 4–20 mA calibrator by injecting 4 mA (should read 0 psi), 12 mA (mid-scale), and 20 mA (full-scale). Accept readings within ±2% of the calibrator reference.

Once the scaled value is available, add a comparison instruction (Greater Than, GRT) that compares the live pressure tag to a setpoint value stored in a data register. When pressure exceeds the setpoint, the rung becomes TRUE and energizes a discrete alarm output coil.

Thermocouple Transmitter

A thermocouple transmitter converts the millivolt output of a thermocouple into a standard 4–20 mA signal representing a temperature range (for example, 0–500 °F). This allows it to enter the PLC on the same type of analog input module as the pressure transducer. Apply the same scaling formula, substituting the temperature range for EU_min and EU_max. The transmitter handles cold-junction compensation internally, so no additional correction is required in the PLC program for this lab.

Building the PLC Program (Ladder Diagram)

Organize your program into clearly commented rungs:

1. Rung 1 — Proximity input: Contact reads the DI bit; coil writes to an internal status bit used downstream or on the HMI.

2. Rung 2 — Pressure scaling: SCALE instruction (or equivalent math block) converts raw AI counts to psi and writes to a floating-point or integer tag.

3. Rung 3 — Pressure alarm: GRT instruction compares the psi tag to the setpoint register; output energizes the physical alarm output and an HMI alarm bit.

4. Rung 4 — Temperature scaling: Second SCALE instruction converts the thermocouple transmitter counts to °F and writes to its tag.

Use descriptive tag names (PROX_PRESENT, PRESS_PSI, TEMP_DEGF, PRESS_ALARM_OUT) so anyone reading the program understands its purpose without comments — a professional habit valued in industry.

HMI Configuration

On the HMI screen, create the following elements and link each to the corresponding PLC tag:

Download the HMI project and confirm communication with the PLC before calling the instructor for the integrated test.

Integrated Test and Punch List

During the test, the instructor will vary inputs: insert and remove a target near the proximity sensor, adjust pressure with the calibrator, and simulate temperature changes. For each condition, compare the HMI display to the calibrator reading. Record any discrepancy — this is your punch list. A punch list is a professional document identifying items that do not yet meet specification, along with the corrective action taken. All three functions (discrete, analog pressure with alarm, temperature display) must work correctly to pass the lab.

Key terms9

4–20 mA current loopAn industry-standard analog signal where 4 mA represents the minimum process value and 20 mA represents the maximum; current loops are resistant to noise and allow long cable runs.
Scaling (signal scaling)The mathematical conversion of a raw analog count from an input module into engineering units (psi, °F, etc.) using a linear proportion between the raw range and the engineering range.
Comparison instruction (GRT/LES)An IEC 61131-3 PLC instruction that compares two values; the rung continues (is TRUE) only when the comparison condition is met, for example when a process value exceeds a setpoint.
Discrete input (DI)A PLC input channel that reads an ON/OFF (1/0) signal from devices such as proximity sensors, limit switches, or pushbuttons.
Analog input (AI) moduleA PLC module that converts a continuous electrical signal (current or voltage) into a digital integer value the processor can use in math and comparison instructions.
Thermocouple transmitterA device that converts the low-level millivolt output of a thermocouple, including cold-junction compensation, into a standard 4–20 mA signal suitable for a standard analog input module.
HMI (Human-Machine Interface)A touchscreen or panel display connected to a PLC that presents real-time process data, trend graphs, and alarms to operators, and allows them to enter setpoints.
Punch listA professional document listing items in a system that do not yet meet specification, the nature of the discrepancy, and the corrective action required or taken.
Lockout/tagout (LOTO)The procedure required by OSHA 29 CFR 1910.147 to de-energize equipment and apply personal locks and tags before performing installation, wiring, or maintenance work.

Worked examples4

1. A 4–20 mA pressure transducer represents 0–150 psi. The PLC analog input module produces raw counts from 0 to 32,767. If the module reads a raw count of 16,384, what is the pressure in psi?
  1. Identify the scaling formula: EU = (Raw − Raw_min) / (Raw_max − Raw_min) × (EU_max − EU_min) + EU_min
  2. Substitute values: Raw = 16,384; Raw_min = 0; Raw_max = 32,767; EU_min = 0 psi; EU_max = 150 psi
  3. Calculate the ratio: (16,384 − 0) / (32,767 − 0) = 16,384 / 32,767 ≈ 0.5001
  4. Multiply by the engineering span: 0.5001 × (150 − 0) = 0.5001 × 150 ≈ 75.0 psi
  5. Add EU_min: 75.0 + 0 = 75.0 psi
Answer: Approximately 75.0 psi, which corresponds to the 12 mA midpoint of the 4–20 mA loop (as expected for a linear sensor at half-scale).
2. A calibrator injects 8 mA into the pressure transducer input. The transducer range is 0–150 psi and the 4–20 mA signal maps linearly. What pressure should the PLC display?
  1. Find the position of 8 mA within the 4–20 mA span: (8 − 4) / (20 − 4) = 4 / 16 = 0.25
  2. Multiply by the engineering span: 0.25 × 150 psi = 37.5 psi
  3. Add the minimum engineering value: 37.5 + 0 = 37.5 psi
Answer: 37.5 psi. If the HMI displays a value outside ±2% of 37.5 psi (i.e., outside the range 36.75–38.25 psi), the scaling parameters or wiring must be investigated.
3. A thermocouple transmitter outputs 4–20 mA for a temperature range of 0–500 °F. The PLC module raw range is 0–32,767 counts. At what raw count should the PLC read when the transmitter outputs 16 mA?
  1. Find the fraction of the 4–20 mA span: (16 − 4) / (20 − 4) = 12 / 16 = 0.75
  2. Multiply by the raw count span: 0.75 × 32,767 = 24,575.25
  3. Round to nearest whole count: 24,575 counts
  4. Cross-check the engineering value: 0.75 × 500 °F = 375 °F — this is the temperature that should appear on the HMI.
Answer: Raw count ≈ 24,575, which should scale to 375 °F on the HMI display.
4. The pressure alarm setpoint is 120 psi. Using the same 0–150 psi / 0–32,767 count module, what raw count value should be entered as the GRT (Greater Than) comparison threshold if the programmer chooses to compare in raw counts rather than scaled units?
  1. Find the fraction of engineering span: (120 − 0) / (150 − 0) = 120 / 150 = 0.8
  2. Multiply by the raw count span: 0.8 × 32,767 = 26,213.6
  3. Round to nearest whole count: 26,214 counts
  4. Verify: raw count 26,214 / 32,767 × 150 psi ≈ 120.0 psi — correct.
Answer: Enter 26,214 as the GRT threshold. Any raw count above 26,214 corresponds to pressure above 120 psi, energizing the alarm output.

The math in this lesson1

Learners convert between raw PLC counts, mA and psi or °F, and compute a raw-count alarm threshold.
F-LE.1
Brush up in the math halls at newSchoolWorks.com:
In class: PLC programming exercise: in ladder diagram (IEC 61131-3), students create rungs that read one discrete proximity sensor, one analog pressure sensor (4–20 mA scaled), and one thermocouple transmitter; add comparison instructions to energize an alarm output when pressure exceeds a setpoint. · HMI configuration: students build a screen with numeric displays for each sensor value, a bar graph for the analog pressure signal, and a flashing alarm indicator; download to the HMI and verify all elements update in real time. · Integrated test: instructor changes sensor inputs (target present/absent, pressure adjusted, temperature simulated); students confirm PLC outputs and HMI display respond correctly and document any discrepancies in a punch list.
Materials: PLC with analog and discrete I/O modules, HMI (color touchscreen), PLC programming software, HMI configuration software, pressure transducer, proximity sensor, thermocouple transmitter, 4–20 mA calibrator, lab worksheet.
Check: PLC program and HMI reviewed by instructor; all sensor values display within ±2% of calibrator reference; alarm output activates at correct threshold; pass requires all three functions working.

Practice check8

Answer each question, then check it. Nothing is recorded; this is your own practice.

Safety and Compliance
1. Before wiring a new analog input module to a live PLC panel, which OSHA standard requires that you de-energize the panel and apply your personal lock?
Analog Signal Conditioning / PMMI Industrial Electricity
2. A 4–20 mA pressure transmitter is calibrated for 0–200 psi. The calibrator injects 12 mA. What pressure should the PLC display?
PLC Programming / PMMI Programmable Logic Controllers
3. In IEC 61131-3 ladder diagram, which instruction type is used to compare a scaled pressure tag to a setpoint and energize an alarm output when pressure is too high?
Analog Signal Conditioning / PMMI Industrial Electricity
4. A PLC analog input module produces raw counts from 0 to 32,767 for a 4–20 mA input. The transducer range is 0–150 psi. If the raw count reads 8,192, what is the scaled pressure?
Sensors and Signal Conditioning / Siemens SMSCP Electrical Components
5. What is the primary advantage of using a thermocouple transmitter that outputs 4–20 mA rather than connecting the thermocouple millivolt signal directly to the PLC?
PLC Programming / Troubleshooting
6. During the integrated lab test, the instructor adjusts the calibrator to 20 mA on the pressure channel (full scale, 0–150 psi range), but the HMI bar graph only rises to 75 psi. What is the most likely cause?
Safety and Compliance / Siemens SMSCP Electrical Components
7. Which NFPA standard governs the electrical wiring practices inside an industrial control panel, including conductor sizing and overcurrent protection?
HMI Configuration / Troubleshooting
8. A student's HMI alarm indicator is linked to the PLC alarm output bit but does not flash during the test even though the pressure is confirmed above the setpoint. The numeric display shows the correct scaled pressure. What should the student check first?
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.