— the precise control upon each degree of freedom of a robotic arm is a great challenge in implementi ng industrial work. To simplify mechatronics motion control systems design, this paper proposes mathematical modeling, simulation and control of a given electric motor in terms of input volt, Vin and output motions. The proposed model can be used to select , design, test and validate both plant's and motion control design to meet desired output performance. It presents a basic example of PID control applied to a robotic manipulator arm. Keywords: Robotic arm, Simulation, PID controller, Full state feedback c ontroller I. INTRODUCTION The term robotics is practically defined as the study, design and use of robot systems for manufacturing. Robots are generally used to perform unsafe, hazardous, highly repetitive, and unpleasant tasks [1]. Most used actuator in mech atronics motion control applications is DC motors. Despite a lot of resources that propose different selections and design of control strategies to control motions in desired fashion most control system used are based on convention PID controller [2]. II. DESCRIPTION OF THE SYSTE M A. System Dynamics Most used actuator in mechatronics motion applications is DC motor, therefore, motion control can be simplified to DC motor motion control. PMDC motor is an example of electromechanical system, having both mechanical of electric components, a simplified equivalent representation the armature controlled PMDC motor's two components is shown in Fig.1. Fig.1. Equivalent representation of PMDC motor electromechanical component mobile robot, and single joint robot arm, shown in Fig.2. Fig.2 Single joint robot arm. The motor torque is given by Eq (1). The generated EMF voltage, ea, is given by Eq (2). 𝑇𝑚 =𝐾𝑡𝑖𝑎 (1) 𝑒𝑎=𝐾𝑏𝜔𝑚=𝐾𝑏𝑑θ𝑚 𝑑𝑡 (2) Applying Kirchoff’s law around the electrical loop , substituting, result in Eq(3) .Taking Laplace transform and rearranging, result in Eq(4): 𝐿𝑎𝑑𝑖 𝑑𝑡+ 𝑅𝑎𝑖=𝑉−𝐾𝑒𝑑θ𝑚 𝑑𝑡 (3) 𝐼𝑎(𝑠)=𝑉(𝑆)−𝐾𝑒𝑆θ𝑚(𝑠) 𝑅𝑎+ 𝐿𝑎𝑆 (4) Nafiseh Ebrahimi Department of Mechanical Engineering; the University of Texas at San Antonio Modeling, Simulation and Control of a Robotic Arm Performing the energy balance; the sum of the torques must equal zero, yields Eq.(5), Taking Laplace transform and rearranging, result in Eq(6): 𝐾𝑡∗𝑖−𝑇𝐿𝑜𝑎𝑑 −𝐽𝑚(𝑑2θ 𝑑𝑡2)−𝑏𝑚(𝑑θ 𝑑𝑡)=0 (5) 𝐾𝑡𝐼(𝑠)=(𝐽𝑚𝑠+𝑏𝑚)𝑠 θ(s) (6) substituting Eq.(4) in Eq.( 6) and rearranging, to have the transfer function gi ven by Eq.(7)in terms of the input voltage, V(s) and output motor shaft angle θ𝑚. 𝐺𝑚=Ө𝑚(𝑠) 𝑉(𝑠)=𝐾𝑡 𝑠[(𝑅𝑎+𝐿𝑚𝑠)(𝐽𝑎𝑠+𝑏𝑚)𝐾𝑏𝐾𝑡] (7) the total equivalent inertia, Jeq and total equivalent d amping, beq at the armature of the motor are given by: 𝑏𝑒𝑞= 𝑏𝑚+ 𝑏𝑙𝑜𝑎𝑑 𝑛2 , 𝐽𝑒𝑞= 𝐽𝑚+ 𝐽𝑙𝑜𝑎𝑑 𝑛2 Substituting Jeq and beq in Eq. (7), the total equivalent transfer function, relating input voltage Vin and Arm -load output angular position θLoad, is given by Eq. (8). In this transfer function, gear ration (n) which is the transfer function of gear system is included. 𝐺=θ 𝐿𝑜𝑎𝑑 (𝑠) 𝑉𝑖𝑛(𝑠) 𝐺=𝐾𝑡∗𝑛 𝐿𝑎𝐽𝑒𝑞𝑠3+(𝑅𝑎𝐽𝑒𝑞+𝑏𝑒𝑞𝐿𝑎)𝑠2+(𝑅𝑎𝑏𝑒𝑞+𝐾𝑡𝐾𝑏)𝑠 (8) The robot arm system to be designed, has the following nominal values; arm mass, M= 8 Kg, arm length, L=0.4 m, and viscous damping constant, b = 0.09 N.sec/m. The following nominal values for the various parameters of eclectic motor used: Vin=12 Volts; Jm=0.02 kg·m²; bm =0.03; Kt =0.023 N -m/A; Kb =0.023 V -s/rad; Ra =1 Ohm; La=0.23 Henry; TLoad, gear ratio, for simplicity, n =1. Substituting values of parameters into transfer functio n gives Eq. (9): 𝐺=0.023 0.02913 𝑆3+0.1543 𝑆2+0.1205 𝑆 (9) Regarding state space specification A, B, C and D matrix could be obtain as below Eq. (10): 𝑋.=[−5.2969 −4.1366 0 1.0000 0 0 0 1.0000 0]𝑋+[1 0 0]𝑈 (10) 𝑌=[000.7896 ] 𝑋+[0]𝑈 III. OPEN LOOP SIMULATION A. Stability Root Locus diagram for mentioned open loop system is: Fig.3. Root locus diagram The loot locus is drawn for just open loop transfer function with gain K=1. However, if there is a variable gain (K) in the system for maintaining stability of the system K would have a range of K< 415. On the other hand, stability can be considered investigating the eigenvalues of A (system state matrix). if the eigenvalues are positive, the system will not satisfy the condition of BIBO stability, and will therefore become unstable . The eigenvalues of matrix A are: 0, -0.9521, -4.3449, therefore the output signal magnitude would not exceed a finite amount and it is stable. B. System Performance C haracteristics Step respons e of open loop system to Vin= Step= 1V is: Fig.4. Open loop step respnse It is obvious that this system with no feedback from output will continue to infinity. Using MATLAB , below system perfo rmance characteristics obtained ( table 1) . Table1. Open loop system characteristics Rise Time: NaN Settling Time NaN Settling Min NaN Settling Max NaN Overshoot NaN Undershoot NaN Peak Inf Peak Time Inf The system needs to be controlled with at least a feedback from output. S imple potentiometer could turn the feedback in the system. Therefore, we need to close the system. IV. CLOSED LOOP SYSTEM Closing the system by adding arm angular position sensor (potentiometer) gives closed loop transfer function Eq. (11): 𝑇=0.023 0.02913 𝑆3+0.1543 𝑆2+0.1205 𝑆+0.001534 (11) A negative closed loop feedback control system with forward controller is shown in Fig.5 Fig.5. Negative feedback closed loop system block diagram For the closed loop system K= 12/180= 0.0667 is considered for feedback gain. Step re sponse for closed loop system is depicted in Fig.6. Fig.6. Negative feedback closed loop system step response For the closed loop one, system performance characteristics are shown in table 2. Table 2. Closed loop system characteristics Rise Time: 169.82 Settling Time 303.68 Settling Min 13.54 Settling Max 14.99 Overshoot 0 Undershoot 0 Peak 14.99 Peak Time 565.92 A. Design Specifications Our design goal is to design, model, simulate and analyze a control sy stem so that a voltage input in the range of 0 to 12 volts corresponds linearly of a Robot arm output angle range of 0 to 180, that is to move the robot arm to the desired output angular position, θL, corresponding to the applied input voltage, Vin, with o vershoot less than 5%, a settling time less than 2 second and zero steady state error. The error signal, e is the difference between the actual output robot arm position, θL, and desired output robot arm position. For 5% of overshoot we have: ζ=−ln (%𝑂𝑆 100) √π2+ 𝑙𝑛2(%𝑂𝑆 100)=0.69 (12) and for settling time of 2 seconds we have: 𝑇𝑠=4 ζωn =2 (13) Which yields ω𝑛= 2.899 For a second order system we have 𝑆2 + 2ζω ns + ω𝑛2 = 0 ⇒ s1,2 = −ζωn ± jωn√1 − ζ2 and the characteristics equation would be 𝑆2 + 4s + 8.4 = 0 (14) but we do not want to use second order approximation for designing controller. Instead we are going to use PID command and PID Tuner of MATLAB which are far more powerful and precise in compa rison to second order approximation. For using PID command it is better to have an insight about the effect of different co efficients Kp, Ki, Kd on the system. The effects of each of controller parameters, Kp, Ki, and Kd on a closed -loop system are summarized in table 3. Table 3. Effects of PID controller parameters CL Response Rise Time Overshoot Settling Time S-S Error Kp Decrease Increase Small Change Decrease Ki Decrease Increase Increase Eliminate Kd Small Change Decrease Decrease No change Therefore, for the mentioned system which has settling time more than 300 seconds the most important coefficient would be Kd whi ch decrease settling time. On the other hand, using Ki would worsen the condition of settling time. In terms of steady -state error, it is already zero and does not need any action. Similarly, overshoot is already zero and does not need to be considered. We are going to investigate two types of controller on the closed loop system in the following. B. P Controller Using PID tuner MATLAB proposes Kp, Ki and Kd coefficients which are used in PID command to draw the step response of the controlled system. We chose P type of controller in MATLAB, PID tuner and obtained following coefficient as first estimation: Kp= 2.5927 Which yeilds settling time: 114.7 seconds and overshoot: 0% that setteling time is still too high and needs more modification. Step respon se for closed loop system with P controller is depicted in Fig.7. Fig.7. Closed loop system with P controller step response System specifications for the controlled system is shown in table 4. Table 4. P controlled system characteristics Rise Time: 63.70 Settling Time 114.72 Settling Min 0.91 Settling Max 0.9993 Overshoot 0 Undershoot 0 Peak 0.9993 Peak Time 212.20 Trying larger Kp s like 100 and 1000 still does not reach desired specification. Then, we need to take into the picture other coe fficients Ki and Kd. Ki is used for steady state error elimination while we do not have any. The main problem for the system is high settling time so as mentioned before we need to work with Kd to reduce this quantity. In next section we focus on PID contr oller design. C. PID Controller We chose PID type of controller in MATLAB, PID tuner and obtained following coefficient as first estimation: Kp= 11.67 Ki= 2.19 Kd= 15.56 Which results Settling time: 64.58, overshoot: 39.56% that is not acceptable. Only by putti ng Ki=0 the results got better as setteling time: 26.59 sec, overshoot: 0 and steady state error:0 like previous time. After some manipulation on Kp and Kd coefficients Finally we chose the coeffient s below as final controller: Kp= 1 01 Ki= 0 Kd= 94 Step response for closed loop system with PID controller is depicted in Fig. 8. Fig.8. Closed loop system with PID controller step response System specifications for the PID controlled system is listed in table 5. Table 5. PID controlled system chara cteristics Rise Time: 1.29 Settling Time 1.98 Settling Min 13.58 Settling Max 15.26 Overshoot 1.74 Undershoot 0 Peak 15.26 Peak Time 2.92 Steady state error is zero as well. Then all designing specifications are satisfied with final chosen Kp, Ki and Kd. V. FULL STATE FEEDBACK CONTROL AND LINEAR QUADRATIC REGULATOR CONTROL A. Pole Placement pole placement, is a method employed in feedback control system theory to place the closed -loop poles of a plant in pre - determined locations in the s-plane .[1] Placing poles is desirable because the location of the poles corresponds directly to the eigenvalues of the system, which control the characteristics of the response of the system. The system must be considered controllable in order to implement this method. This technique is widely used in systems with mul tiple inputs and multiple outputs, as in active suspension systems . In order to implement pole placement method all state variable must be measurable. Moreover, system must be controllable. Using pole placement technique, we could get the closed loop poles to the desired location. Not only the “dominant poles”, but “all poles” are forced to lie at specific desired locations. Our system state space model expressed in Eq. (10) is controllable because the rank of its controllability matrix is equal to the orde r of system (n). The scheme of full state feedback system is depicted in Fig.9. Fig.9. Closed -loop system with full state feedback controller The control vector U is designed in the following state feedback form 𝑈= −𝐾𝑋 (15) This leads to the following closed loop system 𝑋.=(𝐴−𝐵𝐾)𝑋=𝐴𝐶𝐿𝑋 (16) where 𝐴𝐶𝐿≡(𝐴−𝐵𝐾) (17) The gain matrix is desi gned in such a way that |𝑆𝐼−(𝐴−𝐵𝐾)|=(𝑠−𝑃1)(𝑠−𝑃2)…(𝑠−𝑃𝑛) (18) where 𝑃1,…𝑃𝑛 are the desired pole locations. Solving for K, the gain matrix K is obtained such that the state feedback control places the closed -loop pole s at the loations of desired poles. That means the eigenvalues of A – BK are equal to the desired poles. According to characteristics equation obtained from desired specification design (Eq. 14) we have the following dominant poles: P1,2= -2.0±2.0976i The third pole is chosen such that its magnitude be more than three times of the dominant poles. Fig.10 shows step response of the system after applying pole placement method. Fig.10. Full State Feedback Control step response System specifications for the controlled system is listed in table 6. Table 6. Full state feedback controlled system characteristics Rise Time: 0.81 Settling Time 2.24 Settling Min 0.90 Settling Max 1.04 Overshoot 4.19 Undershoot 0 Peak 1.04 Peak Time 1.73 B. Linear quadratic regulator (LQR) The theory of optimal control is concerned with operating a dynamic system at minimum cost. The case where the system dynamics are described by a set of linear differential equations and the cost is described by a quadratic function is called the LQ problem. One of the main results in the theory is that the solution is provided by the linear –quadratic regulator (LQR), a feedback controller whose equations are given below. The LQR is an important part of the solution to the LQG (linear –quadratic –Gaussian) problem For a time-continuous system, the state -feedback law u = –Kx minimizes the quadratic cost function J(u). 𝐽(𝑢)=∫(𝑥𝑇𝑄𝑥+𝑢𝑇𝑅𝑢)𝑑𝑡∞ 0 (19) Subject to 𝑋.=𝐴𝑥+𝐵𝑢. The goal is to design an optimal feedback K using the Linear Quadratic Regulator (LQR) problem, whose parameters are the state matrix A, input matrix B, state weighti ng matrix Q, and input weighting matrix R. Q is a symmetric positive semi - definite matrix and R is a symmetric positive -definite matrix. Matrices Q and R imposes constraints on states and control input, respectively. The state feedback control gain matri x K is obtained as 𝐾 = 𝑅−1𝐵𝑃 (20) Where matrix P satisfies the following reduced matrix Riccati: 𝐴𝑇𝑃 + 𝑃𝐴 − 𝑃𝐵𝑅−1𝐵𝑃 + 𝑄 = 0 (21) The weight ing matrices are specified such that the closed loop system is abl e to track the reference signal with a control signal that does not significant violates the saturated actuator limits. The minimum value of J in Eq. ( 19) is obtained as 𝐽𝑚𝑖𝑛 =𝑥𝑇(0)𝑃𝑥(0) For our simulation we assumed Q and R as follows to de sign optimal control. 𝑄=104∗𝐶∗𝐶𝑇 𝑅=10−4 In Fig.11 the step response of the system after applying LQR technique is displayed. We manipulated R to obtain acceptable system characteristics from the optimization. System characteristics after implementation of LQR is shown in table 7. Table 7. LQR controlled system characteristics Rise Time: 0.29 Settling Time 2.85 Settling Min 0.90 Settling Max 1.07 Overshoot 7.29 Undershoot 0 Peak 1.07 Peak Time 0.63 VI. CONCLUSION Our fi rst appr oach to control the robotic manipulator arm is to derive a mathematical model for the system using physical governing equations on system. After obtaining the state space model and block diagram for the system, it is illustrated that this system is stable. Using feedback to make a closed loop system and getting a preliminary insight from this system step response we designed several controllers to control the robotic arm system to meet system requirements. In order to meet the design specifications of the r esponse which were 5% overshoot, settling time of 2 seconds, and zero steady -state error to step input, PD controller, and PID controller were designed using root locus and their performance was compared. Next, full state feedback control was implemented b y assigning desired closed -loop poles. Finally, linear quadratic regulator was implemented to minimize the performance index. Table 8 illustrates the characteristic of desired, open loop and all designed controller. System specifications for all type of applied controllers are illustrated in table 8. It can be inferred that best performance is for PID controller since it satisfies all of the desired specification the best and decries settling time significantly. Moreover, PP (pole placement) controller sa tisfies the condition though its overshoot is more than PID and introduce a trivial amount of steady state error to the system as well . Also, LQR controller’s oversh oot exceeds the desired amount and this is un acceptable. In addition, P controller due to i ts unsatisfactory settling time is not acceptable. Table 8. Comparison of system characteristics for different controllers OS% 𝑇𝑠 𝑒𝑠𝑠 Desired system 5 2 0 Closed loop 0 303.68 0 P Controller 0 114.73 0 PID Controller 1.74 1.98 0 PP 4.19 2.34 1.3x10-15 LQR 7.3 0.85 1.11x10-16 VII. ACKNOWLEDGMENT I would like to take this opportunity to express my profound gratitude and deep regard to Dr. Bing Dong for his guidance, valuable feedback and constant encouragement throughout the duration of the project. His valuable suggestions were of immense help throughout my project work . VIII.