<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article  PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd"><article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article"><front><journal-meta><journal-id journal-id-type="publisher-id">ICA</journal-id><journal-title-group><journal-title>Intelligent Control and Automation</journal-title></journal-title-group><issn pub-type="epub">2153-0653</issn><publisher><publisher-name>Scientific Research Publishing</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.4236/ica.2012.33023</article-id><article-id pub-id-type="publisher-id">ICA-22044</article-id><article-categories><subj-group subj-group-type="heading"><subject>Articles</subject></subj-group><subj-group subj-group-type="Discipline-v2"><subject>Computer Science&amp;Communications</subject></subj-group></article-categories><title-group><article-title>
 
 
  Modeling a Controller for an Articulated Robotic Arm
 
</article-title></title-group><contrib-group><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>ajeev</surname><given-names>Agrawal</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref><xref ref-type="corresp" rid="cor1"><sup>*</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Koushik</surname><given-names>Kabiraj</given-names></name><xref ref-type="aff" rid="aff2"><sup>2</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Ravi</surname><given-names>Singh</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib></contrib-group><aff id="aff2"><addr-line>Department of Mechanical Engineering, Birla Institute of Technology, Ranchi, India</addr-line></aff><aff id="aff1"><addr-line>Department of Production Engineering, Birla Institute of Technology, Ranchi, India</addr-line></aff><author-notes><corresp id="cor1">* E-mail:<email>rajeev_agra@yahoo.com(AA)</email>;</corresp></author-notes><pub-date pub-type="epub"><day>30</day><month>08</month><year>2012</year></pub-date><volume>03</volume><issue>03</issue><fpage>207</fpage><lpage>210</lpage><history><date date-type="received"><day>December</day>	<month>1,</month>	<year>2011</year></date><date date-type="rev-recd"><day>May</day>	<month>7,</month>	<year>2012</year>	</date><date date-type="accepted"><day>May</day>	<month>15,</month>	<year>2012</year></date></history><permissions><copyright-statement>&#169; Copyright  2014 by authors and Scientific Research Publishing Inc. </copyright-statement><copyright-year>2014</copyright-year><license><license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p></license></permissions><abstract><p>
 
 
  The precise control upon each degree of freedom of a robotic arm is a great challenge in implementing industrial work. This paper aims to design a novel controller for an automated robotic arm. A discrete Proportional Integral Derivative (PID) control technique is being used to replace the complex electronic circuitry, which would greatly reduce the cost and size of the controller. DC motors will be controlled on the basis of Closed-loop System using an avr (Atmega 16/32) microcontroller. Transfer functions have been derived for mathematical modeling of the system through which the stability of the system can be evaluated prior to fabrication.
 
</p></abstract><kwd-group><kwd>Robotic Arm; Proportional Integral Derivative (PID) Controller; Transfer Function; Computed Torque Technique; Atmega 16/32</kwd></kwd-group></article-meta></front><body><sec id="s1"><title>1. Introduction</title><p>The recent rapid progress in robotic technologies has led to great expectations for robots to be applied in various fields such as industrial robots, guard robots and home robots [<xref ref-type="bibr" rid="scirp.22044-ref1">1</xref>]. Robotic arms find vast applications in several industrial automation processes such as manufacturing tasks, assembly lines etc. [<xref ref-type="bibr" rid="scirp.22044-ref2">2</xref>]. Motion control of a robotic arm can be classified into many categories. Lygorouas et al. [<xref ref-type="bibr" rid="scirp.22044-ref3">3</xref>] developed a computer-controlled light weight mechanical arm. This mechanical arm was a self-contained, autonomous system capable of executing high-level commands from a supervisory computer. The actuators of the joints were permanent magnet type DC motors driven by servo amplifiers via Pulse Width Modulation. Aung [<xref ref-type="bibr" rid="scirp.22044-ref4">4</xref>] designed and implemented a controller circuit based on PIC microcontroller and H bridge circuit to control the motion of a Wheeled Mobile Robot (WMR). He used MATLAB software for the modeling of the total system. Silva [<xref ref-type="bibr" rid="scirp.22044-ref5">5</xref>] applied fuzzy logic at several hierarchical levels of a typical robotic control system. For controlling robotic manipulators, Moosavian [<xref ref-type="bibr" rid="scirp.22044-ref6">6</xref>] used Transpose Jacobian (TJ) control. Arciniegas et al. [<xref ref-type="bibr" rid="scirp.22044-ref7">7</xref>] developed neural network based adaptive control system to control the flexible robotic arm. Tseng [<xref ref-type="bibr" rid="scirp.22044-ref8">8</xref>] developed a DSP based instantaneous torque controller to control the manipulator. Rogers [<xref ref-type="bibr" rid="scirp.22044-ref9">9</xref>] designed a microcontroller circuit for interfacing joint sensor to control robotic arm. In this text a unique computed torque technique is being used to actuate the various joints. Given the dynamic equation of a robotic arm, the basic problem is to determine the various torque/forces to drive all the joints of the arm in real time. This is done in order to track a desired time based trajectory as closely as possible. The motor current/ voltage characteristics and the computed torque are converted into an applied motor current/voltage which actuates the dc motors.</p><p>A closed loop PID controller is being used to reduce the overshoot, rise time and the steady state error. A PID controller usually comprises of a Proportional, Integral and Derivative circuitry but here the whole PID controller is implemented through programming which greatly reduces the electronic circuitry as well as cost of the system. This approach also simplifies tuning of the proportional (K<sub>p</sub>), integral (K<sub>i</sub>) and derivative (K<sub>d</sub>) gains. The computed voltage from the error signal is applied to the motor by Pulse Width Modulation (PWM) technique.</p><p>A Transfer function is a mathematical expression which relates the input and output variables by using Laplace transform. This can be modeled via MATLAB (SIMULINK) to obtain the various performance characteristics of the whole system which may be in the form of graphs. Here an approximate transfer function is derived considering the parameters such as damping, moment of inertia, gear ratio etc.</p><p>The first section gives insight into modeling of system using a suitable transfer function. It is followed by the concepts of Proportional Integral Derivative control. Then, the advantage of implementing a discrete PID controller is highlighted by using an atmega 16/32 bit microcontroller.</p></sec><sec id="s2"><title>2. Transfer Function</title><p>The transfer function of a single joint can be well approximated by Equation (1.1) using the following variables:</p><p>V<sub>a</sub> = Armature voltage (Volts)</p><p>L<sub>a</sub> = Armature inductance (Henry)</p><p>R<sub>a</sub> = Armature resistance (Ohms)</p><p>θ<sub>m</sub> = Angular displacement of thee motor shaft (Radians)</p><p>J<sub>eff</sub> = (J<sub>m</sub> + n2JL)</p><p>J<sub>m</sub> = Moment of inertia of the motor referred to the motor shaft (oz.in.s2/rad)</p><p>J<sub>L</sub> = Moment of inertia of the load referred to the load shaft (oz.in.s2/rad)</p><p>n = Gear reduction ratio f<sub>eff</sub> = (f<sub>m</sub> + n2fL)</p><p>f<sub>m</sub> = Viscous friction coefficient referred to the motor shaft (oz.in.s/rad)</p><p>f<sub>L</sub> = Viscous friction coefficient of the load referred to the load shaft (oz.in.s/rad)</p><p>n = Gear reduction ratio K<sub>a</sub> = Motor torque proportional constant (oz.in/A)</p><p>K<sub>b</sub> = Proportionality constant between ω (angular speed) and e<sub>b</sub> (back emf)</p><p>K<sub>p</sub> = Position feedback gain</p><p>θ<sub>d</sub> = Desired angle e(t) = (θ<sub>d</sub>(t) – θ(t)) the error in position</p><disp-formula id="scirp.22044-formula12897"><label>(1.1)</label><graphic position="anchor" xlink:href="1-7900134\02f86ed9-c6c1-4ac9-808d-d1560fbb3dfc.jpg"  xlink:type="simple"/></disp-formula><p>Since the electrical time constant of the motor is much smaller than the electrical time constant, the armature inductance (L<sub>a</sub>) can be neglected.</p><p>Hence,</p><disp-formula id="scirp.22044-formula12898"><label>(1.2)</label><graphic position="anchor" xlink:href="1-7900134\51ea2ded-4da2-4553-9ede-d18dc5cb3acc.jpg"  xlink:type="simple"/></disp-formula><p>Since the output of the controller is the angular displacement of the joint (θ<sub>L</sub>), therefore it can be written:</p><disp-formula id="scirp.22044-formula12899"><label>(1.3)</label><graphic position="anchor" xlink:href="1-7900134\446fdd30-3eae-40fc-8427-3c17d5ab18ed.jpg"  xlink:type="simple"/></disp-formula><p>This is an open loop second order system, to improve the response of the system a closed loop Proportional, PD, PI or PID controller can be used. This helps in reducing the rise time and the steady state error. In case of a simple Proportional closed loop control the applied voltage is linearly proportional to the error between the desired and the actual angular displacement of the joint.</p><disp-formula id="scirp.22044-formula12900"><label>(1.4)</label><graphic position="anchor" xlink:href="1-7900134\d994d8ab-8131-4517-8b04-5d83bf81a1b0.jpg"  xlink:type="simple"/></disp-formula><p>Taking Laplace transform:</p><disp-formula id="scirp.22044-formula12901"><label>(1.5)</label><graphic position="anchor" xlink:href="1-7900134\feee72e2-cf26-4c4f-8000-cca8de3ee9f7.jpg"  xlink:type="simple"/></disp-formula><p>Substituting the value of V<sub>a</sub>(s) from Equation (1.5) to Equation (1.3) the following equation is obtained:</p><disp-formula id="scirp.22044-formula12902"><label>(1.6)</label><graphic position="anchor" xlink:href="1-7900134\a5e684e3-bc9b-4d5d-9982-a35b8b33c976.jpg"  xlink:type="simple"/></disp-formula><p>After some algebraic manipulation the following equation is obtained:</p><disp-formula id="scirp.22044-formula12903"><label>(1.7)</label><graphic position="anchor" xlink:href="1-7900134\8984ead5-5241-4976-b03c-4e81663ae66d.jpg"  xlink:type="simple"/></disp-formula><p>Equation (1.7) is a proportional controller for a single joint and is always stable is the system parameters are positive. To increase the system response time and reduce the steady state error an appropriate PD, PI or PID controller can be used.</p><p>In case of a PID controller:</p><disp-formula id="scirp.22044-formula12904"><label>(1.8)</label><graphic position="anchor" xlink:href="1-7900134\bf163990-d1ef-491a-b809-84299fd3cbfe.jpg"  xlink:type="simple"/></disp-formula><p>In Equation (1.8) K<sub>p</sub>, K<sub>i</sub> and K<sub>d</sub> are the position, integral and derivative feedback gain respectively.</p><p>Taking Laplace transform of Equation (1.8):</p><disp-formula id="scirp.22044-formula12905"><label>(1.9)</label><graphic position="anchor" xlink:href="1-7900134\d9a7c444-22a9-46f6-9a0b-1aa8197a9e40.jpg"  xlink:type="simple"/></disp-formula><p>The closed loop transfer function is obtained by performing some algebraic manipulations after substituting the value of V<sub>a</sub> from Equation (1.9) to Equation (1.3)</p><p><img src="1-7900134\56d2fae1-b88b-440d-a862-0098bbb5a953.jpg" />(1.10)</p><p>For implementing a PD control K<sub>i</sub> should be 0;</p><p>And for a PI control K<sub>d</sub> should be 0.</p><p>The values of K<sub>p</sub>, K<sub>i</sub> and K<sub>d</sub> has to be determined accurately to get the best system performance. The ZieglerNichols method can be used to determine the “Best Fit” value of the three parameters. The Ziegler-Nichols tuning method is a heuristic method of tuning a PID controller. It is performed by setting the “I” (integral) and “D” (derivative) gains to zero. The “P” (proportional) gain, is then increased (from zero) until it reaches the ultimate gain K<sub>u</sub>, at which the output of the control loop oscillates with a constant amplitude. K<sub>u</sub> and the oscillation period T<sub>u</sub> are used to set the P, I, and D gains depending on the type of controller used.</p></sec><sec id="s3"><title>3. Discrete PID Controller</title><p>A discrete PID controller reads the error signal, calculates the output and controls the input given to the motor at a given time interval, at the sample period T. The sample time should always be less than the shortest time constant in the system.</p></sec><sec id="s4"><title>4. Algorithm for the Discrete PID Controller</title><p>Unlike simple control algorithms, the PID controller is capable of manipulating the system inputs based on the history and rate of change of the signal. This gives a more accurate and stable control method.</p><p>Considering Equation (1.8)</p><p><img src="1-7900134\835fbb55-070a-4c7d-a6c4-f23d3af0dc77.jpg" /></p><p>Here, e(t)dt can be approximated as <img src="1-7900134\ccea76e3-00f9-4caa-8c5a-8ce2071cda80.jpg" /> where k varies from 0 to n and<img src="1-7900134\41158f14-76c8-4a83-a308-fbab624df086.jpg" />can be approximated as <img src="1-7900134\6fe9889f-bc0c-443f-a50c-19ecf80063b1.jpg" />, t = nT and n is the discreet step at time t.</p></sec><sec id="s5"><title>5. Implementation in Atmega 16/32 Microcontroller</title><p>Atmega 16/32 is a 16bit avr microcontroller that has inbuilt 8-bit and 16-bit timers. These timers are used to set a pre-specified time interval, and an Interrupt Service Routine (ISR) is executed after every such time interval.</p><p>The PID controller uses a structure to store its status and parameters. This structure is initialized in main(??), and only a pointer to it is passed to the Init_PID() and PID() functions.</p><p>The PID() function must be called for each time interval T. This is done by a timer which sets the PID_timer flag when the time interval has passed. When the PID_ timer flag is set the main routine reads the desired process value (setPoint) and system process value, calls PID() and gives the output to the control input.</p><p>Alternatively the timer interrupt can be activated and the PID() function can be called in that interrupt. After each time interval T the timer interrupt is executed and hence the PID() function is called.</p><p>In case the feedback component is an optical shaft encoder then the value of the encoder is taken as an external interrupt in the microcontroller. After that the angle is converted to an equivalent voltage and finally the error signal is computed.</p><p>To increase accuracy the P-factor, I-factor and D-factor arescaled with a factor 1:128. The result of the PID algorithm is later scaled back by dividing by 128. The value 128 is used to allow for optimizing in the compiler.</p><p>The computed voltage after the PID algorithm is executed is generated by using PWM (Pulse Width Modulation) technique, which can be very easily done using Atmega 16/32.</p></sec><sec id="s6"><title>6. Conclusion</title><p>The paper has presented an alternative solution for controlling robotic arm using discrete PID controller technology. The PID controller presented here is a simplified example. The controller should work fine, but it might be necessary to make the controller even more robust (limit runaway/overflow) in certain applications. Adding saturation correction on the integral term, basing the proportional term on only the system process value can become necessary. In calculating the I-factor and D-factor the sample time T is a part of the equation. If the sample time T used is much smaller or larger than 1 second, accuracy for either I-factor or D-factor will be poor.</p></sec><sec id="s7"><title>7. Acknowledgements</title><p>We thank The Institution of Engineers (India) for supporting this work through a grant-in-aid. We are also grateful to the Department of Production Engineering, BIT Mesra for providing the required infrastructure.</p></sec><sec id="s8"><title>REFERENCES</title></sec><sec id="s9"><title>NOTES</title></sec></body><back><ref-list><title>References</title><ref id="scirp.22044-ref1"><label>1</label><mixed-citation publication-type="other" xlink:type="simple">T. A. Salih and O. I. Yehea, “A Novel Control System for Robotics Devices,” Journal of Theoretical &amp; Applied Information Technology, Vol. 28, No. 1, 2011, pp. 48-53.</mixed-citation></ref><ref id="scirp.22044-ref2"><label>2</label><mixed-citation publication-type="other" xlink:type="simple">P. I. Corke and S. Hutchinson, “A Tutorial on Visual Servo Control,” IEEE Transactions on Robotics and Automation, Vol. 12, No. 5, 1996, pp. 651-670.  
doi:10.1109/70.538972</mixed-citation></ref><ref id="scirp.22044-ref3"><label>3</label><mixed-citation publication-type="other" xlink:type="simple">N. Lygorouasjohn, G. Mertziosbasil and C. VoulgarisNicholas, “Design and Construction of a MicrocomputerControlled Light-Weight Robot Arm,” Robotics and Autonomous Systems, Vol. 7, No. 4, 1991, pp. 269-283. 
doi:10.1016/0921-8890(91)90058-S</mixed-citation></ref><ref id="scirp.22044-ref4"><label>4</label><mixed-citation publication-type="other" xlink:type="simple">W. P. Aung, “Analysis on Modeling and Simulink of DC Motor and Its Driving System Used for Wheeled Mobile Robot,” World Academy of Science, Engineering and Technology, Vol. 32, 2007, pp. 299-306.</mixed-citation></ref><ref id="scirp.22044-ref5"><label>5</label><mixed-citation publication-type="other" xlink:type="simple">C. W. de Silva, “Applications of Fuzzy Logic in the Control of Robotic Manipulators,” Fuzzy Sets and Systems, Vol. 70, No. 2-3, 1995, pp. 223-234. 
doi:10.1016/0165-0114(94)00219-W</mixed-citation></ref><ref id="scirp.22044-ref6"><label>6</label><mixed-citation publication-type="other" xlink:type="simple">S. Ali A. Moosavian and E. Papadopoulos, “Modified Transpose Jacobian Control of Robotic Systems,” Automatica, Vol. 43, No. 7, 2007, pp. 1226-1233. 
doi:10.1016/j.automatica.2006.12.029</mixed-citation></ref><ref id="scirp.22044-ref7"><label>7</label><mixed-citation publication-type="other" xlink:type="simple">I. Arciniegasjorge, H. Eltimsahyadel and J. Cioskrzysztof, “Neural-Networks-Based Adaptive Control of Flexible Robotic Arms,” Neurocomputing, Vol. 17, No. 3-4, 1997, pp. 141-157. doi:10.1016/S0925-2312(97)00037-4</mixed-citation></ref><ref id="scirp.22044-ref8"><label>8</label><mixed-citation publication-type="other" xlink:type="simple">K. J. Tseng, “DSP-Based Control of Brushless DC Drives for Direct-Driven Robotic Arms,” Microprocessors and Microsystems, Vol. 19, No. 10, 1995, pp. 581-589. 
doi:10.1016/0141-9331(96)84159-7</mixed-citation></ref><ref id="scirp.22044-ref9"><label>9</label><mixed-citation publication-type="other" xlink:type="simple">J. R. Rogers, “Low-Cost Teleoperable Robotic Arm,” Mechatronics, Vol. 19, No. 5, 2009, pp. 774-779. 
doi:10.1016/j.mechatronics.2009.03.004</mixed-citation></ref></ref-list></back></article>