

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
3STM32F401CCU6
UFQFPN-48(7x7)-40℃~+85℃ 1.7V~3.6V 12bit 256KB 32 Bit 36 64KB 84MHz ARM Cortex-M4 Built-in FLASH UFQFPN-48(7x7) Microcontrollers (MCU/MPU/SOC) ROHSSTMicroelectronicsMicrocontrollers (MCU/MPU/SOC)AMS1117-3.3
SOT-223-40℃~+125℃ 0.003%Vout 1 1.1V@(800mA) 15V 1A 3.3V 5mA 72dB@(120Hz) Fixed Over Current Protection、Short Circuit Protection、Thermal shutdown Positive SOT-223 Voltage Regulators - Linear, Low Drop Out (LDO) Regulators ROHSAdvanced Monolithic SystemsVoltage Regulators - Linear, Low Drop Out (LDO) RegulatorsL7805
TO-220ST0℃~+125℃@(Tj) 1 1.2A 20V 2V@(1A) 42uV 500uA 5V 73dB@(120Hz) Fixed Positive Short Circuit Protection TO-220ST Voltage Regulators - Linear, Low Drop Out (LDO) Regulators ROHSOSENVoltage Regulators - Linear, Low Drop Out (LDO) Regulators
README
README.mdReal-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
| Measurement | Result |
|---|---|
| Held-out image accuracy | 97.79% on 226 images |
| Weighted precision / recall / F1 | 0.98 / 0.98 / 0.98 |
| Raspberry Pi throughput | 13–20 FPS |
| Per-frame inference latency | 50–80 ms |
| Real-conveyor classification after voting | 960/1,000 = 96% |
| Complete physical sorting cycles | 246/250 = 98.4% |
| Cloud synchronization time | 1.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
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 dataHardware summary
| Function | Implementation |
|---|---|
| Edge controller | Raspberry Pi 4 Model B |
| Camera | Raspberry Pi Camera Module V3 |
| Real-time controller | STM32F401CCU6 at 84 MHz |
| Position feedback | Two E18-D80NK sensors on PA0 and PA1 |
| Sorting gates | Two MG996R servos on PA6/TIM3_CH1 and PA7/TIM3_CH2 |
| Pi–MCU link | CP2102, USART2, 115200 baud, framed protocol |
| Conveyor | JGB37-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
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.pyThe Cloudinary, Firestore, UART and service setup is in edge_ai/runtime/README.md. Credentials are intentionally excluded.
STM32
cd firmware/stm32f401_sorter
pio run
pio run --target uploadFlutter monitor
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:5000See 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| Qty | Value | Footprint | References |
|---|---|---|---|
| 4 | 100nF | Capacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mm | Cf1, Cf2, Cf3, Cf4 |
| 3 | 100uF | Capacitor_THT:CP_Radial_D5.0mm_P2.50mm | C1, C2, C3 |
| 2 | 10k | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal | R1, R2 |
| 2 | Barrel_Jack | Connector_BarrelJack:BarrelJack_Horizontal | J1, J2 |
| 2 | E18-D80NK | Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_Vertical | J5, J6 |
| 2 | MG996R | Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_Vertical | J3, J4 |
| 1 | 1N4007 | Diode_THT:D_DO-41_SOD81_P10.16mm_Horizontal | D1 |
| 1 | 470uF | Capacitor_THT:CP_Radial_D10.0mm_P5.00mm | C4 |
| 1 | AMS1117-3.3 | Package_TO_SOT_SMD:SOT-223-3_TabPin2 | U3 |
| 1 | L7805 | Package_TO_SOT_THT:TO-220-3_Vertical | U2 |
| 1 | STM32F401CCU6 | Kicad-STM32:YAAJ_WeAct_BlackPill_2 | U1 |
| 1 | UART | Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Vertical | J7 |
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 mm

- 2 layers60 × 52 mm

- 4 layers85 × 54 mm

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 mm

- 2 layers57.2 × 57.2 mm

- 4 layers34.8 × 34.8 mm

- 2 layers75.2 × 95.2 mm

- 4 layers55.9 × 55.9 mm

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