## 2 Materials and Methods
### Control Kinematics
#### 2.6.2 Electronic Communication System  
The electronic communication system of the 2 RRR manipulator comprises an ATMEGA2560 microcontroller (Arduino, Turin, Italy) and Dynamixel MX64 servomotors (Robotis, California, EEUU), interfaced through a Smile Robotics Dynamixel Shield. The system also includes a power supply, a voltage regulator, and a relay for the end effector. Figure 8 shows the software-hardware communication flow and illustrates the interaction between the virtual environment, the microcontroller, and the hardware components of the manipulator. The MATLAB environment generates trajectory and control commands, which were transferred to the Arduino MEGA 2560 microcontroller. This microcontroller is responsible for executing kinematic calculations, controlling motor movements, and managing system operations. Additionally, the Dynamixel motors provided real-time feedback on angular positions, which were sent back to MATLAB to determine the manipulator's final position using the kinematic model. The communication loop allows synchronized execution of trajectories with the physical prototype. The microcontroller utilizes a switch-case algorithm to decode and execute received instructions. To prevent trajectory execution from being interrupted by the reception of new parameters, the inverse kinematic data vectors were pre-stored in the microcontroller. During the development of the digital twin, trajectories were simulated in the virtual model to validate its ability to reach desired points without encountering singular configurations. The simulations considered the physical and electronic constraints of the actuators and control boards, resulting in a motion-position relationship engine. Displacement and angular velocity data obtained during simulations were exported in CSV format and transmitted to the HMI, which served as input for the microcontroller to execute the trajectory instructions. Figure 9 shows the configuration and operation diagram of the manipulator. The system was powered by a 12V power supply (1). The Arduino MEGA 2560 and Dynamixel Shield (2) managed the manipulator's movements by controlling the Dynamixel MX-64 motors (3). A relay module (4) activated and deactivated the DC-DC LM2596 Step-Down converter (5), which regulated the power supplied to the laser system (6) for trajectory tracing. This configuration enables real-time control of the laser and actuators through coordinated software and hardware interaction. The trajectory transmission and monitoring process, managed by Algorithm 1, ensures smooth execution of the manipulator's motion:  
```
1: Initialization: \(t_{0}\gets 0\), \(L_{1}\gets 0\)
2: while samples sent < vector size do
3:
4: variable \(t_{0}\)
5: Send movement instruction
6:
7: Take readings from the servomotors
8: Send data to the interface
9: Increment the sample sent counter by one
10: while \(L_{1}<:t_{0}\) + sampling time do:
11: Read the microcontroller's internal clock
12: and store in \(L_{1}\)
13: Wait for the sampling time
14: end while
15: end while
16:
17: end while
```  
**Algorithm 1**Trajectory transmission and monitoring  
The kinematic control architecture (Figure 10) integrated design and analysis tools to generate inverse kinematic solutions. This architecture enabled the calculation of joint coordinates required for the manipulator to follow trajectories defined in the virtual model. Figure 8: System block diagram of the electronic communication system. Arrows indicate the flow of control signals, power supply, and feedback data. The Arduino Mega 2560, combined with the Dynamixel Shield (Smile Robotics), sends commands to the actuators and receives sensor feedback. A relay and voltage regulator manages the power to the laser tool, controlled via the interface developed in MATLAB. The trajectory data were transmitted from the virtual model to the microcontroller, ensuring precise control and synchronization between the digital twin and the physical prototype.