Journal of Electrical Engineering and Computer Sciences Vol. Issue 1. June 2024 P-ISSN: 2528-0260 E-ISSN: 2579-5392 OBJECT SORTING CONVEYOR WITH DETECTION COLOR USING ESP-32 CAMERA PYTHON BASED ON OPEN-CV INDAH SULISTIYOWATI. HAFIDZ MAULANA ICHSAN. IZZA ANSHORY Department of Electrical Engineering. Universitas Muhammadiyah Sidoarjo Jl. Mojopahit No. 666 B. Sidoarjo e-mail: indah_sulistiyowati@umsida. Corresponding author ABSTRACT The OpenCV Python library has been developed in all technology fields, including the industrial sector. In the industrial world, there are objects sorting tools in the form of conveyors. These instruments are presently more advanced since they employ cameras to read the things that should be sorted. The purpose of applying the Open Source Computer Vision Library (OpenCV) system to this objectAos sorter conveyor is to make it easier to sort objects based on color detection technology. The OpenCV method for object detection based on color was employed to select those objects. The first step in identifying the object in question is to capture RGB . ed, green, and blu. objects in real time and transform their colors into HSV. Additionally, by masking the object to be centered and applying a threshold, the morphological process can remove unnecessary noise from the image. The investigation results include the ability to differentiate objects based on RGB color when sorted by considering the HSV value on the surface of colored objects. Keywords: OpenCV. Python. Colors. Conveyor. ESP-32 INTRODUCTION The progress and use of Artificial Intelligence (AI) technology in the industrial world is growing significantly . As a result, they are gradually replacing traditional equipment and machines with modern versions that include automatic controls. Classification or selection of objects, especially in the industrial sector, can be grouped based on product type, color, weight, shape, etc. Sorting can be done manually by humans, with a barcode system, or automatically by machines. Sorting objects in the industry is generally done manually by humans, so object sorting is slower, less accurate, and less reliable. This is caused by human nature, which quickly gets tired. Therefore, a control tool is needed to sort objects that work automatically . , . Classification or selection of objects in the sorter system uses an ESP-32 camera to detect the color of the The Esp-32 camera is used to capture images of objects being sorted on the conveyor. Color is one of the elements that can be detected by the camera. Specifically, the colors captured are RGB (Red. Green. Blu. Systems for classifying objects by color can be developed in various ways. Research by Euis W. , et al. uses the TCS230 color sensor to detect color and classify objects using a PLC . rogrammable logic contro. as the driving system . The colors that can be detected are red, green, and blue. A classification tool was developed that can classify items as black, blue, green, red, and white by Ika Sari . In addition, the results of this research state that the color sensor detects the color of objects in a specified color range and activates certain actuators. Wicaksono. FR, et al. , researched object sorting using image processing, where the sorted objects are captured by the camera and then processed into OpenCV . The use of color sensors. PLC . rogrammable logic contro. methods, and image processing have been carried However, the system is considered less effective because it does not guarantee the quality of the objects being sorted after production, and there is no better sorting media . Based on the weaknesses in the previous system, an innovation was carried out by using an ESP-32 camera as a verification input to count or count the number of items or objects that had been sorted by color and a servo as a sorter which could also be observed using the Python software display using the number method and Open-CV. The advantages of this system can be monitored in real time . , . DOI: https://doi. org/10. 54732/jeecs. Available online at: https://ejournal. id/jeecs Journal of Electrical Engineering and Computer Sciences Vol. Issue 1. June 2024 P-ISSN: 2528-0260 E-ISSN: 2579-5392 Therefore, the author has designed a product sorting conveyor using two servo motors. This design provides an efficient sorter based on three different color codes, by using Arduino UNO R3 as a microcontroller to drive the conveyor and object sorter . The display of this tool uses an I2C 16x2 LCD because its use is simple and easy to understand. The working system of this tool starts with the objects that have passed production and will be sorted using this conveyor, the objects that have been sorted will pass through the ESP -32 camera, and directly the objects will be separated according to their color, the appearance of color detection can be observed using Python display software in real-time. Next, a container was designed to accommodate objects that had been sorted by color . , . The main aim of creating a color-based item sorting tool prototype is to simplify human work in automatically sorting three color codes and also counting the number of items that have been sorted . , . RESEARCH METHODOLOGY The main objective of this research is to create a prototype of a color-based item sorting tool that can help and simplify human work in automatically sorting three color codes and also counting the number of items that have been The method used in this research is image processing which utilizes the OpenCV library in Python. 1 The Workflow of Classification The steps in classifying colored objects using the proposed method can be explained as follows: The image data collected is objects that are red, green and blue. Converting an object or video image into the Lab color space to get a red, green, or blue color classification. The result of changing this value is an image or video feature to group images based on color which can be determined by the number of items. This work uses Python and Arduino IDE software. Classify the color of objects as red, green, or blue. This classification uses the OpenCV and HSV (Hue. Saturation. Valu. The Open Source Computer Vision Library (OpenCV) functions to process images and videos, allowing users to extract information from This HSV model requires RGB primary colors as the basis for color detection. H . is the color angle on the circular axis of the cone, with red as the 0A axis. V . is the color component on the vertical axis of the cone. And the value V = 0 is at the end of the black axis and the value V = 1 is at the end of the white axis. This V axis represents all types of gray colors. S . is the level of saturation that contains a lot of white light or color purity, and the value is the radian of the cone. The feature values used by the RGB box (Red. Green. Blu. are the upper and lower values to get the desired RGB color value. Perform image processing for conveyor sorting on colored objects and count the number of objects based on their color. The next step is to calculate the overall identification results to obtain testing accuracy by matching the identification results using the OpenCV method with the actual results. 2 Design of Device The conveyor design is adapted from the shape of a long beam, but the size is larger because it is intended for packages 1 meter long, 40 cm wide, and 30 cm high. An Esp-32 camera to capture images of objects to detect color and count objects that are running on a conveyor placed on a conveyor placed on a 40 cm high support. The Arduino Uno and I2C 16x2 LCD are placed on the right side of the conveyor in a protective box so that they are not easily damaged. Behind the conveyor, there are two dc motors on both sides to drive the conveyor. At the front, there are 2 servo motors with a distance of 30 cm apart left and right. The design of the packaging box is shown in Figure 1 and 2. Figure 1. Tool Design Available online at: https://ejournal. id/jeecs Journal of Electrical Engineering and Computer Sciences Vol. Issue 1. June 2024 P-ISSN: 2528-0260 E-ISSN: 2579-5392 Figure 2. Tools produced 3 Suite A block diagram of a system is useful for determining the basis for design. Block diagram of a conveyor sorter with Color Detection Using Esp-32 Camera Based on OpenCV Python is as presented in Figure 3. There are 3 parts to the conveyor Object Sorter with Detector Color Using Esp-32 Camera Based on OpenCV Python, namely: input, process, and output. In the input section there are module Esp-32 cameras as input for capturing object moving on the conveyor, as well as to identify color and count moving objects . In the process section, there is an Arduino UNO which is used to carry out the process of moving the dc motor, servo motor, and turning on the 16x2 I2C LCD . the output section, there is a DC motor to drive it conveyor, servo motor for sorting objects or objects. LCD I2C 16x2 to display the amount of sorted items based on color . In planning tool electronics, there are pictures of the toolmaking circuit . The Suite tool Conveyor Object Sorter with Detector Color Using OpenCV Python-Based Esp-32 Camera is presented in Figure 4. There is a component Arduino UNO module as a microcontroller. There is a project board that is used to connect the pins between components including Arduino Uno, push button, power supply, 16x2 i2c LCD, relay, and servo motor . Figure 3. Block diagram Available online at: https://ejournal. id/jeecs Journal of Electrical Engineering and Computer Sciences Vol. Issue 1. June 2024 P-ISSN: 2528-0260 E-ISSN: 2579-5392 Figure 4. Circuit Figure 5. Flow diagram Available online at: https://ejournal. id/jeecs Journal of Electrical Engineering and Computer Sciences Vol. Issue 1. June 2024 P-ISSN: 2528-0260 E-ISSN: 2579-5392 4 Device Design Soft Planning device soft is planning program flow to be created. The Planning device soft shown in the program flow diagram. The program begins with initialization ( giving initial value ) at input/output, then by pressing the ON button the conveyor will active Then object colored in, and then connect to internet network, esp-32 cam is connected to the internet network, if connected esp-32 cam will detect object colored red, green, or blue. If detected object is detected red by the esp-32 cam then the LCD will display the words Aured:1Ay and servo motor 1 will move 45^o so object is colored red the fall to receptacle First. Likewise objects colored green will detected by cam esp-32 then LCD will displays the words Augreen:1Ay and servo motor 2 will moving 45^o making objects colored green the fall to receptacle Lastly, if There is an object colored blue detected by the esp-32 cam, then the LCD will it will say Aublue:1Ay and it will immediately fall to receptacle third. The Conveyor Program flowchart Sorting Objects with Detection Color Using ESP-32 Camera Based on OpenCV Python is presented in Figure 5. RESULTS AND DISCUSSIONS Test procedure carried out on each component and system to ensure the machine runs as designed. Testing is carried out on each part as follow. 1 Testing the ESP-32 Camera Testing the ESP-32 Camera as RGB color reading in presented in Figure 6. From Figure 6 . , . , and . , the accuracy results for reading each RGB color from a distance of 12 cm are obtained, as explained in the Table 1. The display in the Python software shows that the ESP32 Cam is very vulnerable to reading light so noise often occurs when reading 2 Experiment calculation sorted objects This test is carried out to calculate the items to be sorted. The results of calculating the sorted items show accuracy in capturing the suitability of each 10 objects according to RGB colors, which is explained in Figure 7. From experiments to determine the accuracy of the ESP32 Cam in calculating each RGB color, it was found that according to Figure 8 above, red has 80% accuracy, green has 100% accuracy, and blue has 80% accuracy. Color Red (R) Color Green (G) Figure 6. Color detection Color Blue (B) Table 1: RGB Color Chart RGB Color Reading Results Colour Green Blue HSV value H (Hu. Lower: 136 Upper: 180 Lower: 25 Upper: 102 Lower: 94 Upper: 120 S (Saturatio. Lower: 87 Upper: 255 Lower: 52 Upper: 255 Lower: 80 Upper: 255 V (Valu. Lower: 111 Upper: 255 Lower: 72 Upper: 255 Lower: 2 Upper: 255 Distance . 12 cm Accuracy (%) 12 cm 12 cm Available online at: https://ejournal. id/jeecs Journal of Electrical Engineering and Computer Sciences Vol. Issue 1. June 2024 P-ISSN: 2528-0260 E-ISSN: 2579-5392 Red Green Blue Figure 7. Counting the number of colored objects Table 2. Accuracy testing and detection for sorting objects against the objects to be sorted Colour Accuracy (%) 10 times Green 10 times Blue 10 times 3 Testing Accuracy Sorting and Detection Sorting Sorted Objects This test is used to measure the accuracy of sorting the objects to be sorted. The object sorting results show the accuracy of the items sorted every 10 times, explained in Table 2. From experiments to determine the accuracy of servo motors in sorting RGB color objects which were carried out 10 times, it was found that based on table 2 above, red has an accuracy of 80%, green has 100% accuracy, and blue color has 80%. The calculation results of the sorted objects show precise accuracy, according to the desired color. CONCLUSION Based on the results of the tests carried out in this research, several conclusions can be obtained that image processing using the OpenCV method on the ESP-32 Camera can run well, with 3 color categories, namely: red, green, and blue. The Python program that has been created can function properly and can work as designed. With the OpenCV method for reading these 3 colors, you can easily separate red, green, and blue objects. There is a drawback to the ESP32 Cam in that it is very susceptible to light, causing interference during the reading process. The ESP32 Cam also has a weakness for hot temperatures on the device which will cause delays in the reading process. In subsequent research, a camera was added to make recognition more precise and the enumeration pattern was improved to minimize the influence of shadows that interfere with the image recognition process. It is necessary to control the speed of the conveyor motor, so that object selection can be better. REFERENCES