Module 02 · PLC foundations

Inputs, outputs & field wiring

Before you write a single rung you need to know what is on the other end of each wire: whether a button is normally open or closed, whether a sensor sources or sinks current, and what a 4–20 mA signal means.

≈ 35 min6 lessons1 hands-on labQuiz · pass 80 %Free

By the end of this module you can

  • Tell normally open from normally closed field devices, and predict the input signal
  • Match PNP and NPN sensors to sinking and sourcing input cards
  • Choose relay or transistor outputs for a load
  • Convert a 4–20 mA signal to engineering units and detect a broken wire
  • Write an I/O list for a small machine

A digital input is ON (1) when voltage is present at the terminal, typically 24 V DC, and OFF (0) when it is not. What decides that is the field device:

DeviceContactInput when not actuatedInput when actuated
Start push buttonNormally open (NO)01
Stop push buttonNormally closed (NC)10
Emergency stop (to a safety relay)NC, positively opening1 (OK)0
Limit switch, door switchNO or NC, as chosen0 / 11 / 0
Selector switchOne NO contact per position1 on the input of the selected position
Key idea"Normally open/closed" describes the field device. The contact you draw in the program (module 05) is a separate choice: it asks "is this input bit 1?" or "is it 0?". Mixing the two up is the most common beginner mistake.

Proximity sensors and photo-eyes contain electronics, so they need power as well as a signal wire. A 3-wire sensor has +24 V (brown), 0 V (blue) and output (black). A 2-wire sensor is wired in series with the input, like a switch, and leaks a small current when off.

PNP (sourcing) sensor

Switches +24 V onto the output wire. Needs an input card whose common goes to 0 V: a sinking input. Standard in Europe and India.

NPN (sinking) sensor

Switches 0 V onto the output wire. Needs a sourcing input card whose common goes to +24 V. Common in Japanese and some Asian machines.

Watch outVendors name input cards differently ("sink" can describe the card or the sensor). Check the wiring diagram, not just the word. Many cards, including Mitsubishi iQ-F, accept both by changing where the common (S/S) terminal is wired.
Output typeSwitchesGood forLimits
RelayAC or DC, isolated contactMixed voltages, contactor coils, low switching ratesSlow (ms), contacts wear: avoid fast pulsing
Transistor (PNP/source or NPN/sink)DC only, typically 24 V, 0.5 ASolenoid valves, lamps, fast pulses, interposing relaysDC only, current limit per point and per group
TriacAC onlyAC loads switched oftenLeakage current when off
  • Large loads (motors, heaters) are never switched by the PLC directly: the output drives a contactor or an interposing relay, or a command to a drive.
  • Inductive DC loads such as solenoid coils need a flyback diode or suppressor; many transistor cards have one built in.
  • Wire the contactor's auxiliary contact back to an input so the program can check that the motor really started (feedback).

Transmitters for pressure, level, flow and temperature send a continuous signal. The input module converts it to a number, the raw value, which the program scales to engineering units. 4–20 mA is preferred in industry: it ignores voltage drop on long cables, and because zero is 4 mA, a reading near 0 mA means a broken wire, not a zero measurement.

Try it

A 0–10 bar pressure transmitter

Siemens raw (0–27648)13824
Pressure5.00 bar
StatusOK

Formula: EU = (mA − 4) / 16 × (EU max − EU min) + EU min. Below about 3.6 mA (NAMUR NE 43 limit) treat the signal as faulty.

Logivyx uses SCALE(raw, raw_min, raw_max, eu_min, eu_max) in ST, or Auto-Generation Analog Program to build all scaling routines from a table. Raw ranges depend on the I/O module the Soft-PLC reads through Data Exchange.

S7-1200/1500 analog inputs give 0–27648 for the nominal range (4–20 mA or 0–10 V), with overrange up to 32511 and 32767 meaning wire break/overflow. Scale with NORM_X then SCALE_X (or SCALE in S7-300). Analog inputs are words such as %IW64.

Logix analog modules are configured in the module properties: you can enter the engineering range there (for example 4–20 mA → 0.0–10.0 bar) and read a ready-scaled REAL such as Local:3:I.Ch0Data. Fault bits in the input structure flag underrange and open wire.

Mitsubishi analog modules and adapters convert to a digital value whose range depends on the model and setting (for example 0–4000 or 0–32000). Some modules also offer built-in scaling. Read the value from the module's buffer memory or the assigned D register, then scale it in the program.

Ask of every signal: if this wire breaks, what does the machine do? The answer must be "something safe".

  • Stop buttons and guard switches are wired NC, so a broken wire reads as "stop".
  • Run permissives such as "air pressure OK" and "motor breaker OK" are 1 when healthy, so a lost signal removes the permission.
  • 4–20 mA lets the program detect a broken transmitter loop.
  • Outputs that must close a valve on power loss use spring-return valves: de-energised = safe.

You will build a fail-safe stop circuit in module 06.

Every PLC project starts with an I/O list: one line per signal. Write one for this machine, then compare with the model answer.

The machine: a conveyor driven by a 3-phase motor through a contactor. A green START and a red STOP button on the panel. A motor protection breaker with an auxiliary "OK" contact. A photo-eye at the end of the belt detects cartons. A green "running" lamp and an amber "fault" lamp. A 4–20 mA load cell measures the carton weight (0–50 kg).

Lab

Conveyor I/O list

  1. List every input: name, description, digital or analog, and for digital inputs whether the device is NO or NC.
  2. List every output with its load (contactor coil, lamp) and whether a relay or 24 V transistor output suits it.
  3. For the load cell, write the engineering range and what reading means "wire broken".
  4. Mark which signals are fail-safe (NC or "healthy = 1") and why.
  5. Open the model answer below and compare. Differences in names are fine; missing signals are not.
Model answer
TagTypeDescriptionDevice
Start_PBDIStart push button, greenNO
Stop_PB_OKDIStop push button, red (1 = not pressed)NC, fail-safe
Motor_MPCB_OKDIMotor protection breaker healthyAux contact, 1 = OK, fail-safe
Motor_Running_FBDIContactor auxiliary contact (feedback)NO
Carton_PEDIPhoto-eye at end of belt (1 = carton present)PNP sensor
Weight_RawAILoad cell 4–20 mA = 0–50 kg; < 3.6 mA = wire break2-wire transmitter
Motor_ContactorDOConveyor motor contactor coilRelay or transistor + interposing relay
Lamp_RunningDOGreen running lampTransistor
Lamp_FaultDOAmber fault lampTransistor