In traditional pest monitoring, specimens are manually inspected, identified, and counted. These techniques can lead to poor data quality and hinder effective pest management decisions due to operational and economic limitations. This study aimed to develop an automatic detection and early warning system using the European Pepper Moth, Duponchelia fovealis (Lepidoptera: Crambidae), as a study model. A prototype water trap equipped with an infrared digital camera controlled using a microprocessor served as the attraction and capture device. Images captured by the system in the laboratory were processed to detect objects. Subsequently, these objects were labeled, and size and shape features were extracted. A machine learning model was then trained to identify the number of insects present in the trap. The model achieved 99% accuracy in identifying target insects during validation with 30% of the data. Finally, the prototype with the trained model was deployed in the field for result confirmation.