# A Prototype Mechatronic Device for Upper Limb Rehabilitation and Analysis of Its Functionality
## 4 Device Functionality
### System Setup and Initialisation  
The verification of mechanical and software functionality was conducted following a structured sequential operation tree, as illustrated in Figure 17. This structure encompasses all verification stages, including feedback pathways between system components. The final version of the source code--integrating mechanical elements, sensors, and control algorithms--was uploaded to the device's non-volatile memory to ensure the persistence of operation settings and calibration data. The completed device required the proper calibration and identification of sensor states, along with corresponding correct responses (Figure 18). This process involved testing the integrity of all electrical connections, verifying the detection of objects in designated storage compartments, and confirming that appropriate responses--such as LED activation or display updates--were correctly triggered. Verified sensor states and response behaviours were stored in the system's persistent memory to support its stable and repeatable operation during future sessions. The software controlling the rehabilitation device was developed in Python 3.11.4 using Visual Studio Code ([[https://code.visualstudio.com/](https://code.visualstudio.com/)]([https://code.visualstudio.com/](https://code.visualstudio.com/))). Upon the system's startup, a home screen interface appears (Figure 19a), offering several select  
Figure 17: Software and hardware testing environment. Figure 18: Calibration system of the upper limb rehabilitation device. exercises, device reset to initial position, device information. Users may access an information window (Figure 19b), which provides a brief system description and details about the implemented project framework. The recommended first step in the system's use is accessing the appraisements tab (Figure 20a). This tab guides the user through a standardised assessment procedure, consisting of three rounds focused on configuring the device and evaluating basic motor responses. During this step, the user is instructed to press all the control buttons (component No. 10, Figure 1) as quickly as possible. If the individual is unable to complete the task, the therapist may terminate the assessment prematurely using the stop button. The assessment records both the accuracy and timing of button presses, which serve as initial indicators of the user's functional motor capacity. The results are automatically compiled and presented in a report format (Figure 20b). By analysing the time elapsed between sensor-detected object placement and the subsequent button press, the system can evaluate whether response consistency has been maintained or varied. This temporal analysis enables the longitudinal monitoring of upper limb motor improvements throughout the rehabilitation process. Figure 19: Graphical interface of the upper limb rehabilitation device; windows: (**a**) start screen, (**b**) information panel of the programme. Figure 20: Graphical interface of the upper limb rehabilitation device; windows: (**a**) appraisement in three rounds, (**b**) sample report generated during the appraisements process. Once the appraisement is completed, the user may proceed to the exercise tab, which presents a range of interactive tasks. The user is required to place objects into illuminated compartments within the storage module, following on-screen instructions. The difficulty level of the exercises can be set to easy, medium, or hard (Figure 21), allowing progressive training tailored to the user's current abilities. * Easy Level (Figure 22a)--In this introductory mode, the user selects from different arm configurations and completes object transfers from the central storage to the task modules. The evaluation criteria focus solely on the correct placement of objects in designated compartments. Upon completion of the task, a report and time record for the round are displayed (Figure 22b).