Machine vision uses cameras and image processing to inspect, measure, read and guide automatically, and the PLC stays in charge of the machine. The usual arrangement is simple: the PLC triggers an inspection, the vision system returns a result (typically pass or fail, plus data), and the PLC acts on it. Wikipedia notes that the primary uses of machine vision are automatic inspection and industrial robot or process guidance, and that a common output is a pass/fail decision that can trigger a reject mechanism or an alarm.
What are the parts of a machine vision system?
A vision system comprises lighting, a camera or imager, a processor, software and output devices. Inspection systems "usually include lighting, a camera or other imager, a processor, software, and output devices", according to Wikipedia, and lighting is designed to give the contrast that later processing needs. The diagram below shows the typical layout on a conveyor: illumination and camera over the object, processing, and a mechanism that acts on the result.

Processing can run on a CPU, GPU, FPGA or a combination. When the imager and processor share one housing the product is called a smart camera or smart sensor. Separate cameras connect over a standardised digital interface such as Camera Link or CoaXPress, or over Ethernet.
Which vision architecture should you choose?
Use a smart camera for self-contained tasks, a PC-based system for several cameras or heavy processing, and deep learning where defects are hard to describe with rules. Each trades flexibility against simplicity.
| Architecture | Best for | Strengths | Trade-offs |
|---|---|---|---|
| Smart camera or vision sensor | Single-station checks: presence, code reading, measurement | Compact, built-in PLC communication, quick set-up | Limited processing power and flexibility |
| PC-based vision | Multi-camera, high-throughput or complex measurement | Flexible software, high-speed interfaces such as GigE Vision or CoaXPress | More engineering, and an industrial PC to maintain |
| Deep-learning inspection | Variable surfaces and defects that are difficult to define as rules | Learns from labelled images during training and infers at run time | Needs representative training images and ongoing validation |
Wikipedia notes conventional machine vision relies on simple differentiation, such as dark defects on a light product, whereas deep learning learns from a large number of images in a training phase and then performs inference at run time. GigE Vision is an interface standard introduced in 2006 for high-performance industrial cameras over Ethernet, maintained by the Association for Advancing Automation (A3), with a description file based on the EMVA GenICam standard. Our computer vision in factories guide covers the AI side.
Why is lighting the first design decision?
Lighting determines whether the camera can see the feature at all, and it is far cheaper to fix before buying a camera. Choose the technique (backlight for silhouettes, coaxial for flat shiny surfaces, ring or dome for general and curved parts, dark-field to highlight surface scratches) and test it on real samples, including the worst ones, before committing. This Cognex video explains how lighting works in factory automation.
How do you choose resolution and field of view?
Start from the smallest feature you must detect and the area you must cover. Pixel size on the part is the field of view divided by the number of pixels across it. For example, a 100 mm field of view on a sensor 2,000 pixels wide gives 0.05 mm per pixel. A defect must cover several pixels to be detected reliably, and manufacturers' guidance on how many varies with contrast and algorithm, so test with real samples. If the part moves, motion blur also limits what you can see, which is why short exposures and strong lighting go together.
How does a vision system talk to the PLC?
Mainly via an industrial Ethernet protocol, digital I/O or a simple polled protocol such as Modbus TCP, and increasingly through OPC UA. The choice depends on how much data you need back.
- PROFINET or EtherNet/IP: the camera appears as an IO device and its inputs and outputs map into PLC process memory, exchanged cyclically. Cognex's documentation for In-Sight describes PROFINET IO this way, and states that Siemens S7-1200 and S7-1500 controllers are supported only in TIA Portal, using the camera's GSD file.
- Discrete I/O: a trigger output from the PLC and pass and fail outputs from the camera. Simple and fast, but it carries no measurement data.
- Modbus TCP: the camera exposes a register map the PLC polls. Easy to implement, but not deterministic.
- OPC UA: the VDMA's OPC UA Companion Specification for machine vision (VDMA 40100) defines a generic model for systems from simple vision sensors to complex inspection systems, and handles recipes, configurations and results in a standardised way. It was first released in June 2018; check its current status before relying on it.
For the network side see the PROFINET guide and the OPC UA guide.
What does the PLC handshake look like?
Use a trigger, busy, done, result sequence with a timeout. A typical flow for one inspection:
- A part-present sensor sees the item. The PLC captures the conveyor position or encoder count.
- The PLC sets the camera trigger (or sends a trigger command over the network), optionally with a job or recipe number.
- The camera sets a busy flag, acquires the image and runs the inspection.
- The camera sets a done flag with a result bit, and optionally a measurement or ID.
- The PLC reads the result while done is set, then clears the trigger and waits for done to fall.
- If done never arrives within a timeout, the PLC raises a fault, because a silent vision failure must never let uninspected product through.
Keep the handshake in one function block with a clear interface (Trigger, Done, Pass, Value, Fault), so the same code works for every station.
Worked example: timing a reject on a filling line
Take a line running 300 bottles per minute. That is 5 bottles per second, so each bottle gets 200 ms of line time, and image capture, processing and communication must fit inside that window with margin. If the bottle pitch is 100 mm, the conveyor moves at 5 x 0.1 = 0.5 m/s. An ejector 0.5 m downstream of the camera is therefore reached 1.0 second later, five bottles after the inspected one.
A fixed delay of 1.0 s works only while the speed never changes. Real conveyors slow, stop and restart, so track by position: store each result in a shift register or queue indexed by the encoder count, and fire the ejector when the failed bottle reaches the reject position. Log rejects with a counter, and raise an alarm if several fail consecutively, which often points to an upstream filler or capper fault rather than a vision fault. These numbers are an illustrative calculation; measure your own pitch, speed and mechanical response times.
What commonly goes wrong?
- Lighting treated as an afterthought. Solve it first, on real samples.
- Vibration and mounting. A camera on a shaking bracket gives drifting measurements, so mount it rigidly.
- No calibration plan. Cameras and lighting drift; build checks with a reference target into maintenance.
- Over-fitted AI models. A model trained only on perfect samples misses real defects, so train and validate on representative production images.
- Weak PLC integration. Without a timeout, tracking and a defined fail-safe state, a good camera still lets bad parts through.
- Chasing the most expensive camera. Specify to the smallest feature you must detect and the cycle time, not to the vendor catalogue.
How EDWartens can help
The Professional Module is a five-day live online Siemens TIA Portal class covering S7 PLC programming, HMI and WinCC SCADA. It does not teach machine vision, and the course is online and Siemens-focused, but it builds the PLC skills used in the trigger, result and reject logic above, and the self-paced Basic Engineering includes industrial communication protocols and control systems. Practise handshake and counter logic in the free PLC simulator and the ladder logic simulator. See the Professional Module and sign up.





