TABLE OF CONTENTS
Introduction
Methodology
Goals
Future Scope
The tomato ripeness detection system addresses a critical need in precision agriculture by enabling accurate, real-time classification of tomato maturity stages using embedded machine learning. Ripeness directly affects tomato quality, market value, nutritional content, and post-harvest shelf life. Traditional visual inspection methods are labor-intensive, subjective, and inconsistent, often leading to harvesting inefficiencies and increased losses.
To overcome these limitations, this project presents a low-cost, offline, and automated ripeness detection system using the ESP32-CAM microcontroller and a lightweight convolutional neural network. The system classifies tomatoes into three ripeness stages: unripe (green), semi-ripe (yellow), and ripe (red). By deploying a quantized MobileNetV2 model directly on the microcontroller, the system performs real-time inference without relying on cloud connectivity. This makes it particularly suitable for rural and resource-constrained agricultural environments where internet access is limited or unreliable.
The proposed solution demonstrates how edge AI can democratize advanced agricultural automation by offering an affordable, portable, and efficient alternative to expensive GPU-based systems, thereby supporting sustainable and smart farming practices.
The primary problem addressed is the lack of affordable and accessible automation for tomato ripeness assessment, especially for small and medium-scale farmers. Manual inspection is time-consuming, prone to human error, and inconsistent across inspectors. Existing AI-based solutions often depend on cloud infrastructure, high computational resources, and stable internet connectivity, making them impractical for on-field deployment in rural regions.
The system follows a three-layer edge computing architecture optimized for offline operation:
Microcontroller and Imaging Hardware:
An ESP32-CAM module equipped with an OV2640 camera is used for image acquisition and on-device processing.
Processing and Decision Layer:
A MobileNetV2-based convolutional neural network is deployed using TensorFlow Lite Micro to perform real-time classification.
Output and Feedback Components:
A 0.96-inch I2C OLED display presents the ripeness class and confidence score. An optional buzzer provides audible alerts.
This architecture ensures low latency, minimal power consumption, and full independence from external networks.
Initialization:
Upon power-up, the ESP32-CAM initializes the camera module, OLED display, and embedded machine learning model.
Image Preprocessing:
Captured images are resized, normalized, and converted to grayscale to reduce computational overhead.
Inference and Classification:
The optimized TensorFlow Lite model classifies the image into green, yellow, or red ripeness stages.
Output Display:
Classification results and confidence values are displayed in real time, and the process repeats continuously.
Dataset Preparation:
Approximately 2,500 labeled tomato images were collected under varying lighting and background conditions. Data augmentation techniques such as rotation and scaling were applied.
Model Selection:
MobileNetV2 was selected due to its depthwise separable convolutions, which significantly reduce computational cost.
Edge Optimization:
Post-training INT8 quantization reduced the model size from 3.5 MB to approximately 500 KB, enabling deployment on ESP32 memory while achieving a fourfold inference speed improvement.
The system was validated under real-world conditions. Performance evaluation demonstrated reliable classification accuracy of approximately 92%, robustness to lighting variation, and consistent real-time operation without network dependency.
Develop a low-cost and portable tomato ripeness detection system suitable for field deployment
Enable real-time, offline classification using embedded machine learning
Reduce human error and labor dependency in ripeness assessment
Provide a scalable edge AI solution for small and medium-scale farmers
Demonstrate efficient deployment of deep learning models on resource-constrained microcontrollers
Expansion of the training dataset to improve classification accuracy and generalization
Extension of the system to detect ripeness in other fruits and vegetables
Integration with mobile or cloud platforms for data logging and analytics
Deployment of automated sorting or harvesting mechanisms based on ripeness output
Incorporation of additional sensors for enhanced environmental awareness and decision-making