Force Control of a Shape Memory Alloy Spring Actuator Based on Internal Electric Resistance Feedback and Artificial Neural Networks

ABSTRACT This paper presents a study of the resistive behavior of a Shape Memory Alloy spring, with a focus on the application of electrical resistance feedback in control systems. Artificial Neural Networks of different topologies were designed to learn the relation between spring electrical resistance and the force exerted. The feedback between layers in Neural Networks is demonstrated to be a key parameter in learning the non-linear and hysteretic behavior of Shape Memory Alloys. Experiments with closed-loop systems showed that shape memory alloy springs generated forces that converged satisfactorily to the desired reference values. The scientific contribution of this work is the use of electrical resistance variation as feedback for controlling the spring force, eliminating the use of an external force sensor. Neural networks were used for both, the sensing process and the system control; in that way the nonlinear and hysterical behavior of the shape memory alloy actuator was well considered.


Introduction
Shape Memory Alloys (SMAs) are metallic alloys that demonstrate the capacity of recovering their original shape after a pseudoplastic deformation, or apply a significant recovery force upon heating when previously a phase transformation was induced by strain (Otsuka and Wayman 1998). The Shape Memory Effect is a thermomechanical pheno-menon, and the consequence of a change in the crystalline structure; considering NiTi alloy, a lowtemperature phase known as martensite is distinguished from a hightemperature phase, known as austenite (Lagoudas 2008).
Recently, the interest in SMA actuators has increased due to their promising properties such as reliability, high-energy density, simple design, and silent operation. Despite the great potential of SMA actuators in many fields, there are still challenges in actuator design due to low-energy efficiency, non-linearity, hysteretic behavior, and slow response time, when compared with conventional actuators (Engeberg et al. 2015;Li and Tian 2018;Pan et al. 2017;Silva et al. 2013Silva et al. , 2017. Such characteristics must be considered since they can result in undesirable performance or unstable dynamics of the system. A common challenge in the application of SMA actuators is the displacement control using a physical variable as feedback. A position is the most common feedback variable in this type of control and position sensors are expensive. Temperature feedback has also been studied, but it is less convenient due to the difficulty measuring temperature accurately. In most cases, the temperature shows a gradient over the actuator. The relation between electric resistance variation and deformation in a SMA actuator during phase transformation is deterministic and reproducible (Ma, Song, and Lee 2004), especially due to the fact that resistivity depends directly on the martensite fraction of the material. Therefore, the electric resistance can be used as a feedback variable for controlling SMA actuators.
Several studies have been conducted to understand the electric resistance variation behavior in Shape Memory Alloys. Mathematical models have been proposed to describe the relation between electric resistance and deformation in SMA wires (Cui, Song, and Li 2010;Novák et al. 2008). Zhang (Zhang, Yin, and Zhu 2013) used electric resistance feedback for actuating SMA-based artificial muscles. Similarly, electric resistance feedback controlled a SMA servo actuator in an active endoscope (Ikuta, Tsukamoto, and Hirose 1988) and was investigated for aerospace applications at high altitudes (Ng et al. 2017).
In general, the electric resistance behavior is non-linear and depends on many factors. Simple models may not be convenient, and more sophisticated control strategies are required. Considering the high complexity, Artificial Neural Networks (ANN) seem to be an interesting tool for implementing control based on electric resistance feedback.
Artificial neural networks learn certain behaviors and patterns iteratively, in order to achieve the desired output from certain input data. Neural networks learn by means of a training process. A selected data set is used to conduct network training, known as the training set. Network training is done following a set of rules, known as the learning algorithm. Each learning algorithm has its own characteristics and applications for which it is best suitable.
ANNs are capable to learn non-linear relations, they should be able to handle Shape Memory Alloy properties in a more natural way. Some research studies follow this philosophy. For example, position control of a SMA actuator based on electric resistance feedback was implemented by Ning et al. using an Artificial Neural Network (Ma, Song, and Lee 2004). Similarly, an Artificial Neural Network modeled the relation between an LVDT position and electric resistance, aiming to implement a sensorless control of a SMA actuator (Asua et al. 2010).
In addition, Artificial Neural Networks can also be interesting tools for implementing controllers. For instance, a Hysteretic Neural Network controlled the sliding of a SMA beam (Hannen, Crews, and Buckner 2012). Nikdel et al. presented an ANN-based Model Predictive Controller for a manipulator built from SMA wires (Nikdel et al. 2014). An adaptive ANN was developed to adjust strain in SMA wires (Srivastava, Ward, and Patel 2017).
The relation between electric resistance and force of a SMA spring is studied and two different ANNs are designed: one network describes this relation eliminating the need for measuring the spring force by means of a load cell; the second one implements a simplified control for actuating the spring. The reason for using two different neural networks was to separate the sensing and control functions and to simplify the training process of each network separately.
The novelty of this study is the use of electric resistance variation as a feedback variable of the control system. This is important due to the fact that the continuous use of the SMA spring causes material fatigue, modifying the electric resistance of the actuator itself over time. Thus, the variation of electrical resistance of the actuator proved to be more repetitive and reliable in the control process than the electrical resistance itself. This allows the use of simpler and easier to implement neural networks for sensing and control. Feedback through position is most widely used, but has the disadvantage of its high cost. In this sense, the relationship between electrical resistance variation and strain in an SMA actuator during phase transformations is deterministic and repetitive, especially due to the fact that its resistivity depends directly on the martensite fraction in the material. Thus, the electrical resistance feedback can replace, for example, the position sensor, saving costs, reducing the required space and simplifying the electronic instrumentation of an embedded system that eventually uses this actuator. Besides that, using the electrical resistance as feedback makes the control system faster compared to a temperature-based control system.

Experimental Details
NiTi SMA springs (53% Ni and 47% Ti) with a final temperature of austenite formation A f � 17 � C under zero deformation were used; these are superelastic at room temperature. The length of the NiTi spring including the eyelets was 15 mm when fully relaxed. In applications, they are typically stretched from 35 to 45 mm. Their nominal force is 200 gf.
A SMA spring was mounted on a test platform, as shown in Figures 1 and Figure 2. A load cell measured the force exerted by the spring during the cycling processes. A microcontroller generated Pulse Width Modulated (PWM) current heated the spring. The frequency of the PWM signal was 100 Hz. The electric current was gradually rising until the maximum Root Mean Square value of 250 mA. This value was determined experimentally and it is the necessary current to induce the austenite phase in the SMA spring with minimum deterioration of the material. Then, the current was gradually decreased until the cycle is complete.  Different PWM signal frequencies were tested: 100 Hz, 200 Hz, 400 Hz, 500 Hz, 800 Hz, 1000 Hz, and 2000 Hz. No significant differences were observed in the spring behavior due to frequency variation. Thus, in terms of control, the choice of the lowest frequency was prioritized, aiming at decreasing the minimum sampling rate and not overloading the data acquisition system.
The following data were collected during the experiment and served as the data basis for neural network training: the variation of electrical resistance (obtained from voltage and current readings) with respect to the initial resistance value before the corresponding cycle, the spring force, the initial values of resistance and force, as well as logical signals representing the corresponding phase transformation. A detailed description of the input data of each neural network is given in the subsections "Artificial Neural Network as Sensor" and "Artificial Neural Network as Model for Control." The training process was done using two different SMA springs of equal dimensions. The springs were subjected to 26 heating/cooling cycles to collect data for ANN training. A total of 7619 data points were collected; 75% of them were used for the training process, 15% for performance validation and the remaining 10% for specific tests. The Levenberg-Marquardt algorithm with cross-validation was implemented in all training tests. A third SMA spring (different from the springs used for training) was used for control experiments, aiming at evaluating the trained neural networks.
A USB-6212 acquisition board from National Instruments was used to acquire all the data used for training, as well as to implement the control system and the neural networks. All routines implemented on this hardware were developed by means of the LabView software. Only neural network training was done using the C programming language.
The load cell characterization was done with a correctly calibrated dynamometer and various weights. The dynamometer measured the weight force of the masses, which is correlated to the output voltage of the load cell. These data were collected and the characteristic curves of mass (weight force) versus output voltage of the load cell were drawn. Two different Artificial Neural Networks are designed to implement the control of the SMA spring: the first one actuated as a sensor based on electric resistance feedback, and the second one served as a part of the control system.

Artificial Neural Network as Sensor
Feedforward ANNs are networks working without feedback loops between layers. Recurrent neural networks (RNN) are networks that have feedback loops between layers. ANNs using these two different topologies are designed and the results are compared. The purpose of testing these two different Neural Network topologies is an evaluation of their ability to describe the nonlinear and hysteretic behavior of the SMA actuator.
The feedforward ANN is shown in Figure 3, the RNN in Figure 4. Both neural networks have one hidden layer with 5 neurons; the activation function used was the hyperbolic tangent. A huge number of layers or neurons may lead the network to overfit, i.e. the network memorizes the behavior of the data presented for training, but it is not capable to generalize this behavior in different situations. As a practical rule for designing ANNs, the number of hidden layers and neurons should be as low as possible.
The input data for the feedforward ANN include the electric resistance variation values, the initial values of force and electric resistance and a tag signal. The tag signal's purpose is to identify which transformation is happening during the cycle, in other words, if the actuator is transformed from martensite to austenite (heating process) or from austenite to martensite  (cooling process). The electric resistance variation is the difference between the resistance measured at a given time during the experiment, and the initial resistance value at the beginning of the network training cycles. The output data are the force values, in gram-force (gf).
The input data for the RNN consist of two parts: the input data of the feedforward ANN, plus the feedback of its output layer. The resistance input is a vector of three elements, graphically represented by "(0:2)" in Figure 4, indicating a composition of the current value of electric resistance and the last two resistance values. The terms "(1:1)" and "(1:2)," also graphically represented in Figure 4, indicate vectors composed by the last output layer value and the two last hidden layer values, respectively.
The use of the initial force and resistance values as inputs to the ANN is important due to the fact that the electric resistance and the force applied by the SMA spring are influenced by factors, such as temperature and spring degradation. For this reason, electric resistance variation and force variation are used as input data and target data. In that way, when adding the initial values of electric resistance and force to the input data, the Neural Network becomes more overarching in many situations.
For all the training processes, the Levenberg-Marquardt algorithm with cross-validation was used. All training parameters are the same for both ANNs, in a way that the results depend basically on the type of network being used.

Artificial Neural Network as Model for Control
A feedforward ANN was designed to learn the relation between the electric current applied to the SMA spring and the force exerted by this spring. Electric current and the tag signal were used as input data for the ANN. In the same way the ANN was used as sensor. The output data are the force values, in gram-force (gf). The Artificial Neural Network that works as a model for controlling purpose is shown in Figure 5.
Contrary to the ANN trained as a sensor, the ANN serving as a model for control uses the electric current as input due to the fact that this is the manipulated variable of the system. In fact, the electric resistance values cannot be directly manipulated, but they are the direct consequence of changes in the electric current through the actuator. Therefore, the controller should provide a new electric current value.

Implementation of the Control System
The design of the controller for the system uses the Model Predictive Control based on Artificial Neural Networks as blueprint.
The Model Predictive Control (MPC) is a method of process control, widely used in industry and academy. The basis of MPC is the calculation of a future sequence of input signals of a process, in order to minimize a cost function over a horizon of predictions (Georgieva and de Azevedo 2011). On the other hand, the implementation of the predictive control requires an appropriate dynamic model of the process to be controlled.
When working with SMA actuators, a mathematical model for the material may be hard to obtain or requires simplifications which limit the practical use of the actuator. Thus, an Artificial Neural Network may be an interesting tool in order to develop a dynamic controller model.
A cost function has to be chosen to implement the control. There are many cost functions that may be used for this purpose. In common, these cost functions utilize past inputs and outputs of the system to perform predictions. It is desirable, in terms of simplification of the project, that the cost function should be the simplest possible, without losing performance.
Thus, a modified MPC is designed, based on ANN, in which the cost function is the Mean Square Error (MSE) and the prediction horizon is unitary, i.e., the cost function is calculated with the last input value and the prediction is limited to the next iteration. From an experimental point of view, the choice of that particular cost function lead to a reasonable data processing time of the microcontroller, since the same board was used for driving, sensing, implementation of neural networks, implementation of a Kalman filter for better signal reading, and real-time visualization of the variables studied.
A fundamental difference between a classic MPC and the controller implemented in this work is discretization. For the calculation of the cost function, an array of 330 allowed current values I to be driven through the actuator is created. The estimated force values F est are calculated through the neural network that works as a model from the matrix of defined electric currents I and the value of tag signal T supplied to the network, according to the equation (1). The function f represents the estimation, or output of the neural network. The MSE values are then calculated from the estimated force matrix, according to the equation (2), in which the g function calculates the squares of the elements of the matrix applied to it (without changing the order of the matrix).
. . (2) Once the matrix of quadratic mean errors (MSE) is given, the lowest value of this matrix is determined and the electric current corresponding to the index of this lowest value is chosen from the matrix I. Obviously, such a simplified cost function may affect system performance. To solve this problem, a correction function is proposed, based on the error between output and the desired reference force, in order to compensate for the simplicity of the cost function. The purpose of the correction function is to increase or decrease the electric current applied to the SMA spring if the predicted current values are not sufficient to make the force converge to the desired output. In other words, the correction current added to the predicted input increases proportionally to the difference between existing and desired output force, according to equation (3). The correction factor α can be determined according to Table 1; these values were obtained experimentally.
ΔI ¼ α�error: The system is convergent under the selected cost function, since the correction function implemented in the controller prevents that the electrical current flowing through the spring deviates from the desired value.
The block diagram of the simplified controller is shown in Figure 6 and the closed-loop system is implemented using both trained Neural Networks (see Figure 7).

Experimental Results
Different tests were conducted with both neural networks. Initially, the ANN with the function of a sensor was tested, and one example of these results is shown in Figure 8. Equally the characterization of the ANN working as a controller model is given in Figure 9. The output force values produced by the neural network were compared with those of a commercial force sensor module for load cells. In general, the ANN modeling a sensor always presents a worse estimate than the ANN modeling the controller. This is especially due to the fact that the variation of the electrical resistance of the spring is low when compared to the variation of the applied electric current. This makes the resistance readings more noisy.     Finally, experiments were conducted to test the efficiency of the control system. In these experiments, the desired force is changed over time and the force measured by a commercial sensor is compared to the trained ANN estimated force (see one example of these experiments in Figure 10). Figure 11 displays the current passing through the spring for the same experiment. Figure 10. Force control in a SMA spring using the designed simplified predictive controller based on artificial neural network. Desired force, ANN estimated force and experimental force as function of time. Figure 11. Force control in a SMA spring using the designed simplified predictive controller based on artificial neural network. Current passing through the spring as a function of time. Data are related to the specific experiment given in Figure 10 As can be seen, the estimated force of the sensor ANN converges to the desired force in a better way than the force measured by the commercial sensor. This fact is emphasized in Figure 12, where the errors between the desired ANN output and the sensor over time are shown. These results can be explained in two ways: (1) The feedback signal used for control is the estimated force, given by the ANN utilizing the resistance value of the SMA spring. Naturally, it is expected that the ANN force estimation follows the desired output signal in a better way. Also, the natural response of the SMA phase transformation tends to be slower than the estimation through the ANN model.
(2) It is possible that there are small changes in the standard hysteresis curve of the SMA spring when there is a sensitive temperature variation due to external factors (such as a small air stream from the air conditioning, for example). As neural networks have been trained taking into account complete hysteresis cycles, small errors could arise from this fact. Including incomplete hysteresis cycles into network training can improve the performance of the network in such situations.
This simplified predictive control based on artificial neural networks can be considered as efficient for controlling SMA actuators, as long as the ANNs were previously well trained.
It was experimentally found that an increase in the number of hidden layers for both recurrent and feedforward type networks does not provide a significant improvement in power estimation performance. Furthermore, the use of recurrent ANNs did not prove to be more efficient than feedforward ANNs. Therefore, taking these data as a basis, the feedforward type ANN with one hidden layer is chosen for implementation of the sensor for electrical resistance feedback, aiming at simplicity of implementation and lower computational processing cost.

Conclusion
The use of Artificial Neural Networks was efficient for reproducing the non-linear and hysteretic behavior of a SMA spring in two ways: first the ANN is a suitable force sensor using electric resistance and second, it serves as a model of a simplified predictive controller. In addition, electric resistance variation as well as the simplified controller allow the use of neural networks with simpler topology throughout the sensing and control process. This provides the advantage of using simpler and cheaper processors for the implementation of the system. The SMA spring hysteresis has shown repetitive when analyzing the force and electric resistance variations. It can be expected that similar results will be obtained for other SMA actuators, such as SMA wires or SMA beams. Obviously different actuators require new training processes.
In addition, if the ANN weights are well tuned, the use of electric resistance feedback has shown to be more efficient than the use of a load cell. Also, electric resistance feedback as network input should be more efficient than other variables, such as temperature or strain. This methodology may eliminate the need for other sensors in the electronic instrumentation of SMA actuators. Thus, equipment based on SMA actuators could be designed in a simpler, cheaper and more efficient way.

Disclosure Statement
No potential conflict of interest was reported by the author(s).

Funding
This study was financed in part by the Coordenação de Aperfeiçoamento de Pessoal de Nível Superior -Brasil (CAPES) -Finance Code 001.