Back Homepage

PLC UR3 Vision Quality Control

PLC, Raspberry Pi, Structured-Text, Ladder-logic, Reverse-Engineering, Leadership

Completed: 8 Nov 2025

Repository: https://github.com/marcus-frisch/sif408_camera

In the 45860 Automation Studio, my team member Matthew and I were tasked with enhancing the functionality and reliability of an SMC SIF-400 Smart Factory manufacturing plant. We identified a critical failure point in the SIF-408 Palletizing Station: the UR3 robot occasionally misaligned cylindrical canisters within the pallet grooves, causing them to be dispatched at a tilt and triggering downstream failures.

To resolve this, we integrated a vision-based closed-loop quality control system. Because the manufacturer provided no documentation for the PLC-to-Robot communication, we performed extensive reverse engineering to inject a new inspection and "re-corrective" state machine into the existing architecture without disrupting the station’s Profinet backbone.

Key Contributions:

  • Reverse Engineering: Deciphered undocumented Structured Text and URScript state machines to understand the proprietary handshake protocols between the Siemens S7-1500 PLC and the UR3 robot.
  • System Integration: Designed a non-disruptive integration plan to insert inspection states into the SIF-400 network logic.
  • Robot Programming: Programmed new logic, functions, and waypoints on the UR3 via the teach-pendant and direct script manipulation.
  • Vision & Edge Computing: Configured a Raspberry Pi 5 with a Camera Module 3 to act as an independent side-on inspection agent, utilizing PM2 for process resiliency and automated startup.

Technical Highlights

  • 98% Assignment Mark: Our solution was requested by the subject coordinator to remain as a permanent demonstration for future cohorts.
  • Creative Problem Solving: Due to physical gripper limitations, we developed a novel corrective action: if a tilt is detected, the robot retrieves a "spare" canister to use as a tool, physically pressing the misaligned containers flat.
  • Dual-View OpenCV Inspection: Designed a routine where the UR3 presents the pallet to the camera and rotates it 180°. A Python/OpenCV script uses Canny edge detection to verify alignment across all four containers.
  • Modbus TCP Communication: Established a Modbus TCP server on the Raspberry Pi, allowing the UR3 to trigger "Photo Ready" events and receive "Pass/Fail" booleans in real-time.
  • Industrial Networking: Managed static IP configurations to integrate the Raspberry Pi into the existing industrial hardware stack via Ethernet.

Technical skills

  • PLC & Robotics: TIA Portal V19 (Structured Text, Ladder Logic), UR3 (URScript, Teach-Pendant).
  • Software: Python (OpenCV, PyModbus), Linux (Raspberry Pi OS, PM2 Process Management, SSH).
  • Protocols: Profinet, Modbus TCP.
Project image Project image Project image Project image Project image Project image Project image Project image