Field Devices: Discrete Inputs and Outputs
The Core Idea
Field devices connect the machine to its controller. Input devices report conditions to the programmable logic controller (PLC); output devices act on commands from it. This lesson explores common examples that use discrete ON/OFF signals.
What you will learn
Recognize common devices found on machines and control panels.
Understand how input devices tell a PLC what is happening.
See how a PLC uses outputs to command devices in the field.
Why it matters
Knowing which direction each signal travels helps you identify the right tag and trace behavior from the equipment through the program.
The problem
In What Is a PLC?, you saw how inputs bring information into a controller and outputs send commands. A machine has many field devices: the buttons, switches, sensors, lamps, and actuators connected to its control system. Before you write a single rung for a machine, you need two facts about every device:
Is it an input or an output? An input device reports something to the PLC: a button is pressed, a part has arrived. The PLC reads it as an input bit. An output device does something when the PLC tells it to: a lamp lights, a motor runs. The PLC commands it with an output bit. Input and output are always named from the PLC's side.
What does ON mean? Every signal in this lesson is discrete: a BOOL (Boolean) that is either ON (TRUE, 1) or OFF (FALSE, 0). There are no analog values or units here.
Every input device in this lesson is wired normally open: its input bit is ON while the device is actuated (pressed, turned, pushed, or detecting something) and OFF otherwise. The next lesson shows the other way to wire a device, and why stop buttons use it.
This lesson uses eight common examples, not a complete list of field devices. Machines can also use float switches, pressure switches, audible alarms, relay coils, and many other devices. For any device, ask the same two questions: does it report to the PLC or act on its command, and what does ON mean?
These are the examples you will operate:
| Input device | What actuates it | Its input bit is ON while… |
| Pushbutton | A person presses it. A spring pushes it back out on release, so it is momentary. | it is held in |
| Selector switch | A person turns it to a position. It stays there, so it is maintained. | it is turned right, to ON |
| Limit switch | A moving part of the machine pushes its lever. It needs physical contact. | its lever is pushed |
| Proximity sensor | Metal comes close to its face. Nothing touches it. | metal is near |
| Photo-eye | An object blocks its beam of light. | an object is in the beam |
| Output device | Output bit ON | Output bit OFF |
| Lamp | It lights. | It is dark. |
| Contactor | Its coil is energized, so its heavy contacts close and switch power to a motor: the motor runs. | Its contacts open: the motor stops. |
| Solenoid valve | Its coil is energized and pulls the valve open: air or water flows. | A spring closes the valve: the flow stops. |
The first device pair is a photo-eye at the end of a conveyor and a lamp on the operator panel:
| Signal | Device | Meaning |
BOX_DETECTED | Photo-eye (input) | TRUE while a box is in the photo-eye's beam; FALSE while the beam is clear. |
BOX_LAMP | Lamp (output) | TRUE commands the BOX HERE lamp on; FALSE commands it off. |
The program has one rung: a normally open contact on BOX_DETECTED drives the BOX_LAMP coil.
Predict
The beam is clear and the lamp is off. A box slides into the photo-eye's beam, and the PLC completes a scan.
Press Place object on the BOX DETECTED photo-eye. Read its panel from top to bottom: the device state, its normally open wiring, the contact inside it (now closed), and the input bit. Then look at the rung and the BOX HERE lamp. Press Remove object and watch everything go back.
Try it
A second machine has a proximity sensor and a solenoid valve. When a metal part sits in front of the sensor, an air valve opens and blows chips off the part.
| Signal | Device | Meaning |
METAL_PART | Proximity sensor (input) | TRUE while a metal part is near the sensor face; FALSE while none is. |
AIR_VALVE | Solenoid valve (output) | TRUE energizes the valve's coil, so the valve opens and air flows; FALSE lets a spring close it. |
Press Bring metal target near. The sensor's input bit turns ON, the rung passes, and the AIR VALVE light shows that the PLC is energizing the valve's coil, so the valve is open.
Press Move target away. The bit turns OFF and the valve closes.
Press Pause, bring the target near again, and press Step one scan. The input bit changed as soon as the target arrived, but the valve opens only after the scan runs.
Look closer
Each input device's panel shows the path from the machine to the program: device state → wiring → contact → input bit. With normally open wiring, the contact inside the device is open at rest and closes when the device is actuated, so the input bit is ON exactly while the device is actuated. In the two editors below, each output device gets a panel too, and it runs the other way: output bit → device state.
Watch the scan stepper while you operate the devices. The lesson simulator runs a scan every 100 ms. The PLC reads the input at the start of a scan, the rung decides, and the output changes when that scan writes outputs, so an output device follows its input device within one scan.
Two things the experiments show that are easy to miss:
The program sees only bits. To the program, the photo-eye and the proximity sensor look the same: one BOOL each. The device decides what counts as "detected". A common proximity sensor (an inductive one) senses only metal, so it ignores a cardboard box. A photo-eye senses any object that blocks its beam.
An output bit commands a device; it does not do the work. The PLC output only energizes the solenoid valve's coil; the valve lets the air through. For a motor, the PLC output energizes a contactor's coil, and the contactor's heavy contacts switch the motor's power, which is far more than a PLC output can carry.
Change it
An operator panel has a LAMP TEST pushbutton, a FAN selector switch, a panel lamp, and the contactor for a ventilation fan. The panel lamp should light only while LAMP TEST is held, so the operator can check the bulb. The fan should run as long as the selector is turned to ON, with nobody holding anything.
| Signal | Device | Meaning |
LAMP_TEST_PB | Pushbutton, momentary (input) | TRUE only while LAMP TEST is held in; FALSE when released. |
FAN_SELECTOR | Selector switch, maintained (input) | TRUE while turned right to ON; FALSE while turned left to OFF. |
PANEL_LAMP | Lamp (output) | TRUE commands the panel lamp on. |
FAN_CONTACTOR | Contactor (output) | TRUE energizes the fan's contactor, so the fan runs. |
In this program the fan rung reads the wrong device. Open the editor and hold LAMP TEST for a moment: the lamp lights and the fan runs, but the fan stops the instant you let go. Turn the FAN selector right: nothing happens. Change only the contact on the fan rung so it reads the selector switch. Turn the selector right and leave it there, hold LAMP TEST again, then run the checks.
Show the guided change
On the fan rung, change the normally open contact's tag from LAMP_TEST_PB to FAN_SELECTOR, and leave the lamp-test rung as it is. A pushbutton is momentary: its input is ON only while someone holds it, which is right for a lamp test. A selector switch is maintained: it stays where you turn it, and so does its input bit, which is right for a fan that runs until someone switches it off.
Check yourself
First, decide each device's direction and bit without running anything. For an input device, give the input bit the PLC reads. For an output device, give the output bit the program must write.
| Device and situation (all wired normally open) | Input or output? | Bit |
| A pushbutton that nobody is pressing | ? | ? |
| A selector switch someone turned right to ON and let go of | ? | ? |
| A limit switch whose lever a closed bin lid is pushing | ? | ? |
| A proximity sensor with only a plastic part in front of it | ? | ? |
| A photo-eye with a box blocking its beam | ? | ? |
| A lamp that must be lit | ? | ? |
| A contactor whose motor must stop | ? | ? |
| A solenoid valve that must let air flow | ? | ? |
Show the answers
| Device and situation | Input or output? | Bit |
| Pushbutton, not pressed | Input | OFF. It is momentary, so it is ON only while held. |
| Selector switch, turned to ON and let go | Input | ON. It is maintained, so it stays ON. |
| Limit switch, lever pushed by the lid | Input | ON |
| Proximity sensor, plastic part only | Input | OFF. An inductive proximity sensor senses only metal. |
| Photo-eye, beam blocked by a box | Input | ON |
| Lamp that must be lit | Output | ON |
| Contactor whose motor must stop | Output | OFF |
| Solenoid valve that must let air flow | Output | ON |
Now build a program. At a box-gluing station, a limit switch reports that the cart is at its home position, and a photo-eye reports a box in front of the glue gun.
| Signal | Device | Meaning |
CART_HOME | Limit switch (input) | TRUE while the cart presses the switch's lever at its home position; FALSE while the cart is away. |
BOX_AT_GLUER | Photo-eye (input) | TRUE while a box is in the beam in front of the glue gun; FALSE while the beam is clear. |
HOME_LAMP | Lamp (output) | TRUE commands the CART HOME lamp on. |
GLUE_VALVE | Solenoid valve (output) | TRUE energizes the glue valve's coil, so it opens and glue sprays onto the box. |
The program has no rungs yet. Light the CART HOME lamp while the cart is home, and open the glue valve while a box is at the glue gun. Operate the devices on the panel to try your program, then run the checks. They try each device alone, both together, and both changing. Retry as often as you need.
Hint 1
Which two tags report a device to the PLC, and which two tags command a device? A rung reads inputs with contacts and writes outputs with coils.
Hint 2
Pair each sensor with the output it controls: the cart's limit switch with the CART HOME lamp, and the photo-eye with the glue valve. Each pair gets its own rung.
Hint 3
Rung 1: a normally open CART_HOME contact, then a HOME_LAMP coil. Rung 2: a normally open BOX_AT_GLUER contact, then a GLUE_VALVE coil.
Show the worked solution
The limit switch and the photo-eye are input devices, so their tags go on contacts. The lamp and the glue valve are output devices, so their tags go on coils. Both inputs are wired normally open, so each input bit is ON while its device is actuated, and a normally open contact passes exactly then.
Rung 1: normally open
CART_HOMEcontact →HOME_LAMPcoil. The lamp is lit while the cart presses the lever.Rung 2: normally open
BOX_AT_GLUERcontact →GLUE_VALVEcoil. The valve is open while a box is in the beam.
Each output follows only its own device, so a box at the glue gun never lights the CART HOME lamp, and the cart arriving never sprays glue.
What happened and why
Every field device is either a way for the machine to tell the PLC something or a way for the PLC to make something happen. Pushbuttons and selector switches report what a person wants. Limit switches, proximity sensors, and photo-eyes report what the machine is doing: something touched a lever, metal came near, an object blocked a beam. The PLC sees each one as a single input bit. Lamps, contactors, and solenoid valves act on what the PLC decides, each from a single output bit.
That split is why one rung can connect any input device to any output device: the program never deals with levers or light beams, only with bits. It also means the device choice matters. A momentary pushbutton cannot hold a fan on by itself, and a proximity sensor cannot see a cardboard box, no matter what the program says. Later lessons give the program memory, so a momentary Start button can keep a motor running.
When you take over a machine, list its devices this way: name, input or output, and what ON means. The next lessons build on that list. Normally Open and Normally Closed Devices shows the other wiring and why stop buttons use it, and I/O Addressing and Tags connects each device to a numbered terminal, an address, and a tag.
Common mistakes
Calling a lamp an input because it shows information. Cause: thinking about what the operator sees. Symptom: the input/output (I/O) list says the PLC reads a lamp. Fix: name the direction from the PLC's side. The PLC commands the lamp, so it is an output.
Expecting a pushbutton to stay on. Cause: treating a momentary device like a maintained one. Symptom: the fan stops as soon as the button is released. Fix: use a maintained device such as a selector switch, or (in a later lesson) program memory.
Thinking the PLC output powers the motor. Cause: drawing the PLC straight to the motor. Symptom: surprise that a contactor sits between them. Fix: the output energizes the contactor's coil; the contactor switches the motor's power.
Reading an output with a contact and writing an input with a coil. Cause: mixing up which tags report and which tags command. Symptom: the lamp never lights. Fix: put input tags on contacts and output tags on coils.
Enable JavaScript to run the embedded simulator and complete the interactive exercises.