Skip to content

GBR-RL/VisionSort-RPi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

42 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GitHub Pages

Computer Vision Embedded Systems Image Processing Python OpenCV ONNX YOLOv8 Raspberry Pi Status

VisionSort-RPi

An AI-Powered Conveyor Belt Sorting System Using Raspberry Pi + YOLOv8 + Hailo

A real-time bolt-and-nut sorting system powered by computer vision and embedded AI. This project blends hardware engineering with object detection and real-world automation β€” combines hardware engineering, object detection, and creative problem-solving to efficiently sort Bolts and Nuts.


Overview

VisionSort-RPi is an edge-deployed conveyor belt system that showcases real-world applications of embedded AI.
Built using Raspberry Pi 5, YOLOv8, and the Hailo AI accelerator, it automates object classification and sorting tasks with high accuracy and speed.


πŸ–ΌοΈ 3D Model & Real Conveyor Sorting System

3D CAD Model
3D CAD Model
Real Conveyor System
Conveyor Sorting System

Side-by-side view of the designed CAD model and the actual built system with camera and flapper mounted.

Key Features

  • βœ… Real-Time Object Detection with YOLOv8 + Hailo for bolts and nuts
  • βœ… Stepper + Servo Motor Integration for precise movement and sorting
  • βœ… Edge Deployment on Raspberry Pi 5 with hardware-accelerated inference
  • βœ… Custom Dataset with over 9,000 annotated training images
  • βœ… Optimized for speed using neural network acceleration (Hailo RT)
  • βœ… Fully Autonomous Sorting with no human-in-the-loop

Tech Stack

Category Tools & Hardware
🧠 CV/AI YOLOv8, Roboflow, Python, OpenCV
βš™οΈ Embedded HW Raspberry Pi 5, Hailo AI Kit, NEMA 17, MG996R Servo
πŸ“· Camera Raspberry Pi HQ Camera + 16mm 10MP Telephoto
πŸ”Œ Communication GPIO, PWM, I2C
πŸ“¦ Dataset Roboflow custom-labeled (9000+ images)

Mechanical Components & CAD

This project includes custom-designed mechanical components modeled in Creo Parametric and fabricated using 3D printing. Key components include:

  • Flapper mechanism for nut/bolt sorting
  • Servo mounting bracket
  • RPi HQ camera holder

πŸ”— View CAD designs & prints in CAD/
πŸ“„ Download full BOM: BOM.xlsx
πŸ“€ External CAD repo: GrabCAD – VisionSort-RPi

πŸ“¦ Download 3D printable CAD models: ➑️ GitHub Release: CAD v1.0


Project Architecture

Hardware Design

  • Conveyor belt driven by NEMA 17 stepper motor
  • Servo-controlled deflector arm for object redirection
  • HQ Camera with a 16mm telephoto lens for accurate detection
  • All powered and controlled via Raspberry Pi 5

Data + AI

  • Pre-annotated dataset from Roboflow
  • Bounding box labels with nut and bolt classes
  • Trained on HPC using YOLOv8 custom config
  • Inference optimized with Hailo RT SDK

Software Pipeline

  1. Camera Frame Capture β†’
  2. Image Preprocessing (OpenCV) β†’
  3. YOLOv8 Inference (Hailo AI) β†’
  4. Object Classification β†’
  5. Motor Control Signal β†’
  6. Stepper + Servo Movement

Setup Instructions

Hailo AI Environment Setup

This project utilizes Hailo’s AI acceleration platform for deploying YOLOv8 models on the Raspberry Pi 5.
You can find the environment setup in their official repo.

Installation Steps

git clone https://github.com/hailo-ai/hailo-rpi5-examples.git
cd hailo-rpi5-examples
./install.sh

Every time you open a new terminal session, activate the environment:

source setup_env.sh

Running the Conveyor Sorting System

Run the real-time detection and sorting application using:

python detection/detection.py \
  --labels-json resources/nut_bolt-labels.json \
  --hef-path model/nut_bolt_model.hef \
  --input rpi

Press Ctrl+C to stop the system gracefully.


Hardware Wiring Diagram

The wiring for the stepper and servo motor system was meticulously crafted for precise control and safety.
Key components include the TMC2208 stepper driver, MG996R servo motor, buck converter, and external 12V power supply.

Wiring Summary

Component Raspberry Pi GPIO Notes
TMC2208 - STEP GPIO17 (Pin 11) Step signal
TMC2208 - DIR GPIO27 (Pin 13) Direction signal
TMC2208 - EN GND Must be LOW to enable
TMC2208 - VIO 3.3V Logic level
TMC2208 - GND GND
MG996R - SIGNAL GPIO12 (PWM) Servo control via PWM
Servo Vcc Buck Converter 5V Ensure stable 5V using multimeter
Buck Converter Input 12V external supply Powers motors + regulated 5V output

πŸ“Ž Full schematic is detailed in docs/Wiring_Setup.pdf


Training the YOLOv8 Model

The model used in this project is a fine-tuned YOLOv8n trained on a custom Roboflow dataset (9000+ images).

Training script used: training.py

  • Based on YOLOv8n.pt pretrained weights
  • Trained to detect only two classes: bolt and nut
  • Handled augmentation, batch balancing, and early stopping

Model Conversion for Hailo Deployment

YOLOv8 .pt model was converted to Hailo-compatible .hef format using the Hailo Dataflow Compiler (DFC).

Conversion steps are documented in Convert_YoloV8_to_HEF.ipynb

Pipeline

  • .pt β†’ .onnx via Ultralytics export
  • .onnx β†’ .hef using Hailo’s hef-generator script

Guide followed: Guide to Using Hailo DFC


System Demonstration

Real-time sorting demo using computer vision and Raspberry Pi:

πŸŽ₯ VisionSort Demo


What's Next?

  • Add camera calibration + lighting normalization
  • Expand dataset to include more object categories for diverse sorting applications.
  • Integrate IoT for remote monitoring.

πŸ“© Contact

I’m excited to connect and collaborate!


πŸ“š License

This project is open-source and available under the MIT License.


🌟 If you like this project, please give it a star! 🌟

About

A conveyor belt sorting system powered by Raspberry Pi and YOLOv8 for real-time object detection.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages