Skip to the content
2 layers77 × 47.3 mmVer1, the printed circuit board in 3D

Industrial 2D Bin Packing & Conveyor Sizing System (Thesis)

Size
77 × 47.3 mm
Copper layers
2
Thickness
1.6 mm
Parts
11
Nets
20
Pads
41
Tracks, vias
87, 0
Pours
1
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
31 Aug 2026
Updated
31 Aug 2026

Overview

Ver1 is an open-source printed circuit board by JuanIDK201, from the JuanIDK201/smart-packing-cv-system repository on GitHub, published under the MIT licence. It is a 2-layer board of 77 × 47.3 mm with 11 parts on 20 nets, routed with 87 tracks and 0 vias.

Its parts include 2 resistors, 1 IC and 1 transistor. It belongs with the ESP32 and RISC-V boards of this library.

README

README.md

Smart Packing CV System

Industrial 2D Bin Packing & Automated Conveyor Sizing System using Computer Vision, Metaheuristics, and Closed-Loop PID Control

Python OpenCV OR-Tools ESP32 KiCad License: MIT


Overview

Smart Packing CV System is an end-to-end industrial automation and mechatronics solution developed as an Engineering Degree Thesis. The project integrates real-time Computer Vision on a conveyor belt, closed-loop DC motor velocity control (PID) via ESP32/Arduino, and a multi-algorithm 2D Bin Packing Optimization Engine (MaxRects, Skyline, Genetic Algorithm, and Google OR-Tools CP-SAT) to optimize package placement in shipping containers while minimizing spatial waste and processing time.

mermaid
graph TD
    A["Industrial Conveyor Belt (DC Motor + Encoder)"] -->|"Laser Gate Trigger"| B["ESP32 Closed-Loop PID Controller"]
    B -->|"Serial Handshake (115200 baud)"| C["Raspberry Pi 4 / Host Computer"]
    C -->|"Picamera2 / USB Camera"| D["OpenCV Computer Vision Engine"]
    D -->|"Contour Detection & Dimension Estimation"| E["Object Profiler (L x W x H)"]
    E -->|"JSON Real-time Feed"| F{"Optimization Engine"}
    F -->|"Maximal Rectangles"| G["MaxRects Algorithm"]
    F -->|"Skyline Heuristic"| H["Skyline 2D Packer"]
    F -->|"Constraint Programming"| I["Google OR-Tools CP-SAT"]
    F -->|"Metaheuristics"| J["Genetic Algorithm"]
    G & H & I & J --> K["Tkinter Interactive GUI & Benchmark Analytics"]
    K --> L["Final Packing Plan (2D Map & Utilization %)"]

Key Features

  • Automated Computer Vision Dimensioning:
    • Optical detection of items using Gaussian blur, adaptive thresholding, and contour bounding box extraction.
    • Optical measurement calibration compensating for conveyor perspective and variable lighting.
    • Optional QR code scanning for package tracking and metadata association.
  • Closed-Loop Speed & Position Control:
    • ESP32 / Arduino PID controller reading quadrature optical encoder feedback.
    • Smooth ramp acceleration, laser gate trigger synchronization, and bidirectional motor driving.
  • Multi-Algorithm 2D Packing Benchmark:
    • MaxRects (Maximal Rectangles): Best-fit surface heuristic for high density.
    • Skyline: Fast bottom-left boundary tracking heuristic.
    • Google OR-Tools (CP-SAT): Exact constraint programming optimization for optimal floor layout.
    • Genetic Algorithm: Evolutionary stochastic search with crossover and mutation operators.
  • Desktop Operator Dashboard:
    • Real-time Matplotlib container visualization.
    • Automated efficiency comparison, runtime profiling, and statistical PDF reporting.
  • Custom Hardware & PCB:
    • KiCad dual-layer PCB schematic and layout for sensor optocoupling, motor drivers, and power regulation.
    • 3D CAD models (STL) for camera brackets, laser alignment fixtures, and conveyor mounts.

Technology Stack

DomainTechnologies
Software & AIPython 3.9+, OpenCV, Google OR-Tools, NumPy, Pandas, Matplotlib, SciPy, Tkinter
Embedded & FirmwareESP32, Arduino C++, FreeRTOS, Quadrature Encoder ISR, Hardware Timers
Electronics (EDA)KiCad (Schematic capture, PCB layout, Gerber files)
CAD & MechanicalAutodesk Fusion 360, 3D Printing (PLA/PETG)

Repository Structure

text
smart-packing-cv-system/
 src/
    vision/                     # Computer vision pipeline and dimensioning
       camera_detector.py      # Camera capture and calibration
       conveyor_vision_pipeline.py # Serial sync and real-time conveyor loop
       measure_box.py          # Contour sizing algorithms
       medidor.py              # Real-time measurement streamer
       qr_reader.py            # QR code payload decoder
    optimization/               # 2D Bin packing optimization algorithms
       maxrects.py             # MaxRects BSSF/BL packing
       skyline.py              # Skyline heuristic packer
       or_tools_optimizer.py   # Constraint Programming via Google OR-Tools
       genetic_optimizer.py    # Evolutionary algorithm implementation
       container.py            # Container data structure & collision checks
       package_generator.py    # Synthetic package batch generator
    gui/
       master_dashboard.py     # Operator GUI with interactive Matplotlib plots
    benchmark/
        statistical_tests.py    # ANOVA / t-test benchmark script
 firmware/
    esp32_conveyor_pid/         # Main ESP32 PID conveyor firmware
       esp32_conveyor_pid.ino
    arduino_subsystems/         # Modular Arduino testing routines
        control_motor_banda.ino

Installation & Setup

1. Software Setup

bash
# Clone the repository
git clone https://github.com/JuanIDK201/smart-packing-cv-system.git
cd smart-packing-cv-system

# Create and activate virtual environment
python -m venv venv
# On Windows:
venv\Scripts\activate
# On Linux/macOS:
source venv/bin/activate

# Install required dependencies
pip install -r requirements.txt

2. Firmware Flashing

  1. Open firmware/esp32_conveyor_pid/esp32_conveyor_pid.ino in the Arduino IDE or PlatformIO.
  2. Select your ESP32 board (ESP32 Dev Module).
  3. Set the communication baud rate to 115200.
  4. Upload firmware to the ESP32.

3. Execution

bash
# Launch the Master GUI Dashboard with algorithm comparison
python src/gui/master_dashboard.py

# Launch the live conveyor acquisition and sizing pipeline
python src/vision/conveyor_vision_pipeline.py

Experimental Results

Across test benchmarks with multiple box dimensions:

  • MaxRects achieved 88.4% average container surface utilization with low computational latency (< 50 ms).
  • Google OR-Tools yielded near-optimal theoretical layouts (91.2% utilization) on constrained item sets.
  • Closed-loop PID control stabilized conveyor velocity with < 1.8% steady-state error under variable payload masses.

Author

Juan Garzón
Mechatronics & Embedded Systems Engineer


License

This project is licensed under the MIT License - see the LICENSE file for details.

Parts

11
QtyValueFootprintReferences
3Screw_Terminal_01x02TerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-3-2-5.08_1x02_P5.08mm_Horizontal10V1, 12VIN1, 12VOUT1
2Conn_01x03_PinConnector_PinSocket_2.54mm:PinSocket_1x03_P2.54mm_VerticalEncoder1, Serial1
2RResistor_THT:R_Axial_DIN0309_L9.0mm_D3.2mm_P15.24mm_HorizontalR1, R2
2Screw_Terminal_01x03TerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-3-3-5.08_1x03_P5.08mm_HorizontalLaser1, PuenteH1
12N2219Package_TO_SOT_THT:TO-39-3Q1
1ESP32-C3_SUPERMINI_THESP32-C3_SUPERMINI_TH:MODULE_ESP32-C3_SUPERMINI_THU1

Similar boards

  • 2 layers60 × 30 mmController, the printed circuit board in 3D

    Controller

    google/mozc-devices

    Circuit diagrams and firmware source code for Gboard DIY keyboards

    11 parts3kApache-2.0
  • 2 layers103 × 30.5 mmTS Front Endcap, the printed circuit board in 3D

    TS Front Endcap

    EEVengers/ThunderScope

    ThunderScope GitHub Repo

    11 parts1.3kMIT
  • 2 layers26 × 30 mmExpansion Card, the printed circuit board in 3D

    Expansion Card

    FrameworkComputer/ExpansionCards

    Reference designs and documentation to create Expansion Cards for the Framework Laptop

    11 parts1.1kCC-BY-4.0
  • 2 layers53.9 × 23.2 mmBuffer, the printed circuit board in 3D

    Buffer

    hoglet67/RGBtoHDMI

    Bare-metal Raspberry Pi project that provides pixel-perfect sampling of Retro Computer RGB/YUV video and conversion to HDMI

    11 parts1kGPL-3.0
  • 2 layers10 × 20 mm2 connector Sensor Board, the printed circuit board in 3D

    2 connector Sensor Board

    hackclub/OnBoard

    💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

    11 parts915
  • 2 layersFet module, the printed circuit board in 3D

    Fet module

    ByteWelder/Decktility

    A handheld PC

    11 parts855CC-BY-SA-4.0
  • 2 layers47 × 33 mmSevensegment led display module, the printed circuit board in 3D

    Sevensegment led display module

    tardate/LittleArduinoProjects

    a collection of "Little Electronic & Arduino Projects", most involving electronics or an Arduino in one way or another!

    11 parts803MIT
  • 2 layers42.5 × 36.8 mmDevboard, the printed circuit board in 3D

    Devboard

    basilfx/TRADFRI-Hacking

    Hacking IKEA TRÅDFRI products, such as light bulbs, window blinds and other accessories.

    11 parts743CC-BY-4.0

Questions

How big is the Ver1 PCB?

It measures 77 × 47.3 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Ver1 use?

11 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Ver1 KiCad files?

From the JuanIDK201/smart-packing-cv-system repository on GitHub, at the commit this page was made from: the board is hardware/kicad/Ver1/Ver1.kicad_pcb and its schematic hardware/kicad/Ver1/Ver1.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Ver1 design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).