## 1 Introduction
### System Software  
The designed system software basically consists of an interface and embedded system software, which provides image processing, lighting and three-axis cartesian motion. A Debian-based Raspberry Pi OS (Raspbian) operating system is installed on the Raspberry Pi 4 mini-computer, which is used as a data collection and control unit in the system. The interface software is coded in Python programming language, and OpenCV library is used for image processing, object detection and coordinate determination [13; 38]. In order to process the G-Code instructions and position the three-axis robot in the system, an Arduino Uno micro-controller board--which works as a CNC controller and is loaded with GRBL firmware--is used [32; 33]. A screenshot of the developed software for the robotic platform is shown in Figure 5. Here, the (X, Y) coordinate information is placed on the image taken with the camera with a resolution of 1024 \(\times\) 768. The platform coordinates are determined as follows: Origin X\({}_{\mathrm{O}}\), Y\({}_{\mathrm{O}}\) (0, 0), top left \(-\)X, \(+\)Y (\(-\)200, \(+\)200), top right \(+\)X, \(+\)Y (\(+\)200, \(+\)200), bottom left \(-\)X, \(-\)Y (\(-\)200, \(-\)200) and lower right \(+\)X, \(-\)Y (\(+\)200, \(-\)200). The Park (Home) and Waste area coordinates are also available on the platform. As seen in Table 2, RGBY reference objects, whose actual centroid positions on the platform are known beforehand, are used to adjust the illuminance level. Depending on the color-based processing of the obtained image, the detected objects are expressed as follows: Robot (Yellow), Good (Green) and Bad (Red). In addition, the electromagnet placed on the robot head in order to be able to handle objects has the ability to move in the vertical axis (Z). Figure 5: Robotic platform and X-Y-Z coordinates. An interface software was developed to ensure that bad objects detected on the robotic platform are taken to the waste area. Figure 6 shows the flowchart for the operation of the interface software algorithm. In the developed algorithm, first, the required illuminance level is provided by creating controls for the RGBY reference objects, whose actual centroid positions on the robotic platform are known. For this process, the minimum illuminance level for image processing is adjusted by increasing the power of the LED strip lamp with the PWM signal. The control of lighting power is performed depending on the error between the actual centroid values of RGBY reference objects predefined in the software and the centroid values instantly detected and calculated based on image processing. With the correct finding of the reference centroids, robot and object detection is performed on the platform. When an object is found on the platform, the centroid is determined based on image processing, and the resulting G-Code instructions are sent to the CNC controller according to the working status. In this way, it is ensured that the robot moves to the centroid of the detected bad object. Within the scope of the handling process, the bad object is picked up with the help of an electromagnet and taken to the relevant place and left. If there is no bad object, the robot is allowed to go to the predetermined parking area and wait. Figure 7 shows the flowchart of object detection and position determination based on reference-color-based image processing. In the algorithm, first of all, color selection, hue-saturation-value (HSV) color space lower and upper limit values and minimum area size settings for object detection are performed [39; 40]. The HSV color space model lower and upper limit ranges for RGBY reference colors used in the designed system are shown in Table 3. After the initial settings, an image of the robotic platform is taken with the help of the camera connected to the system. Then, Gaussian blur filtering with the size of 11 \(\times\) 11 is applied to remove details and noise from the image.