Skip to the content
PCBKitNew board
2 layers105.5 × 119 mmFruit sorter, the printed circuit board in 3D

A complete personal engineering project built and validated from February to May 2026. The system combines edge computer vision, embedded firmware, custom electronics, a real conveyor and a Flutter monitoring…

Size
105.5 × 119 mm
Copper layers
2
Thickness
1.6 mm
Parts
21
Nets
42
Pads
91
Tracks, vias
111, 9
Pours
6
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
13 Apr 2026
Updated
12 Sep 2026

Overview

Fruit sorter is an open-source printed circuit board by nmduc9624, from the nmduc9624/fruit-quality-detection-and-sorting-system repository on GitHub. It is a 2-layer board of 105.5 × 119 mm with 21 parts on 42 nets, routed with 111 tracks and 9 vias.

It is built around the STM32F401CCU6, AMS1117-3.3 and L7805. Its parts include 7 connectors, 4 capacitors, 3 ICs, 2 resistors and 1 diode. It belongs with the STM32 boards of this library.

Main components

3

README

README.md

Real-Time Fruit Quality Detection and Sorting System

A complete personal engineering project built and validated from February to May 2026. The system combines edge computer vision, embedded firmware, custom electronics, a real conveyor and a Flutter monitoring application to classify fruit quality and route accepted products to two output bins.

The physical system uses a direct Raspberry Pi-to-STM32 UART link. There is no ESP32 or MQTT layer.

Demonstrated results

MeasurementResult
Held-out image accuracy97.79% on 226 images
Weighted precision / recall / F10.98 / 0.98 / 0.98
Raspberry Pi throughput13–20 FPS
Per-frame inference latency50–80 ms
Real-conveyor classification after voting960/1,000 = 96%
Complete physical sorting cycles246/250 = 98.4%
Cloud synchronization time1.2–1.7 s

The test protocol and limitations are documented in docs/evaluation.md.

System behavior

Raspberry Pi 4B and Camera Module V3 run a five-class MobileNetV2 INT8 model. A confidence-filtered multi-frame vote reduces transition errors as fruit enters and leaves the field of view. Accepted fruit type 1 and type 2 produce framed UART commands for the STM32F401CCU6. The STM32 confirms physical arrival using separate active-low sensors on PA0 and PA1, then drives servo 1 or servo 2 through TIM3 PWM. Defective fruit continues to the reject end of the conveyor.

The Pi also estimates visible defect area, uploads the result image to Cloudinary, writes the classification event to Firestore, and exposes MJPEG and JSON endpoints. The Flutter client uses Firebase Authentication and Firestore to show live status, daily metrics, images and filterable history.

See docs/architecture.md for the signal, control and power architecture.

Repository layout

text
apps/fruit_quality_monitor/     Flutter Android/web monitoring client
docs/                           Architecture, hardware and evaluation records
edge_ai/models/                 Deployed Edge Impulse Linux INT8 model
edge_ai/runtime/                Raspberry Pi inference and integration service
edge_ai/training_config.json    Authoritative model and dataset configuration
firebase/                       Firestore client security rules
firmware/stm32f401_sorter/      Bare-metal CMSIS firmware and PlatformIO config
hardware/kicad/                 KiCad schematic and two-layer PCB source
hardware/manufacturing/         PCB fabrication Gerbers and drill data

Hardware summary

FunctionImplementation
Edge controllerRaspberry Pi 4 Model B
CameraRaspberry Pi Camera Module V3
Real-time controllerSTM32F401CCU6 at 84 MHz
Position feedbackTwo E18-D80NK sensors on PA0 and PA1
Sorting gatesTwo MG996R servos on PA6/TIM3_CH1 and PA7/TIM3_CH2
Pi–MCU linkCP2102, USART2, 115200 baud, framed protocol
ConveyorJGB37-545 motor, continuous 12 V operation, manual speed control

Detailed power and bring-up guidance is in docs/hardware.md. Firmware pins, protocol and calibration values are in firmware/stm32f401_sorter/README.md.

Quick start

Raspberry Pi

bash
cd edge_ai/runtime
sudo apt install -y python3-picamera2 python3-opencv python3-venv
python3 -m venv --system-site-packages .venv
source .venv/bin/activate
pip install -r requirements-rpi.txt
cp .env.example .env
# Edit .env locally, then:
python main_stream.py

The Cloudinary, Firestore, UART and service setup is in edge_ai/runtime/README.md. Credentials are intentionally excluded.

STM32

bash
cd firmware/stm32f401_sorter
pio run
pio run --target upload

Flutter monitor

bash
cd apps/fruit_quality_monitor
flutter pub get
flutter run --dart-define=FIREBASE_API_KEY=... \
  --dart-define=FIREBASE_APP_ID=... \
  --dart-define=FIREBASE_MESSAGING_SENDER_ID=... \
  --dart-define=FIREBASE_PROJECT_ID=... \
  --dart-define=PI_BASE_URL=http://raspberrypi.local:5000

See apps/fruit_quality_monitor/README.md for Firebase setup and all build arguments.

Model configuration

  • Dataset: 1,105 images, five classes, object-level 80:20 split.
  • Architecture: MobileNetV2 with width multiplier 0.35 and 160 × 160 RGB input.
  • Training: transfer learning, 50 epochs, batch size 32, learning rate 0.001.
  • Deployment: Edge Impulse Linux .eim, INT8 quantization, 721.5 KB model and 416.1 KB reported peak RAM.

Images from one physical fruit are confined to one split, although several views of that fruit may exist within that split. The dataset itself is not included, so the deployed .eim is reproducible only from the original dataset and Edge Impulse project. edge_ai/training_config.json records the authoritative parameters without claiming that the binary can be regenerated from absent data.

Security

  • Keep .env, Cloudinary credentials and Firebase service-account JSON local to the Pi.
  • The Flutter app receives only Firebase client configuration and requires authenticated reads.
  • Firestore client writes are denied; the authenticated service account performs server-side writes.
  • Rotate any credential that was previously committed, pasted or shared. Removing it from current files does not revoke it or erase it from Git history.

Parts

21
QtyValueFootprintReferences
4100nFCapacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mmCf1, Cf2, Cf3, Cf4
3100uFCapacitor_THT:CP_Radial_D5.0mm_P2.50mmC1, C2, C3
210kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR1, R2
2Barrel_JackConnector_BarrelJack:BarrelJack_HorizontalJ1, J2
2E18-D80NKConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ5, J6
2MG996RConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ3, J4
11N4007Diode_THT:D_DO-41_SOD81_P10.16mm_HorizontalD1
1470uFCapacitor_THT:CP_Radial_D10.0mm_P5.00mmC4
1AMS1117-3.3Package_TO_SOT_SMD:SOT-223-3_TabPin2U3
1L7805Package_TO_SOT_THT:TO-220-3_VerticalU2
1STM32F401CCU6Kicad-STM32:YAAJ_WeAct_BlackPill_2U1
1UARTConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ7

Questions

How big is the Fruit sorter PCB?

It measures 105.5 × 119 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Fruit sorter use?

21 parts, built around the STM32F401CCU6, AMS1117-3.3 and L7805. 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 Fruit sorter KiCad files?

From the nmduc9624/fruit-quality-detection-and-sorting-system repository on GitHub, at the commit this page was made from: the board is hardware/kicad/fruit_sorter.kicad_pcb and its schematic hardware/kicad/fruit_sorter.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Fruit sorter design in my own project?

Its repository states no licence, so its author keeps all rights: ask nmduc9624 before reusing the design.

Similar boards

  • 2 layers57.2 × 57.2 mmFlight Computer, the printed circuit board in 3D

    Flight Computer

    explosion33/IREC

    SARP Payload DomeCracker Gyro 2024-2025

    89 parts1MIT
  • 2 layers60 × 52 mmRCS Hardware, the printed circuit board in 3D

    RCS Hardware

    explosion33/sarprcs

    2023-2024 SARP RCS Controls / Electronics repository

    56 parts1
  • 4 layers85 × 54 mmRf transceiver tool, the printed circuit board in 3D

    Rf transceiver tool

    jayis1/hacker-devices

    Full-cycle hardware designs for security research devices — each device is a subfolder with its own README, schematics, PCB layout, and software stack

    20 parts2
  • 2 layers57.2 × 57.2 mmARES FC, the printed circuit board in 3D

    ARES FC

    explosion33/ARES

    SARP Payload ARES 2024-2025

    67 parts1MIT
  • 2 layers57.2 × 57.2 mmRocketBeaconModule, the printed circuit board in 3D

    RocketBeaconModule

    explosion33/ArmLabRadio_PCB

    KiCad files for CC1200 based 2m / 70cm radio

    96 parts4
  • 4 layers34.8 × 34.8 mmPrism FC (PCB), the printed circuit board in 3D

    Prism FC (PCB)

    aryn-pathak/prism

    An open-source, affordable flight controller and drone

    47 parts1
  • 4 layers55.9 × 55.9 mmQUADCOPTER, the printed circuit board in 3D

    QUADCOPTER

    Riskerx/QUADCOPTER

    QuadCopter Rev B: STM32F401 four-layer flight-controller PCB, manufacturing files, hardware documentation and firmware integration plan.

    103 parts