Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
25 views13 pages

Manul AOI Using PCB-AOI Software

The document outlines a PCB component and solderability defect monitoring application designed for the Godrej AC project, detailing its purpose, installation steps, and required tools. It emphasizes automating visual inspections to detect critical defects, improving quality assurance, and maintaining traceability. Additionally, it provides a comprehensive guide for setting up the software, running inspections, and saving results, along with a sample Python Tkinter GUI code for user-friendly operation.

Uploaded by

Shrinidhi S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views13 pages

Manul AOI Using PCB-AOI Software

The document outlines a PCB component and solderability defect monitoring application designed for the Godrej AC project, detailing its purpose, installation steps, and required tools. It emphasizes automating visual inspections to detect critical defects, improving quality assurance, and maintaining traceability. Additionally, it provides a comprehensive guide for setting up the software, running inspections, and saving results, along with a sample Python Tkinter GUI code for user-friendly operation.

Uploaded by

Shrinidhi S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Here is a detailed and well-structured summary based on our discussion about the PCB component and solderability

defect monitoring application tailored for your Godrej AC project:

Summary: PCB Component & Solderability Defect Monitoring Software

1) Why We Are Using This Software

 To automate visual inspection of PCBs by comparing each test board against a "golden sample" reference board
image.

 To detect critical defects such as missing components, solder shorts, cold joints, insufficient solder, and
component misalignment.

 To replace or supplement costly/hardware-dependent AOI systems, especially in scenarios where AOI or laser
inspection devices are not feasible.

 To improve quality assurance by providing reliable, repeatable, and objective defect detection.

 To save time and effort in manual inspection and reduce human error, ensuring higher product quality and
customer satisfaction.

 To maintain traceability and defect records by linking inspection results with barcode data and test images.

2) How to Install This on Your Desktop (Step-by-Micro-Level Guide)

Step 1: Install Python

 Visit python.org

 Download the latest Python version for Windows.

 Run the installer and check "Add Python to PATH" before clicking Install.

 Verify installation: Open Command Prompt and run python --version.

Step 2: Download the PCB Inspection Software

 Go to the GitHub repository for pcb-aoi: https://github.com/apertus-open-source-cinema/pcb-aoi

 Click "Code" > "Download ZIP".

 Extract the ZIP file to a known folder (e.g., C:\pcb-aoi).

Step 3: Install Required Python Libraries

 Open Command Prompt.

 Navigate to the extracted folder's Python script directory, e.g.,


cd C:\pcb-aoi\python

 Run:

text

pip install numpy opencv-python pyzbar pillow pandas


Step 4: Prepare Your Images

 Capture PCB board photos with your smartphone, ensuring barcode visibility.

 Transfer images to your PC (USB/cloud/email).

 Move images to the test_images folder inside the pcb-aoi directory.

Step 5: Run the Inspection

 From the command line, run the inspection script with a test image, e.g.:

text

python pcb_processing.py test_images/your_test_board.jpg

 The software compares the test image against the golden reference, detects defects, and outputs results.

3) What Is the Code We Are Going to Use

 The core software combines OpenCV for image processing, pyzbar for barcode detection, and Tkinter for a
desktop GUI (optional).

 The approach includes:

o Loading a golden reference board image.

o Detecting components and solder joints via contour, thresholding, and edge detection.

o Comparing component positions between golden and test boards to find missing or misplaced parts.

o Analyzing solder joints for shorts and cold joints based on brightness and area.

o Reading board barcodes to tag inspection results.

o Calculating an overall quality score and classifying PASS, REVIEW, or FAIL.

o Saving results with timestamps, barcode IDs, and defect counts to Excel or CSV files.

 Example snippets involve thresholding, contour detection, barcode decoding (pyzbar), and basic statistical
analysis of solder joint images.

4) Required Tools to Be Installed & How to Install Them

Tool Purpose Installation Method

Python Runtime environment Official site [python.org], add to PATH during install

OpenCV (opencv-
Computer vision processing pip install opencv-python
python)

pyzbar Barcode decoding pip install pyzbar

Pillow Image processing and GUI support pip install pillow


Tool Purpose Installation Method

Data storage and export to


pandas pip install pandas
Excel/CSV

GUI framework (usually included Included in most Python standard installs; if missing, install via
Tkinter
with Python) OS package manager

5) How to Eliminate False Calls

 Image Quality: Use high-resolution, sharp images from consistent lighting environments to reduce noise.

 Image Alignment: Implement feature-based image registration (using fiducial marks or feature matching) to align
test and golden board images precisely before comparison.

 Threshold Calibration: Carefully tune parameters such as contour area thresholds, pixel distance for matching
components, and solder quality scores based on real boards.

 Multiple Views and Lighting: If possible, capture multiple images with varied lighting to reveal defects better.

 Training and Iteration: Test on many samples, adjusting sensitivity settings and thresholds to balance false
positives and false negatives.

 Optional AI Integration: For higher accuracy, incorporate trained machine learning models to classify subtle
defects beyond pure CV methods.

 Operator Review for Borderline Cases: Set defect thresholds allowing "REVIEW" status for uncertain boards
needing manual check, reducing false fails.

6) How to Save the Inspected Data and How Easily It Can Be Retrieved

 Inspection results are saved in Excel (.xlsx) or CSV files including:

o Timestamp of inspection.

o Board barcode (automatically detected or manually input).

o Image filename or path.

o Counts of missing components, solder shorts, cold joints, and overall quality score.

o PASS/REVIEW/FAIL status flags.

 Board images can be saved in a dedicated folder named by barcode or timestamp for traceability.

 The Excel/CSV file can be opened anytime for historic inspection review or reporting.

 Integration with simple database tools or Excel pivot tables allows filtering and querying by date, barcode, or
defect type for root-cause analysis.

 The software GUI can list recent inspections and show detailed defect reports, speeding up data retrieval by
operators or quality engineers.
Final Notes

With this system, you get a free, easy-to-deploy solution for PCB inspection using only your phone camera and a
Windows PC, saving costs on expensive AOI machines but still achieving robust quality control through:

 Visual component and solder defect inspection.

 Barcode-based traceability.

 Automated data recording and reporting.

 Customizable thresholds for balancing accuracy.

If you want, I can provide direct code snippets, customization tips, or a more in-depth beginner guide to the software
GUI and scripting.

Would you like me to generate a ready-to-run minimal example code or help set up a step-by-step tutorial for this
software?

1. https://blog.roboflow.com/part-inspection-using-computer-vision/

2. https://blog.roboflow.com/pcb-defect-detection/

3. https://pysource.com/2025/06/04/build-an-accurate-visual-inspection-system-with-python/

4. https://www.youtube.com/watch?v=jF6b9WxTGMQ

5. https://github.com/swaralipaygude/Bare-PCB-defect-detection-using-OpenCV

6. https://github.com/Ixiaohuihuihui/Tiny-Defect-Detection-for-PCB

7. https://www.kaggle.com/code/pinokiokr/pcb-defect-detection

The ultimate introduction to modern GUIs in Python [ with ...


Tkinter Data Entry Form tutorial for beginners - Python GUI ...

Python tkinter setup a basic GUI

I will create a full Tkinter desktop GUI version of the minimal PCB Defect Inspector script you have, so that you and your
operators can load images, run inspections, and save results by just clicking buttons—no command line needed.

Here is a ready-to-run Python Tkinter example that:

 Lets you load a golden reference board image and a test board image (your phone photos).

 Automatically reads the barcode from the test image (if visible).

 Performs a basic defect detection by comparing the test and golden images.

 Shows the test image with defects highlighted.


 Saves inspection results with timestamp, barcode, and defect count to a CSV.

 Provides simple buttons and status labels in a user-friendly window.

Full Tkinter GUI PCB Inspection Example

python

import tkinter as tk

from tkinter import filedialog, messagebox

from PIL import Image, ImageTk

import cv2

import numpy as np

import pandas as pd

from datetime import datetime

from pyzbar import pyzbar

import os

class PCBInspectorGUI:

def __init__(self, root):

self.root = root

self.root.title("PCB Defect Inspector")

self.root.geometry("900x600")

# Initialize variables

self.golden_img = None

self.test_img = None

self.golden_img_path = None

self.test_img_path = None

# GUI Layout

self.setup_gui()

def setup_gui(self):
# Frames for buttons and images

btn_frame = tk.Frame(self.root)

btn_frame.pack(side=tk.TOP, fill=tk.X, pady=10)

self.load_golden_btn = tk.Button(btn_frame, text="Load Golden Board Image", command=self.load_golden)

self.load_golden_btn.pack(side=tk.LEFT, padx=10)

self.load_test_btn = tk.Button(btn_frame, text="Load Test Board Image", command=self.load_test,


state=tk.DISABLED)

self.load_test_btn.pack(side=tk.LEFT, padx=10)

self.inspect_btn = tk.Button(btn_frame, text="Start Inspection", command=self.inspect, state=tk.DISABLED)

self.inspect_btn.pack(side=tk.LEFT, padx=10)

self.save_btn = tk.Button(btn_frame, text="Save Results", command=self.save_results, state=tk.DISABLED)

self.save_btn.pack(side=tk.LEFT, padx=10)

# Canvas to display images side by side

display_frame = tk.Frame(self.root)

display_frame.pack(fill=tk.BOTH, expand=True, padx=10, pady=10)

# Golden board display

golden_lbl_frame = tk.LabelFrame(display_frame, text="Golden Board Image")

golden_lbl_frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True, padx=5)

self.golden_canvas = tk.Canvas(golden_lbl_frame, bg='black')

self.golden_canvas.pack(fill=tk.BOTH, expand=True)

# Test board display

test_lbl_frame = tk.LabelFrame(display_frame, text="Test Board Image")

test_lbl_frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True, padx=5)


self.test_canvas = tk.Canvas(test_lbl_frame, bg='black')

self.test_canvas.pack(fill=tk.BOTH, expand=True)

# Inspection result label

self.result_label = tk.Label(self.root, text="Load golden board first.", font=("Arial", 14))

self.result_label.pack(pady=5)

def load_golden(self):

filepath = filedialog.askopenfilename(title="Select Golden Board Image", filetypes=[("Images", "*.png *.jpg *.jpeg


*.bmp")])

if filepath:

img = cv2.imread(filepath)

if img is None:

messagebox.showerror("Error", "Failed to load image!")

return

self.golden_img = img

self.golden_img_path = filepath

self.display_image(img, self.golden_canvas)

self.result_label.config(text="Golden board loaded. Now load test board.", fg="blue")

self.load_test_btn.config(state=tk.NORMAL)

def load_test(self):

filepath = filedialog.askopenfilename(title="Select Test Board Image", filetypes=[("Images", "*.png *.jpg *.jpeg


*.bmp")])

if filepath:

img = cv2.imread(filepath)

if img is None:

messagebox.showerror("Error", "Failed to load image!")

return

self.test_img = img

self.test_img_path = filepath
self.display_image(img, self.test_canvas)

self.result_label.config(text="Test board loaded. Ready to inspect.", fg="blue")

self.inspect_btn.config(state=tk.NORMAL)

def display_image(self, cv_img, canvas):

# Convert from BGR to RGB for Tkinter

rgb_img = cv2.cvtColor(cv_img, cv2.COLOR_BGR2RGB)

h, w = rgb_img.shape[:2]

# Resize image to fit canvas while keeping aspect ratio

canvas_width = canvas.winfo_width() or 400

canvas_height = canvas.winfo_height() or 300

scale = min(canvas_width/w, canvas_height/h)

new_w, new_h = int(w*scale), int(h*scale)

resized = cv2.resize(rgb_img, (new_w, new_h))

# Convert to ImageTk format

im_pil = Image.fromarray(resized)

imgtk = ImageTk.PhotoImage(image=im_pil)

canvas.delete("all")

canvas.create_image(canvas_width//2, canvas_height//2, image=imgtk, anchor="center")

canvas.image = imgtk # Keep a reference to prevent garbage collection

def inspect(self):

if self.golden_img is None or self.test_img is None:

messagebox.showwarning("Warning", "Please load both golden and test board images.")

return

# Perform defect detection

defects_count, marked_img = self.detect_defects(self.golden_img, self.test_img)


# Display defect marked image

self.display_image(marked_img, self.test_canvas)

# Read barcode from test image

barcode = self.read_barcode(self.test_img)

# Update result label

status = "PASS ✅" if defects_count==0 else "FAIL ❌"

self.result_label.config(text=f"Inspection Result: {status} | Defects detected: {defects_count} | Barcode: {barcode}",


fg="green" if defects_count==0 else "red")

# Save current inspection results for saving later

self.current_result = {

"timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),

"barcode": barcode,

"defects": defects_count,

"image_path": self.test_img_path

self.save_btn.config(state=tk.NORMAL)

def detect_defects(self, golden, test):

# Convert to grayscale

golden_gray = cv2.cvtColor(golden, cv2.COLOR_BGR2GRAY)

test_gray = cv2.cvtColor(test, cv2.COLOR_BGR2GRAY)

# Compute absolute difference

diff = cv2.absdiff(golden_gray, test_gray)

# Threshold difference image


_, thresh = cv2.threshold(diff, 50, 255, cv2.THRESH_BINARY)

# Find contours of differing areas

contours, _ = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)

defects = 0

marked = test.copy()

for cnt in contours:

area = cv2.contourArea(cnt)

if area > 100: # Sensitivity threshold

x,y,w,h = cv2.boundingRect(cnt)

cv2.rectangle(marked, (x,y), (x+w,y+h), (0,0,255), 2)

defects += 1

return defects, marked

def read_barcode(self, image):

# Convert to grayscale for decoding

gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

barcodes = pyzbar.decode(gray)

if barcodes:

return barcodes[0].data.decode('utf-8')

return "NO_BARCODE"

def save_results(self):

if not hasattr(self, "current_result"):

messagebox.showwarning("Warning", "No inspection result to save!")

return

# Ensure results file exists, or write header


file_exists = os.path.isfile("inspection_results.csv")

df = pd.DataFrame([[

self.current_result["timestamp"],

self.current_result["barcode"],

self.current_result["defects"],

self.current_result["image_path"]

]], columns=["Timestamp", "Barcode", "Defects", "ImagePath"])

df.to_csv("inspection_results.csv", mode='a', header=not file_exists, index=False)

messagebox.showinfo("Saved", "Inspection results saved successfully.")

self.save_btn.config(state=tk.DISABLED)

if __name__ == "__main__":

root = tk.Tk()

app = PCBInspectorGUI(root)

root.mainloop()

How to Use This GUI

1. Run this Python script on your Windows PC (make sure dependencies are installed).

2. Click Load Golden Board Image and select your reference PCB photo.

3. Then click Load Test Board Image and pick the board photo to inspect.

4. Click Start Inspection to run defect detection and barcode reading.

5. Results show under the buttons with defects highlighted in the test image.

6. Click Save Results to log the inspection details (timestamp, barcode, defect count, image path) into
inspection_results.csv.

What You Need to Install (Run Once)

Open Command Prompt and run:

text

pip install opencv-python pillow pandas pyzbar


 opencv-python: Image processing

 pillow: For image display in Tkinter

 pandas: For saving results to CSV

 pyzbar: For barcode reading

Benefits of This Full GUI Version

 No command line needed; all user interactions via buttons.

 Clear image display with defect markings.

 Barcode auto-read from image (if barcode visible).

 Easy saving and traceability of inspection data.

 Ready to extend with more advanced detection algorithms or report features.

If you want, I can also help you add:

 Live webcam capture support.

 More detailed defect classification.

 Export reports as Excel or PDF.

 User management or database integration.

Would you like me to guide you on these next steps or help with deploying this app on your operator stations?

1. https://blog.roboflow.com/pcb-defect-detection/

2. https://www.youtube.com/watch?v=mop6g-c5HEY

3. https://www.digikey.com/en/maker/projects/python-gui-guide-introduction-to-tkinter/
d04a764c78114682aac9255056026338

4. https://robu.in/gui-designing-on-raspberry-pi-using-tkinter-and-python/

5. https://realpython.com/python-gui-tkinter/

6. https://www.geeksforgeeks.org/python/python-gui-tkinter/

7. https://www.youtube.com/watch?v=vusUfPBsggw

8. https://www.youtube.com/watch?v=lyoyTlltFVU

9. https://www.geeksforgeeks.org/python/create-first-gui-application-using-python-tkinter/

10. https://www.youtube.com/playlist?list=PLCC34OHNcOtoC6GglhF3ncJ5rLwQrLGnV

You might also like