An ESP32 running two separate ML models grades tomatoes by color on a conveyor belt. Builder pmalfa31 published the full code on GitHub, targeting both standard and cherry tomato variants with distinct learned datasets selected at runtime.

The pipeline strips empty belt frames from optical sensor data, computes color statistics, and clusters readings per fruit. A size-based heuristic catches obvious misclassifications: if a fruit reads too large for a cherry tomato or too small for a standard one, the system flags it. It reduces errors, not eliminates them. The stack footprint is large enough that the program must explicitly request an oversized stack, a constraint worth understanding before porting to other targets.

A Wokwi web simulator is live at project ID 471166580602582017, requiring zero hardware to test. The architectural decision to separate model weights by tomato type, rather than train a single generalized classifier, is the detail that makes the full project worth reading.

[READ ORIGINAL →]