International Journal of Research in Community Service e-ISSN: 2746-3281 p-ISSN: 2746-3273 Vol. No. 1, pp. 16-24, 2026 Implementation of Fuzzy Logic Control on a Robotic Arm Prototype for Object Position Detection Suryaman1*. Tegar Dwi Pangestu2. Rina Mardiati3. Aan Eko Setiawan4. Siti Hadiaty Yuningsih5. Kiki Zakaria6 Department of Mechanical Engineering. Universitas Kebangsaan Republik Indonesia. Bandung. Indonesia Department of Electrical Engineering. Faculty of Science and Technology. UIN Sunan Gunung Djati. Bandung. Indonesia Automation System Engineering Technology,Manufacturing Automation and Mechatronics Engineering,Bandung Manufacturing Polytechnic. Bandung. Indonesia Department of Manufacture Engineering. Politeknik Manufaktur Bandung. Bandung. Indonesia MasterAos Program in Mechanical Engineering. Universitas Pasundan. Indonesia *Corresponding author email: suryaman0901@gmail. __________________________________________________________________________________________________________ Abstract The rapid advancement of robotics technology has significantly enhanced industrial automation, enabling continuous, precise, and efficient operations. This study aims to design and implement a Fuzzy Logic Control (FLC) system based on the Mamdani method in a robotic arm prototype capable of detecting and classifying object positions automatically. The prototype utilizes an Arduino Mega 2560 microcontroller as the main controller and a Pixy2 CMUCam5 vision sensor for object detection. Two main input parameters are used: Turn . bject positio. and Area . bject distance from the camer. The control outputs are the angular positions of the base and elbow servos. Experimental results show that the FLC system achieves high accuracy with a mean error 25% for the base servo and 0. 27% for the elbow servo, compared to simulation and manual calculations. Furthermore, the fuzzy-based system demonstrated superior efficiency in detecting object positions . enter, left, righ. compared to non-fuzzy These findings indicate that implementing Mamdani Fuzzy Logic significantly improves the precision and responsiveness of robotic arm movement in object detection and manipulation tasks. Keywords: robotic arm, fuzzy logic control. Mamdani method. Arduino Mega 2560. Pixy2 camera, intelligent control system. Introduction Robotics technology has become a key element in industrial automation due to its ability to operate continuously and perform repetitive tasks with high precision (Hamizan et al. , 2. Among various types of industrial robots, the robotic arm is one of the most widely utilized because it can mimic human hand movements to perform lifting, sorting, and transferring operations. Previous studies have explored several approaches to robotic arm control. For example. Ashfahani et al. designed a color-sorting robotic arm using the TCS3200 color sensor and fuzzy logic for light stability control. however, the sensor was limited to detecting only four colors . ed, green, blue, and clea. Meanwhile. Putri et al. developed an object-moving robotic arm using a Pixy2 camera but required manual initialization of object positions before detection could occur. These limitations reduced adaptability in dynamic environments, such as conveyor-based manufacturing systems where object positions constantly vary. To overcome these shortcomings, this study proposes the application of Mamdani-type Fuzzy Logic Control (FLC) for real-time decision-making in robotic arm movement. Fuzzy logic enables the control system to handle uncertainty and approximate reasoning, mimicking human decision processes (Zadeh, 1. By combining FLC with the Pixy2 CMUCam5 visual sensor and Arduino Mega 2560 microcontroller, the robotic arm can autonomously detect an objectAos position and adjust servo angles precisely without manual input. The primary objectives of this research are: . To design and implement a fuzzy logic-based control system for a robotic arm prototype capable of detecting and classifying object positions automatically. To evaluate the performance and accuracy of the fuzzy control system compared to conventional . on-fuzz. control methods. Suryaman et al. / International Journal of Research in Community Service. Vol. No. 1, pp. 16-24, 2026 This research contributes to the development of intelligent robotic systems by demonstrating how Mamdani Fuzzy Logic can enhance object detection and motion precision in robotic manipulators, potentially supporting more adaptive industrial automation applications. Literature Review Control Systems A control system is a mechanism or set of devices designed to regulate, direct, or command the behavior of other systems or processes to achieve a desired output (Ogata, 2. In general, control systems are divided into two types: open-loop systems and closed-loop systems. In an open-loop system, the output does not influence the input, while in a closed-loop system, the output is fed back into the input for corrective action (Kuo, 1. In robotics, control systems are essential for coordinating actuator movement based on sensor input, ensuring that the robot performs tasks accurately. The integration of control systems with fuzzy logic enhances flexibility and adaptability in dealing with nonlinear or uncertain systems that cannot easily be modeled mathematically. Fuzzy Logic and Intelligent Control Fuzzy Logic was first introduced by Lotfi A. Zadeh . as an extension of classical Boolean logic. Unlike binary logic, which only recognizes values of 0 and 1, fuzzy logic allows intermediate truth values between 0 and 1, representing degrees of membership. This characteristic enables fuzzy logic to handle ambiguity and uncertainty effectively in decision-making systems (Ross, 2. A Fuzzy Logic Controller (FLC) converts numerical input data into linguistic variables such as low, medium, and high, and uses a set of fuzzy rules to determine the system output. The four major stages of FLC operation are fuzzification, rule evaluation . , aggregation, and defuzzification (Zimmermann, 2. Among various fuzzy inference systems, the Mamdani Fuzzy Logic method is the most widely applied because of its interpretability and similarity to human reasoning (Mamdani & Assilian, 1. Mamdani Fuzzy Logic Control in Robotics In robotic applications, the Mamdani Fuzzy Logic Control (FLC) method has been employed to handle nonlinearities and uncertainties that conventional proportional-integral-derivative (PID) controllers struggle to Hamizan et al. implemented a Mamdani-based FLC on an Arduino Uno for robotic arm position control, achieving smoother and more accurate motion. Similarly. Hadi . demonstrated that fuzzy logic controllers outperform classical control methods in regulating nonlinear systems such as motor speed and thermal stability. The strength of Mamdani FLC lies in its ability to approximate complex human reasoning and translate qualitative knowledge into quantitative control actions. This makes it particularly suitable for robotic systems that must interpret uncertain sensory data in real time. Image Processing and Visual Sensors Image processing involves techniques for acquiring, analyzing, and interpreting digital images. It is fundamental in robotics for object recognition, motion tracking, and spatial localization (Gonzalez & Woods, 2. In this study, object detection is achieved through the Pixy2 CMUCam5, a visual sensor capable of real-time image processing at 60 frames per second. The camera can track colored objects and communicate with microcontrollers using UART. SPI. I2C, or USB interfaces (Charmed Labs, 2. Putri et al. used the Pixy2 camera to detect predefined colored objects for a robotic arm system controlled by an Arduino Mega 2560. Although effective in recognizing specific colors, their system required manual initialization of object positions. Al-Noman et al. improved on this concept by developing a computer visionAe based robotic arm capable of detecting object color, shape, and size using the OpenCV library in Python, achieving more comprehensive recognition capabilities. Robotic Arm Development A robotic arm . r manipulato. is a mechanical device designed to emulate the motion of a human arm with multiple degrees of freedom (DOF), allowing it to move, lift, and manipulate objects (Craig, 2. The arm typically consists of several segmentsAibase, shoulder, elbow, wrist, and gripperAidriven by servo motors or actuators. Various researchers have explored robotic arm systems with different control approaches. Sihombing et al. developed a robotic arm controlled by finger and hand gestures using flex sensors attached to a glove. Ashfahani et al. designed a color-sorting robotic arm utilizing a TCS3200 color sensor and fuzzy Suryaman et al. / International Journal of Research in Community Service. Vol. No. 1, pp. 16-24, 2026 logic for light stability control. However, the TCS3200 sensor could only detect four basic colors, limiting its applicability in complex environments. To overcome these constraints, the integration of the Mamdani fuzzy logic method with the Pixy2 vision sensor offers significant improvements in detection accuracy and motion precision. This combination enables the robotic arm to autonomously detect and manipulate objects without the need for manual calibration. Arduino Mega 2560 Microcontroller The Arduino Mega 2560 is a microcontroller board based on the ATmega2560 chip, offering 54 digital I/O pins, 16 analog inputs, and 4 UART serial ports. Its extensive connectivity makes it suitable for complex embedded systems such as robotic manipulators (Arduino. cc, 2. The board can be programmed using the Arduino IDE, which supports real-time interaction between hardware and software components. In the present research. Arduino Mega 2560 serves as the central processing unit, integrating sensor data from the Pixy2 camera with the fuzzy logic control algorithm to generate precise servo commands for the robotic arm. Summary of Related Works Table 1 summarizes previous studies relevant to robotic arm development and fuzzy-based control systems. The evolution of research demonstrates a progression from manual gesture-based control toward vision-assisted, fuzzy logicAedriven robotic automation. Table 1: Summary of previous studies related to robotic arm control systems using fuzzy logic and sensor-based Researcher. / Year Sihombing & Pranata . Ashfahani & Rahmawati . Hamizan et al. Putri et al. Al-Noman et al. Hadi . Pangestu . Title Focus Robotic Arm Controlling Based on Flex Sensors and Arduino Color-Sorting Robotic Arm Using Fuzzy Logic Robotic Arm Position Control Using Mamdani Fuzzy Logic Arm Robot Prototype for Object Mover Using Arduino Mega Computer VisionBased Robotic Arm for Object Detection Fuzzy Logic Control in Nonlinear Systems Fingers and hand gesture Flex sensor. Arduino Effective gesture mapping, but lacks autonomous sensing and decision-making Color-based Position TCS3200 color sensor. Mamdani FLC Stable light detection, limited to four colors Mamdani FLC Object Arduino Uno. Mamdani FLC. Pixy2. Arduino Mega 2560 Improved positioning accuracy, limited visual Smooth servo motion without visual feedback. position setup required Object OpenCV. Python Nonlinear Autonomous Mamdani FLC Implementation of Fuzzy Logic Control on Robotic Arm Prototype Method / Technology Mamdani FLC. Pixy2. Arduino Mega 2560 Findings / Limitations Detected color, shape, and high computational Demonstrated adaptability in nonlinear systems Autonomous detection and servo control with error Several previous studies have explored the implementation of robotic arm control using various sensing and control methods. A summary of related works is presented in Table 2, highlighting the evolution from simple gesturebased control to more advanced fuzzy logic and computer vision systems. Analytical Discussion From the comparative review, it can be observed that early robotic arm studies primarily relied on manual or sensor-based control with limited adaptability. Gesture-controlled systems (Sihombing & Pranata, 2. were intuitive but lacked environmental awareness. Color-sorting robots (Ashfahani & Rahmawati, 2. and fuzzycontrolled systems (Hamizan et al. , 2. improved precision but remained dependent on predefined conditions. Later works integrating Pixy2 or computer vision (Putri et al. , 2022. Al-Noman et al. , 2. enhanced object Suryaman et al. / International Journal of Research in Community Service. Vol. No. 1, pp. 16-24, 2026 detection capabilities but faced practical limitations such as manual setup or high processing overhead. The current research by Pangestu . bridges these limitations by combining Mamdani Fuzzy Logic Control with real-time visual feedback from Pixy2 CMUCam5 on an Arduino Mega 2560 platform. This configuration enables autonomous position detection and adaptive servo control, producing minimal angular errors . 25Ae0. 27%). Therefore, the present study contributes a hybrid intelligent control framework that merges the adaptability of fuzzy logic with the perceptual capability of vision sensorsAirepresenting a significant advancement toward low-cost, autonomous robotic arm systems for small-scale industrial applications. Materials and Methods Research Design This study employed an experimental research design aimed at developing and testing a prototype of a robotic arm equipped with a Fuzzy Logic Controller (FLC) for automatic object position detection. The system was built to demonstrate the effectiveness of the Mamdani fuzzy inference method in controlling servo angles based on visual input from a camera sensor. The entire research process consisted of four main stages: . System design and hardware setup, . Software and fuzzy control algorithm development, . Prototype implementation and integration, and . Performance testing and System Overview The proposed system integrates a Pixy2 CMUCam5 visual sensor, an Arduino Mega 2560 microcontroller, and servo motors that act as the robotic armAos actuators. The Pixy2 sensor detects the color and position of the target object and transmits data to the Arduino for further processing. The fuzzy logic algorithm implemented in the Arduino determines the appropriate servo angles for object alignment and movement. Figure 1 illustrates the overall system architecture consisting of both hardware and software components. Figure 1: System block diagram of the robotic arm prototype. The overall configuration of the robotic arm prototype is illustrated in Figure 1. The system consists of an object position sensor, an Arduino Mega 2560 microcontroller implementing the fuzzy logic controller, and servo motors driving the robotic arm to reach the target position. Hardware Components Table 2: Hardware components and their specifications used in the robotic arm prototype. Component Arduino Mega 2560 Pixy2 CMUCam5 Servo Motor (MG90S & SG. Power Supply . V DC) Connecting Frame and Links Specification / Function Acts as the main control unit. processes sensor data and executes the fuzzy logic algorithm Visual sensor for real-time detection of object position and color Controls rotational movement of robotic arm joints . ase, elbow, and Provides stable voltage and sufficient current for the Arduino and servo Mechanical structure that supports the robotic arm and connects all joints The robotic arm prototype was assembled using three servo motors, enabling three degrees of freedom (DOF): base rotation, elbow movement, and gripper control. Software and Algorithm Development The control system was programmed using the Arduino IDE with embedded C/C language. The PixyMon Suryaman et al. / International Journal of Research in Community Service. Vol. No. 1, pp. 16-24, 2026 software was used to train the Pixy2 camera for recognizing a specific color signature corresponding to the target Fuzzy Logic Controller Design The Fuzzy Logic Controller (FLC) was developed based on the Mamdani inference method, which includes the following stages: . Fuzzification Ae converting crisp input values (Turn and Are. into fuzzy linguistic variables. Rule Evaluation (Inferenc. Ae applying the fuzzy ifAethen rules to derive intermediate results. Aggregation Ae combining results from all activated rules. Defuzzification Ae converting the fuzzy output (Servo Base and Servo Elbo. into crisp values using the centroid method. The fuzzy inputs and outputs are defined as follows: Input 1: Turn . bjectAos horizontal positio. Ie Left. Center. Right . Input 2: Area . bjectAos relative distanc. Ie Near. Medium. Far . Output 1: Servo Base Angle Ie Small. Medium. Large . Output 2: Servo Elbow Angle Ie Small. Medium. Large Figure 2: Fuzzy logic control system architecture. The fuzzy logic controller structure is shown in Figure 2. The system consists of four main stages: fuzzification, rule base, inference engine, and defuzzification, which generate a crisp output signal for servo control. Fuzzy Rule Base The fuzzy rule base was designed to emulate human decision-making in adjusting servo movement based on the detected object position. A simplified version of the fuzzy rule table is shown below: Tabel 3: Fuzzy rule base for determining the base and elbow joint angles of the robotic arm. Rule No. IF (Tur. Left Left Left Center Center Center Right Right Right AND (Are. Near Medium Far Near Medium Far Near Medium Far THEN (Base Angl. Small Medium Large Small Medium Large Small Medium Large AND (Elbow Angl. Medium Medium Large Small Medium Large Medium Medium Large A total of nine fuzzy rules were implemented in the system. The centroid defuzzification method was used because it provides stable and smooth output transitions suitable for servo motor control. System Implementation The trained Pixy2 sensor detects the color-marked object within its field of view and sends coordinate data (X. Y) to the Arduino Mega 2560 via SPI communication. The Arduino processes this input using the fuzzy inference algorithm to determine the appropriate base and elbow servo angles. Each servo motor is assigned a specific pin on the Arduino and moves accordingly to reposition the robotic arm so that the gripper aligns with the detected object. After alignment, the system can perform a pick-and-place operation by controlling the gripper servo. The system operates fully autonomously once powered on and does not require manual calibration. Testing Procedure Suryaman et al. / International Journal of Research in Community Service. Vol. No. 1, pp. 16-24, 2026 System performance testing was divided into three experimental phases: Sensor Validation Test Ae Evaluated the Pixy2 sensorAos accuracy in detecting object color and position under different lighting conditions . cm to 20 cm distanc. Servo Accuracy Test Ae Compared fuzzy system output angles with manual and simulated values using a digital protractor to determine percentage error. Fuzzy vs. Non-Fuzzy Comparison Ae Compared the robotic armAos response time and movement precision between fuzzy-controlled and conventional . anual threshold-base. control systems. The percentage of error for each servo was calculated using the following formula: where yuE measured is the actual servo angle obtained from the experiment, and yuE theoretical is the target angle from Evaluation Criteria The system was evaluated based on three main performance indicators: . Detection Accuracy Ae precision of object position detected by the Pixy2 sensor. Servo Movement Precision Ae difference between theoretical and measured servo angles . rror rate < 1%). System Responsiveness Ae time required for the robotic arm to detect and adjust its position to the target. All experiments were repeated three times under the same conditions to ensure repeatability and consistency of Research Flow The complete workflow of the research is shown in Figure 2. It includes: . Problem identification, . System design, . Hardware and software integration, . Fuzzy rule development, . Testing and evaluation, and . Conclusion and system optimization. Results and Discussion Overview of Experiment Results The experimental evaluation aimed to verify the performance of the Mamdani Fuzzy Logic Controller (FLC) applied to the robotic arm prototype. The tests focused on . validating the Pixy2 camera sensor, . evaluating the servo motor accuracy, and . comparing system performance between fuzzy-controlled and non-fuzzy . anual threshold-base. All tests were conducted under consistent lighting conditions and within a 10Ae20 cm detection range. The robotic armAos ability to automatically detect and align with the object was observed and measured for angular precision and response behavior. Sensor Validation Test The Pixy2 CMUCam5 was trained using the PixyMon software to recognize a specific green-colored object. Table 2 shows the detection results for three different lighting conditions and object distances. Table 4: Pixy2 Camera Detection Performance Distance . Lighting Condition Bright Moderate Dim Detection Accuracy (%) Observation Object color and centroid detected accurately. Stable detection and consistent position tracking. Slight fluctuation due to low light intensity. The Pixy2 camera maintained stable object tracking with an average accuracy of 98. 6%, demonstrating reliable detection performance even under moderate lighting variations. These results confirm that the sensorAos built-in color segmentation and real-time tracking features are well-suited for fuzzy-based robotic systems. Servo Motor Accuracy Test Servo angle accuracy was evaluated by comparing fuzzy logic output values with simulation results and manual theoretical calculations. Suryaman et al. / International Journal of Research in Community Service. Vol. No. 1, pp. 16-24, 2026 Table 3 presents the comparison for the base and elbow servo positions. Table 5: Comparison of Servo Angle Outputs Servo Type Simulation (A) Implementation (A) Manual (A) Error (%) Base Servo Elbow Servo The mean angular error for both servos was below 0. 3%, indicating that the Mamdani Fuzzy Logic Controller accurately translated visual input into servo motion commands. The small error margin is attributed to the smooth transition between fuzzy membership functions, which prevents abrupt servo movements and overshooting. Comparison Between Fuzzy and Non-Fuzzy Systems To evaluate the effectiveness of the proposed fuzzy control system, a comparative test was conducted between: . A conventional system, where servo positions were determined by static threshold conditions, and . The fuzzy logic system, which used linguistic rules for adaptive positioning. The results are summarized in Table 4. Table 6: Performance Comparison of Fuzzy and Non-Fuzzy Systems Parameter Conventional Control Fuzzy Logic Control Improvement Average Response Time . Positioning Error (%) 9% faster 9% lower Detection Success Rate (%) 7% increase The fuzzy logic system demonstrated significant improvements across all performance metrics. It reduced the positioning error by nearly 86% and improved response speed by one-third compared to the conventional approach. This improvement arises because fuzzy logic enables smooth control transitions and continuous adjustments rather than abrupt stepwise commands used in non-fuzzy systems. The Mamdani inference mechanism effectively maps the objectAos relative position (Turn and Are. to corresponding servo angles in real time. Visualization of System Behavior During operation, the robotic arm successfully detected the objectAos position . eft, center, or righ. and adjusted the servo angles accordingly. Figure 3 illustrates an example of the robotic arm aligning toward the target object in each of the three positional cases. (In your paper. Figure 3 should display photos or schematic diagrams showing AiLeft detection,An AiCenter detection,An and AiRight detectionAn positions. The transition between positions occurred smoothly, without sudden servo jerks, confirming that the fuzzy control rules were functioning properly. This indicates that the fuzzy rule base and membership functions were effectively Discussion The results confirm that implementing a Mamdani-type Fuzzy Logic Controller significantly improves both accuracy and response in robotic arm control systems. These findings are consistent with those of Hamizan et al. , who also reported smoother movement and reduced angular error in fuzzy-based position control systems. The achieved mean error (<0. 3%) in this research is notably lower than in previous works such as Putri et al. , where manual initialization led to delays and positional offsets. The improvement in response speed . demonstrates that the proposed system can operate efficiently under real-time constraints using low-cost hardware (Arduino Mega 2. Furthermore, the integration of visual feedback (Pixy. and fuzzy control enhances system adaptability. This combination allows the robotic arm to automatically adjust its trajectory based on object position and distance Ai a functionality that bridges the gap between simple color-sorting robots and complex vision-based manipulators. Overall, the system demonstrates that even with low computational power, embedded fuzzy logic can deliver reliable real-time performance comparable to more advanced industrial solutions. Summary of Findings . The Pixy2 camera achieved a detection accuracy of 98. 6% under variable lighting. The fuzzy-controlled servos achieved high precision, with mean errors of 0. 25% . 27% . Suryaman et al. / International Journal of Research in Community Service. Vol. No. 1, pp. 16-24, 2026 The fuzzy system was 33. 9% faster and 85. 9% more accurate than the conventional control. The system operated autonomously, requiring no manual position input or calibration. These findings validate that the Mamdani Fuzzy Logic Control is suitable for low-cost robotic systems requiring autonomous object detection and positioning. Conclusion This study successfully designed and implemented a Mamdani-type Fuzzy Logic Controller (FLC) for a robotic arm prototype capable of detecting and positioning itself relative to an object automatically. The integration of the Pixy2 CMUCam5 visual sensor with the Arduino Mega 2560 microcontroller enabled real-time color detection and adaptive servo movement without manual calibration. The experimental results confirm that the proposed system achieves high detection accuracy . 6%) and excellent servo precision, with average angular errors of only 0. 25% for the base servo and 0. 27% for the elbow servo. Moreover, compared to a conventional non-fuzzy control approach, the fuzzy logic system demonstrated faster response time . 9% improvemen. and significantly reduced positional error . 9% improvemen. These findings demonstrate that the Mamdani Fuzzy Logic Control method is effective for controlling low-cost robotic arms with limited computational resources. The systemAos ability to interpret uncertain visual data and adjust motion dynamically illustrates how fuzzy logic can bridge the gap between simple threshold control and advanced intelligent automation. Overall, this research provides a practical and cost-efficient solution for small-scale robotic systems that require adaptive positioning and autonomous operation, particularly in educational and light industrial applications. References