Manual product inspection and sorting in small and medium-sized enterprises (SMEs) are often slow and error-prone, whereas conventional computer vision systems require expensive infrastructure. This study proposes a low-cost, real-time packaging inspection and sorting system utilizing YOLOv8 integrated with an ESP32 microcontroller. The proposed closed-loop architecture combines object detection, servo-based actuation, and dual data logging via LCD, Blynk IoT, and Google Sheets, alongside end-to-end latency characterization. The dataset used consists of 1,510 packaging images annotated into two classes: Good Product and Damaged Product. Five dataset-splitting scenarios were evaluated using the early stopping method, with performance assessed based on precision, recall, mAP50, and mAP50-95 metrics. The optimal configuration achieved 99.32% accuracy and an mAP50 of 97.6%, with zero false negatives across 292 test samples. The measured response time was approximately 0.51 seconds, providing a real-time margin of 1.40 seconds at a conveyor speed of 30 RPM. Physical sorting achieved success rates of 86% for Damaged Products and 96% for Good Products, while data logging achieved 100% transmission success. These findings demonstrate that the YOLOv8–ESP32–IoT integration is a viable solution for low-cost, real-time packaging inspection and sorting, although mechanical factors remain crucial and further validation at an industrial scale is required.