Design and Preliminary Testing of a Magnetic Spring as an Energy-Storing System for Reduced Power Consumption of a Humanoid Arm

The increasing use of robots in the industry, the growing energy prices, and higher environmental awareness have driven research to find new solutions for reducing energy consumption. In additional, in most robotic tasks, energy is used to overcome the forces of gravity, but in a few industrial applications, the force of gravity is used as a source of energy. For this reason, the use of magnetic springs with actuators may reduce the energy consumption of robots performing trajectories due their high-hardness magnetic properties of energy storage. Accordingly, this paper proposes a magnetic spring configuration as an energy-storing system for a two DoF humanoid arm. Thus, an integration of the magnetic spring system in the robot is described. A control strategy is proposed to enable autonomous use. In this paper, the proposed device is modeled and analyzed with simulations as: mechanical energy consumption and kinetic energy rotational and multibody dynamics. Furthermore, a prototype was manufactured and validated experimentally. A preliminary test to check the interaction between the magnetic spring system with the mechanism and the trajectory performance was carried out. Finally, an energy consumption comparison with and without the magnetic spring is also presented.


Introduction
Humanoid robots have been a source of study for at least two decades, with applications in industry, medicine, and, especially, in the area of rehabilitation [1,2]. Many of these devices are based on robots of serial and parallel architectures [3]. However, these robotic devices present several problems for their development, and one of them is a high energy consumption during rehabilitation tasks. One way to achieve an energy consumption reduction is a correct balancing strategy. There have been many balancing methods developed over the years, all of them achieving their principal goal, which is balancing robots. These methods were designed according to the necessities of each robot. In reference [4], the author made a review of the mechanical gravity compensation and balancing solutions. He divided the solutions into three general groups, which are: gravity compensation by counterweights, by auxiliary actuators, and balancing by springs. The main principle of the first technique is adding extra mass (counterweights) to the moving links to keep their center of mass balanced. An example of this type was developed in reference [4]; the author harnessed the mass of the hydraulic robot system to balance itself. Industrial robots KUKA R630 and PUMA 200 use a similar system but harness their electric motor mass. The second type uses auxiliary links (a mechanical system between was developed by the authors for SCARA robots. They used a similar configuration as in reference [17] for the springs. The authors set arbitrary initial and end positions for the study, because the robot was not fixed in one position. The technique uses magnets instead of springs, gears, pneumatics, or another kind of auxiliary system. Usually, it is compared with springs since it brings a similar performance but with some advantages over springs, like noncontact, zero vibrations, zero noises, etc. In this paper, a novel magnetic spring strategy is proposed and added to a two Degrees of Freedom (DoF) serial robot model. A novel configuration and experimental characterization of the novel magnetic spring configuration is introduced. In addition, to identify the initial position of the end effector (EE) at the startup in the robot, the control algorithm is improved. Finally, an energy consumption comparison, with and without a magnetic spring, is described.

Conceptual Design and Dynamic Model of a Two DoF Humanoid Arm
The dynamic model of a serial robot with two Degrees of Freedom (DoF) (Double Pendulum) is presented, which simulates the action of the human arm, composed of two joints variables (q and q ). Figure 1 shows the motion ranges of each joint. The model allows calculating the necessary torque value during the different trajectories, in addition to modifying the distance of each of its links, masses, angles of rotation, speeds, and accelerations (see Figure 2a). The humanoid arm can be used as a prosthetic and neurorehabilitation; in Figure 2b, the CAD model is shown.   was developed by the authors for SCARA robots. They used a similar configuration as in reference [17] for the springs. The authors set arbitrary initial and end positions for the study, because the robot was not fixed in one position. The technique uses magnets instead of springs, gears, pneumatics, or another kind of auxiliary system. Usually, it is compared with springs since it brings a similar performance but with some advantages over springs, like noncontact, zero vibrations, zero noises, etc.
In this paper, a novel magnetic spring strategy is proposed and added to a two Degrees of Freedom (DoF) serial robot model. A novel configuration and experimental characterization of the novel magnetic spring configuration is introduced. In addition, to identify the initial position of the end effector (EE) at the startup in the robot, the control algorithm is improved. Finally, an energy consumption comparison, with and without a magnetic spring, is described.

Conceptual Design and Dynamic Model of a Two DoF Humanoid Arm
The dynamic model of a serial robot with two Degrees of Freedom (DoF) (Double Pendulum) is presented, which simulates the action of the human arm, composed of two joints variables (q and q ). Figure 1 shows the motion ranges of each joint. The model allows calculating the necessary torque value during the different trajectories, in addition to modifying the distance of each of its links, masses, angles of rotation, speeds, and accelerations (see Figure 2a). The humanoid arm can be used as a prosthetic and neurorehabilitation; in Figure 2b, the CAD model is shown.  The mechanism is composed of two active joints, q 1 and q 2, that represent the shoulder and elbow joint, respectively, as well as a series of variables to control. The data for an average human arm [20,21] are presented in Table 1 below.
The direct and inverse kinematics of the two DoF mechanism were programed to carry out two trajectories: a circle and a lemniscate; these trajectories were tested to evaluate their feasibility and to assist the training exercises for the human arms in references [21,22]. The equations that allow to generate each of the desired trajectories, x 0 and y 0, are presented by considering their origin and radius as where x c and y c are the center of the trajectory, r is the radius, and n varies from 0 • to 360 • . Equations (2) and (3) are used to perform a circle and the lemniscate, respectively. The kinematic equations are programmed and simulated in MATLAB R2020b to find the angles of the joints and the positions of the end effector (EE) that allow generating the two previously defined trajectories.

Torque, Energy Consumption, and Electrical Power
The total mechanical energy E T of the system is a function of the kinetic energy EC T and the potential energy U T ; then, the equations that allow obtaining the value of the total energy of the system are E T = EC T + U T (4) The total electrical power P T is calculated as a function of the consumed torques T 1 and T 2 and the speed of each of the links:

A Magnetic Spring as an Energy-Storing System
The magnetic spring system is composed of two identical well-shaped cylindrical magnets, as in Table 2 [23], which shows the magnet proprieties. To calculate the force generated in the magnetic spring, several equations were developed. First, there was the Coulomb's law, which focused on the magnet's charges and the distance between them to obtain the magnetic force [24][25][26][27]. Additionally, there was the equation that uses low order polynomials to calculate it [28,29]. Another equation was developed in reference [30], in which the authors defined their formula as the sum of the forces due to the four pairs of the surface. The proposed experimental characterization used two magnet (fixed and float) and a gram scale balance OHAUS model CS2000. U(s) is the distance between the magnets, and Y(s) is the repulsive force calculated using the data of the balance and multiplied to reach a gravity force of 9.81 m/s 2 . The interaction of displacement-force between the magnets in the function to the time is shown in Figure 3.

A Magnetic Spring as an Energy-Storing System
The magnetic spring system is composed of two identical well-shaped cylindrical magnets, as in Table 2 [23], which shows the magnet proprieties. To calculate the force generated in the magnetic spring, several equations were developed. First, there was the Coulomb's law, which focused on the magnet's charges and the distance between them to obtain the magnetic force [24][25][26][27]. Additionally, there was the equation that uses low order polynomials to calculate it [28,29]. Another equation was developed in reference [30], in which the authors defined their formula as the sum of the forces due to the four pairs of the surface.
The proposed experimental characterization used two magnet (fixed and float) and a gram scale balance OHAUS model CS2000. U(s) is the distance between the magnets, and Y(s) is the repulsive force calculated using the data of the balance and multiplied to reach a gravity force of 9.81m/s 2 . The interaction of displacement-force between the magnets in the function to the time is shown in Figure 3.  The System Identification toolbox from MATLAB was used to estimate the coefficients and the order of a transfer function, a third-order system with zero, as  The System Identification toolbox from MATLAB was used to estimate the coefficients and the order of a transfer function, a third-order system with zero, as

Integration of the Magnetic Spring System in the Robot
According to the previous information, a configuration that integrated the magnetic spring system with the mechanism was proposed, as in Figure 4a,b. In addition, the parameters that define this configuration are presented in Table 3. The objective is to provide energy to the actuation system based on the magnetic field principle.

Integration of the Magnetic Spring System in the Robot
According to the previous information, a configuration that integrated the magnetic spring system with the mechanism was proposed, as in Figure 4a,b. In addition, the parameters that define this configuration are presented in Table 3. The objective is to provide energy to the actuation system based on the magnetic field principle.  where and are the external torques generated by the magnetic spring system, M and are the fixed magnets, and are the float magnets, and are the distances between magnets fixed and float, respectively, and are the repulsive forces between the magnets, and are the positions of the fixed magnets around and , and is the max distance between articulations to the fixed magnet. Table 3. Design parameters by integration of the magnetic spring system in the robot.

Variable
Min  Table 3 shows the parameters of the system. Therefore, the equations to calculate and generated by the magnetic spring system, can be expressed as where τ e 1 and τ e 2 are the external torques generated by the magnetic spring system, M s 1 and M s 2 are the fixed magnets, M m 1 and M m 2 are the float magnets, d m 1 and d m 2 are the distances between magnets fixed and float, respectively, F 1 and F 2 are the repulsive forces between the magnets, L x 1 and L x 2 are the positions of the fixed magnets around L 1 and L 2 , and L t is the max distance between articulations to the fixed magnet. Table 3. Design parameters by integration of the magnetic spring system in the robot. Figure 4a,b allows describing τ e 1 and τ e 2 when interacting with the mechanism, and Table 3 shows the parameters of the system. Therefore, the equations to calculate τ e 1 and τ e 2 generated by the magnetic spring system, can be expressed as

Control Strategy and Simulations
The aim of the pure position control of manipulative robots whose dynamic models include the gravitational torque term g(q d i ) is solved by the PD-DGD [31]. The PD-DGD control law is represented as where τ 1 and τ 2 are the joints torques; k p 1 = 120, k p 2 = 81, k v 1 = 35, and k v 2 = 15 are the proportional and derivative constants, respectively, and are the positive-definite matrix, q e 1 and q e 2 are the trajectories errors, as in Equation (20), and g q d 1 and g q d 2 are the torques due to the gravity forces in positions q d 1 and q d 2 [32]. The only difference with the gravitycompensated PD controller is that the term g q d i replaces g(q i ). The practical convenience of this controller is evident when the desired position q d is periodic or constant. Indeed, the vector g q d i , which depends on q d and not on q i , can be evaluated "offline" once q d has been defined and, therefore, it is no longer necessary to evaluate g(q i ) in real time. Figure 5 shows the two trajectories generated by the mechanism by means of a PD-DGD-type control algorithm with the desired gravity compensation; in addition, the start and end of the trajectory located at q 1 = 0 • and q 2 = 0 • are presented.
where , , , and are the coordinates x and y of the magnets, and f is the magnetic field constant. The analysis of the mechanical energy and electrical power consumption of the dynamic model of the robot is based on the implementation of the Proportional Derivative (PD) control with Desired Gravity Compensation (PD-DGC) [31,32].

Control Strategy and Simulations
The aim of the pure position control of manipulative robots whose dynamic models include the gravitational torque term ( ) is solved by the PD-DGD [31]. The PD-DGD control law is represented as where and are the joints torques; = 120, = 81, = 35, and = 15 are the proportional and derivative constants, respectively, and are the positive-definite matrix, 1 and 2 are the trajectories errors, as in Equation (20), and ( ) and ( ) are the torques due to the gravity forces in positions 1 and 2 [32]. The only difference with the gravity-compensated PD controller is that the term replaces ( ). The practical convenience of this controller is evident when the desired position is periodic or constant. Indeed, the vector ( ), which depends on and not on , can be evaluated "offline" once has been defined and, therefore, it is no longer necessary to evaluate ( ) in real time.
(20) Figure 5 shows the two trajectories generated by the mechanism by means of a PD-DGD-type control algorithm with the desired gravity compensation; in addition, the start and end of the trajectory located at q = 0° and q = 0° are presented. The block diagram in Figure 6 describes the elements to implement the control strategy of the two DoF robot arm, including the magnetic springs. The block diagram in Figure 6 describes the elements to implement the control strategy of the two DoF robot arm, including the magnetic springs.
The torque generated by the magnetic springs are added to the torque generated by the robot arm actuators by the control algorithm τ c i , and the torque generated by the magnetic spring system τ e i is added and enters the dynamic model of the robot to follow the trajectory (position and velocity). In addition, through this control diagram, it is possible to know when the torque generated by the magnetic spring system acts on the system, which indicates when the system provides energy to the control. The torque generated by the magnetic springs are added to the torque generated by the robot arm actuators by the control algorithm τ , and the torque generated by the magnetic spring system τ is added and enters the dynamic model of the robot to follow the trajectory (position and velocity). In addition, through this control diagram, it is possible to know when the torque generated by the magnetic spring system acts on the system, which indicates when the system provides energy to the control.

Mechanical Energy Consumption Simulation
To analyze the power consumption of the robot arm with the magnetic spring system during the trajectory, a mechanical energy consumption simulation was carried out. In Figure 7a-c, three states are observed: initial position, trajectory generation, and return to the initial or final position. In addition, the total mechanical energy consumption E (J) of the system is shown for each of the mentioned states. The generation of the circular trajectory is programmed by implementing a PD-DGD-type control algorithm with gravity compensation. Figure 8 shows the required mechanical energy in the robot during the circular trajectory from the starting to the 400-sample time. The red line corresponds to a mechanical energy consumption without the magnetic spring system, and the blue line corresponds to a mechanical energy consumption with the magnetic spring.
The results in Figure 8 show a significant reduction on the mechanical energy that the control must apply to the robot. The estimation of the energy consumption during the circle trajectory is reduced by 71.47% with the magnetic spring system.

Mechanical Energy Consumption Simulation
To analyze the power consumption of the robot arm with the magnetic spring system during the trajectory, a mechanical energy consumption simulation was carried out. In Figure 7a-c, three states are observed: initial position, trajectory generation, and return to the initial or final position. In addition, the total mechanical energy consumption E c (J) of the system is shown for each of the mentioned states. The generation of the circular trajectory is programmed by implementing a PD-DGD-type control algorithm with gravity compensation. Figure 8 shows the required mechanical energy in the robot during the circular trajectory from the starting to the 400-sample time. The red line corresponds to a mechanical energy consumption without the magnetic spring system, and the blue line corresponds to a mechanical energy consumption with the magnetic spring.
The results in Figure 8 show a significant reduction on the mechanical energy that the control must apply to the robot. The estimation of the energy consumption during the circle trajectory is reduced by 71.47% with the magnetic spring system.

Kinetic Energy Rotational Simulation
To validate the power consumption, a kinetic energy rotational simulation is proposed; the simulation was developed in Working Model (version 5.1.2.53, San Mateo, CA, USA). The objective was to measure the kinetic energy rotational from q 2 = 0 • to q 2 = 15 with and without the magnetic force. In the scenario with the magnetic force applied the actuator, torque was input as 20 Nm, and a 5-N force along the x-axis was applied for 0.5 s, simulating the magnetic field. In the scenario without the magnetic force, only the actuator torque was input as 25 Nm. Both simulation scenarios lasted 1 s. The frictionless motion of L 2 was programmed, and the gravitational force was included. The simulation parameters of the mechanism are shown in Table 1. Figure 9 a and b shows a scheme of both the simulated scenarios. Figure 8 shows the required mechanical energy in the robot during the circular trajectory from the starting to the 400-sample time. The red line corresponds to a mechanical energy consumption without the magnetic spring system, and the blue line corresponds to a mechanical energy consumption with the magnetic spring.
The results in Figure 8 show a significant reduction on the mechanical energy that the control must apply to the robot. The estimation of the energy consumption during the circle trajectory is reduced by 71.47% with the magnetic spring system.

Kinetic Energy Rotational Simulation
To validate the power consumption, a kinetic energy rotational simulation is proposed; the simulation was developed in Working Model (version 5.1.2.53, San Mateo, CA, USA). The objective was to measure the kinetic energy rotational from q = 0° to q = 15 with and without the magnetic force. In the scenario with the magnetic force applied the actuator, torque was input as 20 Nm, and a 5-N force along the x-axis was applied for 0.5 s, simulating the magnetic field. In the scenario without the magnetic force, only the actuator torque was input as 25 Nm. Both simulation scenarios lasted 1 s. The frictionless motion of L was programmed, and the gravitational force was included. The simulation parameters of the mechanism are shown in Table 1. Figure 9 a and b shows a scheme of both the simulated scenarios.
(a) (b) Figure 9. Power consumption simulation scheme: (a) with magnetic force, (b) without magnetic force. Figure 10a,b shows the power consumption with and without the magnetic force; the measure of the kinetic energy rotational with a magnetic force was 0.5 J, and the measure of the kinetic energy rotational without a magnetic force was 0.9 J. The results in Figure  10a,b show a significant reduction as 0.4 J on the kinetic energy rotational applied to the mechanism. Therefore, when the magnets of the system are employed, the motor only needs to overcome the dissipative forces, reducing the energy consumption.  Figure 10a,b shows the power consumption with and without the magnetic force; the measure of the kinetic energy rotational with a magnetic force was 0.5 J, and the measure of the kinetic energy rotational without a magnetic force was 0.9 J. The results in Figure 10a,b show a significant reduction as 0.4 J on the kinetic energy rotational applied to the mechanism. Therefore, when the magnets of the system are employed, the motor only needs to overcome the dissipative forces, reducing the energy consumption.
force. Figure 10a,b shows the power consumption with and without the magnetic force; the measure of the kinetic energy rotational with a magnetic force was 0.5 J, and the measure of the kinetic energy rotational without a magnetic force was 0.9 J. The results in Figure  10a,b show a significant reduction as 0.4 J on the kinetic energy rotational applied to the mechanism. Therefore, when the magnets of the system are employed, the motor only needs to overcome the dissipative forces, reducing the energy consumption.

Multibody Dynamic Simulation
To analyze the interaction between the mechanisms with the magnetic spring system for the flexion and extension trajectories, a multibody dynamic analysis was carried out. For the simulation, a trajectory from q 2 = 0 • to q 2 = 15 • • was programmed for 5 s to move the mass of L 2 = 1121.48 g and material PLA. An external force generated by the magnetic spring system of 5 N was applied after 3 s from the start of the trajectory; this force was applied on top of the surface of the magnet in a direction normal to the surface of the magnet.
The torque applied by the mechanism before and after interacting with the external force of the magnetic spring system was analyzed, as shown in Figure 11a. The results show that, at the beginning of the trajectory, a torque of 242.15 Nm was needed, which increased until it reached 349.65 Nm in 3 s; after the external force was applied, the torque decreased to 125.57 Nm until it reached 48.06 Nm in 5 s. Therefore, at 3 s, the torque decreased 224.08 Nm due to the interaction of the magnetic spring system.

Multibody Dynamic Simulation
To analyze the interaction between the mechanisms with the magnetic spring system for the flexion and extension trajectories, a multibody dynamic analysis was carried out. For the simulation, a trajectory from q = 0° to q = 15° ° was programmed for 5 s to move the mass of L = 1121.48 g and material PLA. An external force generated by the magnetic spring system of 5 N was applied after 3 s from the start of the trajectory; this force was applied on top of the surface of the magnet in a direction normal to the surface of the magnet.
The torque applied by the mechanism before and after interacting with the external force of the magnetic spring system was analyzed, as shown in Figure 11a. The results show that, at the beginning of the trajectory, a torque of 242.15 Nm was needed, which increased until it reached 349.65 Nm in 3 s; after the external force was applied, the torque decreased to 125.57 Nm until it reached 48.06 Nm in 5 s. Therefore, at 3 s, the torque decreased 224.08 Nm due to the interaction of the magnetic spring system.
In Figure 11b, the analysis of the energy consumption is presented, and the data shows that, at the beginning of the trajectory, 0.0120 W was consumed, which increased until reaching 0.0190 W in 3 s; then, when the magnetic force was applied, the energy consumption went down to −0.0065 W in 3 s. This result indicates that the magnetic system causes the mechanism to behave like a generator system, since it provides more energy than it consumes. Therefore, this result, due to the magnitude of the external force generated by the magnetic system, is higher than that required by the mechanism.

Prototype Manufacturing and Experimental Test
After the design and simulation of a magnetic spring as an energy-storing system for a two DoF humanoid arm, a prototype was produced with additive manufacturing [33]. The geometrical parameters of the mechanism with the magnetic spring system are shown in Table 4. Two magnet N45 used for the magnetic-spring system, two Dynamixel AX-12A servomotors motors, were chosen for the actuation system of the prototype, as shown in Figure 12. The controller is composed of an Arduino Mega board that is connected to two motors, and this board allows speed and direction control of the motor at the same In Figure 11b, the analysis of the energy consumption is presented, and the data shows that, at the beginning of the trajectory, 0.0120 W was consumed, which increased until reaching 0.0190 W in 3 s; then, when the magnetic force was applied, the energy consumption went down to −0.0065 W in 3 s. This result indicates that the magnetic system causes the mechanism to behave like a generator system, since it provides more energy than it consumes. Therefore, this result, due to the magnitude of the external force generated by the magnetic system, is higher than that required by the mechanism.

Prototype Manufacturing and Experimental Test
After the design and simulation of a magnetic spring as an energy-storing system for a two DoF humanoid arm, a prototype was produced with additive manufacturing [33]. The geometrical parameters of the mechanism with the magnetic spring system are shown in Table 4. Two magnet N45 used for the magnetic-spring system, two Dynamixel AX-12A servomotors motors, were chosen for the actuation system of the prototype, as shown in Figure 12. The controller is composed of an Arduino Mega board that is connected to two motors, and this board allows speed and direction control of the motor at the same time. The power supply generates 5 V DC to 12 V DC and a maximum current of 2 A. The prototype weight is 2.5 kg, and thanks to the additive manufacturing technology used, the manufacturing price of the prototype is less than $400. Table 4. Geometrical parameters of a magnetic spring as an energy-storing system for a two DoF humanoid arm.

Dimension
Value (mm) tuators 2021, 10, x FOR PEER REVIEW 12 of 16 Table 4. Geometrical parameters of a magnetic spring as an energy-storing system for a two DoF humanoid arm. Preliminary tests were carried out to check the interaction between the magnetic spring system with the mechanism and the trajectory performance. The aim of the experiment was to measure the ability of the mechanism to generate the flexion and extension trajectories in the end effector (EE) defined by the x1 and y1 axes. Thus, two poses were programed to test the reaction of the system. These poses consisted of a flexion and extension trajectory defined from q = 0° to q = 90° and q = 90° to q = 0°, as shown in Figure 13a-c, respectively. Preliminary tests were carried out to check the interaction between the magnetic spring system with the mechanism and the trajectory performance. The aim of the experiment was to measure the ability of the mechanism to generate the flexion and extension trajectories in the end effector (EE) defined by the x 1 and y 1 axes. Thus, two poses were programed to test the reaction of the system. These poses consisted of a flexion and extension trajectory defined from q 2 = 0 • to q 2 = 90 • and q 2 = 90 • to q 2 = 0 • , as shown in Figure 13a-c, respectively.

Dimension
Preliminary tests were carried out to check the interaction between the magnetic spring system with the mechanism and the trajectory performance. The aim of the experiment was to measure the ability of the mechanism to generate the flexion and extension trajectories in the end effector (EE) defined by the x1 and y1 axes. Thus, two poses were programed to test the reaction of the system. These poses consisted of a flexion and extension trajectory defined from q = 0° to q = 90° and q = 90° to q = 0°, as shown in Figure 13a-c, respectively. To validate the trajectory performance, a strategy on marker detection was used to identify the EE position through image processing; this strategy was explained in reference [34]. Figure 14a-c shows the EE identification in green color, and Figure 15 shows the comparison between the program trajectory and the trajectory generated by the EE, defined by x i and y i . To validate the trajectory performance, a strategy on marker detection was used to identify the EE position through image processing; this strategy was explained in reference [34]. Figure 14a-c shows the EE identification in green color, and Figure 15 shows the comparison between the program trajectory and the trajectory generated by the EE, defined by x and y . The results in Figure 15 show a significant error in the trajectory that the mechanism generated. The estimation of the trajectory error is 3%.
To validate the low power consumption of the mechanism with and without the magnetic spring system, an experiment was proposed to measure the current consumption.  All in all, the focus of this paper was on the design of a magnetic spring as an energystoring system, integration of the magnetic spring with the humanoid arm, and preliminary testing for reduced power consumption. The advantages with other designs, as shown in reference [16], are that they use physical contact, and we proposed no contact; this allowed us to avoid mechanical wear between the moving parts of the prototype. However, we had limitations, such as adding weight to the mechanism, as represented by the magnetic system.
The mechanical design of q that used the additional supports necessary for the magnetic system allowed us to generate the flexion and extension motions of the elbow without limitations. However, for q it was not possible to generate the motions of the shoulder, since the mechanical design had one DoF.
As for future works, the proposed design can be adapted to generate reference trajectories for three-dimensional exercises. In addition, there may be alternative ways to better use a magnetic spring as an energy-storing system for reduced power consumption.  The results in Figure 15 show a significant error in the trajectory that the mechanism generated. The estimation of the trajectory error is 3%.
To validate the low power consumption of the mechanism with and without the magnetic spring system, an experiment was proposed to measure the current consumption. The current consumption was measured for a trajectory from q 2 = 0 • to q 2 = 15 • . This trajectory was selected to function with the specifications of the magnetic system shown in Table 3. A T-RMS digital multimeter powered by Steren was used. The results obtained showed that the mechanism with the magnetic spring system consumed a current at the startup of the trajectory of 0.031 A and finished at 0.113 A. On the other hand, when the mechanism was without the magnetic spring system, the current consumption at the startup of the trajectory was 0.050 A and finished 0.140 A. Therefore, it can be validated that the current consumption in the startup was 0.019 A less by using the magnetic spring system. The results obtained are presented in Figure 16a,b. The average current consumption with and without the magnetic force was 11.46 A and 13.81 A, respectively. Considering that the voltage was the same, this results in about a 17% power consumption reduction when introducing the magnetic force; this magnetic force has a production cost of approximately $12. All in all, the focus of this paper was on the design of a magnetic spring as an energystoring system, integration of the magnetic spring with the humanoid arm, and preliminary testing for reduced power consumption. The advantages with other designs, as shown in reference [16], are that they use physical contact, and we proposed no contact; this allowed us to avoid mechanical wear between the moving parts of the prototype. However, we had limitations, such as adding weight to the mechanism, as represented by the magnetic system.
The mechanical design of q that used the additional supports necessary for the magnetic system allowed us to generate the flexion and extension motions of the elbow without limitations. However, for q it was not possible to generate the motions of the shoulder, since the mechanical design had one DoF.
As for future works, the proposed design can be adapted to generate reference trajectories for three-dimensional exercises. In addition, there may be alternative ways to better use a magnetic spring as an energy-storing system for reduced power consumption.  All in all, the focus of this paper was on the design of a magnetic spring as an energy-storing system, integration of the magnetic spring with the humanoid arm, and preliminary testing for reduced power consumption. The advantages with other designs, as shown in reference [16], are that they use physical contact, and we proposed no contact; this allowed us to avoid mechanical wear between the moving parts of the prototype. However, we had limitations, such as adding weight to the mechanism, as represented by the magnetic system.
The mechanical design of q 2 that used the additional supports necessary for the magnetic system allowed us to generate the flexion and extension motions of the elbow without limitations. However, for q 1 it was not possible to generate the motions of the shoulder, since the mechanical design had one DoF.
As for future works, the proposed design can be adapted to generate reference trajectories for three-dimensional exercises. In addition, there may be alternative ways to better use a magnetic spring as an energy-storing system for reduced power consumption.

Conclusions
In this paper, a magnetic spring as an energy-storing system for a two DoF humanoid arm was proposed. The proposed design was based on the characteristics of the magnetic spring obtained through a displacement-force relationship. The new prototype is characterized by a kinematic model, trajectory performance analysis, and simulations that include a mechanical energy consumption and kinetic energy rotational and multibody dynamics. Then, a low-cost prototype presented its manufacturing process through 3D printing and commercial components. The hardware and software for the control system were then detailed, and experimental tests validated the performance and low power consumption of the proposed mechanism design.
In conclusion, a magnetic spring as an energy-storing system for a two DoF humanoid arm allowed to obtain low energy consumption through the phenomenon of attraction and repulsion of the magnetic field and the action force that compresses them. In future developments, the components of the magnetic spring system will be manufactured with an improved repulsion and attraction force through the electromagnetic models, improving the magnetic force and creating a high energy-efficiency potential.

Data Availability Statement:
The data presented in this study are available on request at the discretion of the corresponding author.