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.
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:
| Device | Contact | Input when not actuated | Input when actuated |
|---|---|---|---|
| Start push button | Normally open (NO) | 0 | 1 |
| Stop push button | Normally closed (NC) | 1 | 0 |
| Emergency stop (to a safety relay) | NC, positively opening | 1 (OK) | 0 |
| Limit switch, door switch | NO or NC, as chosen | 0 / 1 | 1 / 0 |
| Selector switch | One NO contact per position | 1 on the input of the selected position | |
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.
| Output type | Switches | Good for | Limits |
|---|---|---|---|
| Relay | AC or DC, isolated contact | Mixed voltages, contactor coils, low switching rates | Slow (ms), contacts wear: avoid fast pulsing |
| Transistor (PNP/source or NPN/sink) | DC only, typically 24 V, 0.5 A | Solenoid valves, lamps, fast pulses, interposing relays | DC only, current limit per point and per group |
| Triac | AC only | AC loads switched often | Leakage 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.
A 0–10 bar pressure transmitter
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).
Conveyor I/O list
- List every input: name, description, digital or analog, and for digital inputs whether the device is NO or NC.
- List every output with its load (contactor coil, lamp) and whether a relay or 24 V transistor output suits it.
- For the load cell, write the engineering range and what reading means "wire broken".
- Mark which signals are fail-safe (NC or "healthy = 1") and why.
- Open the model answer below and compare. Differences in names are fine; missing signals are not.
Model answer
| Tag | Type | Description | Device |
|---|---|---|---|
| Start_PB | DI | Start push button, green | NO |
| Stop_PB_OK | DI | Stop push button, red (1 = not pressed) | NC, fail-safe |
| Motor_MPCB_OK | DI | Motor protection breaker healthy | Aux contact, 1 = OK, fail-safe |
| Motor_Running_FB | DI | Contactor auxiliary contact (feedback) | NO |
| Carton_PE | DI | Photo-eye at end of belt (1 = carton present) | PNP sensor |
| Weight_Raw | AI | Load cell 4–20 mA = 0–50 kg; < 3.6 mA = wire break | 2-wire transmitter |
| Motor_Contactor | DO | Conveyor motor contactor coil | Relay or transistor + interposing relay |
| Lamp_Running | DO | Green running lamp | Transistor |
| Lamp_Fault | DO | Amber fault lamp | Transistor |