Advisory Schedule a Technical Discovery Call — Book your session today! »

· Industrial AI  · 2 min read

Computer Vision at the Edge: Practical Industrial Implementation Guide

Detecting defects in Python is easy. Telling the PLC to reject the part in 50ms is hard. Guide with YOLOv11, Hailo-8, and Modbus TCP.

Detecting defects in Python is easy. Telling the PLC to reject the part in 50ms is hard. Guide with YOLOv11, Hailo-8, and Modbus TCP.

The problem with “Artificial Intelligence” in the industry is that 99% of tutorials end when the green box appears around the cat on the screen.

In a real plant, that is useless. If you don’t tell the PLC to reject the part, you just have an expensive TV.

This guide covers the missing link: how to take modern models (YOLOv11) to robust hardware and close the control loop.

1. The Hardware: You Need an Accelerator

A raw Raspberry Pi 5 runs YOLO at 2-3 FPS. Insufficient for a production line. You need an NPU (Neural Processing Unit).

  • Hailo-8: The current king of performance/watt. 26 TOPS. Can run multiple HD streams in real-time.
  • Google Coral (TPU): Old reliable, but falling short against newer models.
  • Nvidia Jetson Orin: The beast. Use if you need pure CUDA, but prepare to pay 10x more.

2025 Recommendation: RPi 5 + Hailo-8L (via M.2 HAT). Total cost < $150 USD.

2. The Model: YOLOv11

Ultralytics just released YOLOv11. It’s lighter and more accurate than v8. Don’t train from scratch. Use Transfer Learning.

  1. Take 100 photos of YOUR defective parts.
  2. Label them with CVAT or Roboflow.
  3. Re-train the base yolo11n.pt (nano) model for 50 epochs.

This is where data scientists fail. How do you tell the PLC “reject”?

Option A: GPIO (Quick and Dirty)

Wire an RPi pin to a PLC input.

  • Pros: Latency < 1ms.
  • Cons: Electrical noise, can only transmit 1 bit (YES/NO).

Option B: Modbus TCP (Standard)

Spin up a Modbus client in Python (pymodbus). When defect detected:

# Inference Pseudo-code
results = model(frame)
if user_conf > 0.85:
    # Write to PLC Register 40001
    client.write_register(1, 1, unit=1) 
    # Optional: Write X,Y coordinates for a robot to grab it
    client.write_register(2, int(box.x), unit=1)

4. Latency and Determinism

The PLC expects a response in fixed time. If your neural net takes 200ms sometimes and 50ms others, the PLC will de-synchronize.

  • Use GStreamer to capture video without buffering.
  • Ensure your inference + communication time is less than the machine’s “Takt Time”.

Conclusion

Edge AI is no longer science fiction. With an RPi 5 and a Hailo-8, you have a vision system that competes with $5000 USD smart cameras, but only if you play by industrial rules: robustness, determinism, and standard protocols.

Back to Blog

Related Posts

View All Posts »