Hardware Implementation of a Closed Loop Controller on 6R...

12
International Research Journal of Applied and Basic Sciences © 2013 Available online at www.irjabs.com ISSN 2251-838X / Vol, 4 (8): 2147-2158 Science Explorer Publications Hardware Implementation of a Closed Loop Controller on 6R Robot using ARM Microcontroller M. H. Korayem *1 , S. Rafee Nekoo 1 and F. Abdollahi 2 1. Professor, PhD Student, Robotic Research Laboratory, School of Mechanical Engineering, Iran University of Science and Technology (IUST), Tehran,1684613114, Iran 2. MSc Student, Department of Engineering, Science and Research Branch, Islamic Azad University Tehran, Iran * Corresponding Author: [email protected] ABSTRACT: In this article, the hardware implementation of a closed loop controller on 6R robot via ARM microcontroller is presented. The implementation is derived in two levels. Firstly, programming with IAR software is expressed, embedded C base language programming. The programming consists of several parts such as running the microcontroller, defining the characteristics of the motors of the manipulator and its limitations, feedback section and the main control loops. The control loops are provided in two categories, point to point motion and trajectory tracking. Secondly, hardware implementation of the ARM microcontroller, a Cortex M3 processor, on a digital board is provided. The high speed computation ability of this processor, LPC 1768, prepares the situation for applying different control algorithms. The PID control as the first candidate is used for simulating and experimenting point to point and continuous motions via 6R robot. This hardware and software developments demonstrate that the quality of the tracking and regulation of 6R are improved. Keywords: 6R Robot; ARM Cortex M3; Closed loop Control; PID. INTRODUCTION Implementing control algorithms in robotics were proposed in different ways. Programmable logic control (PLC), digital signal processor (DSP) and microcontrollers are three sorts of methods of applying the controllers on industrial systems and robots (Yang et al., 2009), (Jung et al., 2007), (Han et al., 2005). The systems based on embedded microcontrollers are inexpensive; however, they are incapable of controlling complex processes and systems. The DSP cards can be used instead of micro controllers for implementing image processing and massive calculations (Gao et al., 2010), (Livingston, 2007), (Doosthoseini et al., 2012). In this work, a closed loop controller is performed based on ARM-Cortex M3 microcontroller. The robot manipulator in this work is six degrees of freedom articulated arm. Hamraz et al. (2005) made the 3R base of the manipulator; and Jamali et al. (2005) developed the arm by adding a 3R wrist to that. The old system of the controller of 6R was built in a way to perform open loop control (Ahmadi et al., 2009), and it needed alternative electronic controller unit (ECU) to upgrade the whole system to closed loop level. The previous ECU was based on PIC microcontrollers; the system was employed six PIC chips to perform the task. ARM based microcontrollers were used in various works. Ning et al. (2006) presented an improved MAS based method for controlling manipulators. A controller as an embedded system which was running RTOS on an ARM7TDMI-S microcontroller for tele-operation robot employed. Wiriya et al. (2010) designed speed control system in bicycle robot with ARM Cortex M3 and implemented PID and ON-OFF methods on the system. Gouaillier et al. (2009) designed a controller with ARM7 as the main processor and AVR for smaller parts for NAO humanoid robot. Yang et al. (2011) designed mine selective leakage protector based on advanced RISC machine via Cortex M3. Li et al. (2012) used ARM Cortex M3 processor and PID controller to balance an inverted pendulum. LeGrand et al. (2005) applied a combination of ARM and FPGA to obtain a good performance on a complicated system. Reddy et al. (2012) used ARM to speed control of a DC motor with experimental implementation. In this work, ARM Cortex M3 processor is employed as the main processor. This processor is used for applying PID controller in closed loop form which its feedback is obtained by using six potentiometers connected to the links. Six 12 bit ADC channels are used to convert analog signals of potentiometers to digital for processing and control of speed and direction of links. The whole system prepares the conditions for implementing linear and nonlinear controller in closed form. The PID controller is chosen as the first candidate for discussing and conferring the results.

Transcript of Hardware Implementation of a Closed Loop Controller on 6R...

Page 1: Hardware Implementation of a Closed Loop Controller on 6R …irjabs.com/files_site/paperlist/r_972_130703170117.pdf · 2013-07-03 · selective leakage protector based on advanced

International Research Journal of Applied and Basic Sciences © 2013 Available online at www.irjabs.com ISSN 2251-838X / Vol, 4 (8): 2147-2158 Science Explorer Publications

Hardware Implementation of a Closed Loop Controller on 6R Robot using ARM Microcontroller

M. H. Korayem*1, S. Rafee Nekoo1 and F. Abdollahi2

1. Professor, PhD Student, Robotic Research Laboratory, School of Mechanical Engineering, Iran University of Science and Technology (IUST), Tehran,1684613114, Iran

2. MSc Student, Department of Engineering, Science and Research Branch, Islamic Azad University Tehran, Iran

*Corresponding Author: [email protected]

ABSTRACT: In this article, the hardware implementation of a closed loop controller on 6R robot via ARM microcontroller is presented. The implementation is derived in two levels. Firstly, programming with IAR software is expressed, embedded C base language programming. The programming consists of several parts such as running the microcontroller, defining the characteristics of the motors of the manipulator and its limitations, feedback section and the main control loops. The control loops are provided in two categories, point to point motion and trajectory tracking. Secondly, hardware implementation of the ARM microcontroller, a Cortex M3 processor, on a digital board is provided. The high speed computation ability of this processor, LPC 1768, prepares the situation for applying different control algorithms. The PID control as the first candidate is used for simulating and experimenting point to point and continuous motions via 6R robot. This hardware and software developments demonstrate that the quality of the tracking and regulation of 6R are improved. Keywords: 6R Robot; ARM Cortex M3; Closed loop Control; PID.

INTRODUCTION

Implementing control algorithms in robotics were proposed in different ways. Programmable logic control (PLC), digital signal processor (DSP) and microcontrollers are three sorts of methods of applying the controllers on industrial systems and robots (Yang et al., 2009), (Jung et al., 2007), (Han et al., 2005). The systems based on embedded microcontrollers are inexpensive; however, they are incapable of controlling complex processes and systems. The DSP cards can be used instead of micro controllers for implementing image processing and massive calculations (Gao et al., 2010), (Livingston, 2007), (Doosthoseini et al., 2012). In this work, a closed loop controller is performed based on ARM-Cortex M3 microcontroller. The robot manipulator in this work is six degrees of freedom articulated arm. Hamraz et al. (2005) made the 3R base of the manipulator; and Jamali et al. (2005) developed the arm by adding a 3R wrist to that. The old system of the controller of 6R was built in a way to perform open loop control (Ahmadi et al., 2009), and it needed alternative electronic controller unit (ECU) to upgrade the whole system to closed loop level. The previous ECU was based on PIC microcontrollers; the system was employed six PIC chips to perform the task. ARM based microcontrollers were used in various works. Ning et al. (2006) presented an improved MAS based method for controlling manipulators. A controller as an embedded system which was running RTOS on an ARM7TDMI-S microcontroller for tele-operation robot employed. Wiriya et al. (2010) designed speed control system in bicycle robot with ARM Cortex M3 and implemented PID and ON-OFF methods on the system. Gouaillier et al. (2009) designed a controller with ARM7 as the main processor and AVR for smaller parts for NAO humanoid robot. Yang et al. (2011) designed mine selective leakage protector based on advanced RISC machine via Cortex M3. Li et al. (2012) used ARM Cortex M3 processor and PID controller to balance an inverted pendulum. LeGrand et al. (2005) applied a combination of ARM and FPGA to obtain a good performance on a complicated system. Reddy et al. (2012) used ARM to speed control of a DC motor with experimental implementation. In this work, ARM Cortex M3 processor is employed as the main processor. This processor is used for applying PID controller in closed loop form which its feedback is obtained by using six potentiometers connected to the links. Six 12 bit ADC channels are used to convert analog signals of potentiometers to digital for processing and control of speed and direction of links. The whole system prepares the conditions for implementing linear and nonlinear controller in closed form. The PID controller is chosen as the first candidate for discussing and conferring the results.

Page 2: Hardware Implementation of a Closed Loop Controller on 6R …irjabs.com/files_site/paperlist/r_972_130703170117.pdf · 2013-07-03 · selective leakage protector based on advanced

Intl. Res. J. Appl. Basic. Sci. Vol., 4 (

Structure of the System on the ECU part and implementing the closed loop control. The 6R manipulator is presented in Fig. schematic of t

motors are presented in

representations of the system are presented in the following. The transformation matrix,

kinematic computations

T

where the element

n

Intl. Res. J. Appl. Basic. Sci. Vol., 4 (

Structure of the System The system is consisted of a robot arm, computer and electronic control unit. The focus of thon the ECU part and implementing the closed loop control. The 6R manipulator is presented in Fig. schematic of that

a

The Denavitmotors are presented in

The details of 6R robot: forward and inverse kinematics, Jacobian matrix and state

representations of the system are presented in the following. The transformation matrix,

kinematic computations

����

=

00

6

0

zz

yy

xx

on

on

on

T

where the element

516 sscnx +−=

Intl. Res. J. Appl. Basic. Sci. Vol., 4 (

Structure of the System The system is consisted of a robot arm, computer and electronic control unit. The focus of th

on the ECU part and implementing the closed loop control. The 6R manipulator is presented in Fig. hat is shown in Fig

The Denavit-Hartenberg parameters of the arm are expressed in Table 1 and the specifications of the motors are presented in Table 2.

Joint number (i)

1 2 3 4 5 6

Motor

Ustall (N.m) �stall (N.m) Gear box ratio Voltage (v)

The details of 6R robot: forward and inverse kinematics, Jacobian matrix and state

representations of the system are presented in the following. The transformation matrix,

kinematic computations (Korayem et

����

100

zzz

yyy

xxx

pa

pa

pa

where the elements of 6

0T are

( 652341 cccc −+

Intl. Res. J. Appl. Basic. Sci. Vol., 4 (8), 2

The system is consisted of a robot arm, computer and electronic control unit. The focus of thon the ECU part and implementing the closed loop control. The 6R manipulator is presented in Fig.

in Figure 1 (b)

Figure 1. (a) 6R robot manipulator; (b) schematic of the arm.

Hartenberg parameters of the arm are expressed in Table 1 and the specifications of the Table 2.

Table1. The Denavitai Joint number (i)

a1=36.5 mm a2=251.5 mm a3=125 mm a4=92 mm0 0

Table2. 1

114 1.3 1:333.2 Gear box ratio12

The details of 6R robot: forward and inverse kinematics, Jacobian matrix and state

representations of the system are presented in the following. The transformation matrix,

(Korayem et al., 2010)

����

are:

),6234ss−

2147-2158, 2013

The system is consisted of a robot arm, computer and electronic control unit. The focus of thon the ECU part and implementing the closed loop control. The 6R manipulator is presented in Fig.

1 (b).

b

. (a) 6R robot manipulator; (b) schematic of the arm.

Hartenberg parameters of the arm are expressed in Table 1 and the specifications of the

The Denavit-Hartenberg parameters of the arm.

=36.5 mm=251.5 mm=125 mm=92 mm

Table2. The specifications of the motors.2

98 1141.04 1:100 1:333.224

The details of 6R robot: forward and inverse kinematics, Jacobian matrix and state

representations of the system are presented in the following. The transformation matrix,

al., 2010).

, 2013

The system is consisted of a robot arm, computer and electronic control unit. The focus of thon the ECU part and implementing the closed loop control. The 6R manipulator is presented in Fig.

. (a) 6R robot manipulator; (b) schematic of the arm.

Hartenberg parameters of the arm are expressed in Table 1 and the specifications of the

Hartenberg parameters of the arm.di

d1=438 mm 0 0 0 0 d6=152.8 mm

The specifications of the motors.3

382.2 0.73 1:500 1:10012

The details of 6R robot: forward and inverse kinematics, Jacobian matrix and state

representations of the system are presented in the following. The transformation matrix,

The system is consisted of a robot arm, computer and electronic control unit. The focus of thon the ECU part and implementing the closed loop control. The 6R manipulator is presented in Fig.

. (a) 6R robot manipulator; (b) schematic of the arm.

Hartenberg parameters of the arm are expressed in Table 1 and the specifications of the

Hartenberg parameters of the arm.�i(°)

-90 0 0

90 -90 0

The specifications of the motors. 5 4

40.4 40.4 0.9 0.9 1:500 1:500 12 12

The details of 6R robot: forward and inverse kinematics, Jacobian matrix and state

representations of the system are presented in the following. The transformation matrix,

The system is consisted of a robot arm, computer and electronic control unit. The focus of thon the ECU part and implementing the closed loop control. The 6R manipulator is presented in Fig.

. (a) 6R robot manipulator; (b) schematic of the arm.

Hartenberg parameters of the arm are expressed in Table 1 and the specifications of the

Hartenberg parameters of the arm. Motion �i

Link1 �1 Link2 �2 Link3 �3 Yaw �4

Pitch �5

Roll �6

6

40.4 40.40.9 0.91:500 1:50012

The details of 6R robot: forward and inverse kinematics, Jacobian matrix and state

representations of the system are presented in the following. The transformation matrix, 6

0T , is used for forward

The system is consisted of a robot arm, computer and electronic control unit. The focus of this paper is on the ECU part and implementing the closed loop control. The 6R manipulator is presented in Fig. 1 (a) and the

Hartenberg parameters of the arm are expressed in Table 1 and the specifications of the

The details of 6R robot: forward and inverse kinematics, Jacobian matrix and state-

, is used for forward

(1)

(2)

2148

paper is and the

Hartenberg parameters of the arm are expressed in Table 1 and the specifications of the

-space

, is used for forward

Page 3: Hardware Implementation of a Closed Loop Controller on 6R …irjabs.com/files_site/paperlist/r_972_130703170117.pdf · 2013-07-03 · selective leakage protector based on advanced

Intl. Res. J. Appl. Basic. Sci. Vol., 4 (8), 2147-2158, 2013

2149

,62341561165234 ssssccscccny −+= (3)

,623423465 scsccnz −−= (4)

),( 6523423461651 sccsccsssox +−= (5)

,)( 6511523423416 sscsccsscoy +−−= (6)

,623456234 sscccoz +−= (7)

,5234115 sccscax −−= (8)

,5123451 ssccca y += (9)

,5234ssaz = (10)

)),(( 5642342332211156 sdaccacaacscdpx −++++−= (11)

)),(( 5642342332211516 sdaccacaasccdpy −++++= (12)

).( 564234233221 sdassasadpz +−+−−= (13)

In these equations, ia and id are shown in Fig. 3. Also is , ic , ijs and ijc denote )sin( iθ , )cos( iθ ,

)sin( ji θθ + and )cos( ji θθ + , respectively. The elements of the transformation matrix are used for obtaining

the dynamical equation of 6R and end-effector position of the arm. The inverse kinematics equations of the manipulator are also needed for computing the initial conditions for links in simulations and experiments. The inverse kinematics equations are provided in the following (Korayem et al., 2009):

,tan6

61

1 ��

���

−= −

xx

yy

adp

adpθ (14)

[ ],

)(1tan

11

2

12

1161

5

���

���

−−±= −

SpCp

SaCad

xy

xyθ (15)

��

�+

−== −

++

11

1234432 tan

SaCa

a

yx

z

θθθθ for ,05 >θ (16)

πθθ +=′ 234234 for ,05 <θ (17)

���

���

−= −

11

111

6 tanSnCn

CoSo

xy

yxθ for ,05 >θ (18)

πθθ +=′66 for ,05 <θ (19)

,23442345611 CaCSdpSpCt yx −++= (20)

,2345623441 SSdSadpu z +−+−= (21)

,2 2

22222

3

a

autaw

+++−= (22)

,)(2/122

utq += (23)

,tan

)(1

tan1

2

1

2

1

2 ��

���

�+

������

������

��

���

�−±

= −−

t

u

q

w

q

w

θ

(24)

Page 4: Hardware Implementation of a Closed Loop Controller on 6R …irjabs.com/files_site/paperlist/r_972_130703170117.pdf · 2013-07-03 · selective leakage protector based on advanced

Intl. Res. J. Appl. Basic. Sci. Vol., 4 (8), 2147-2158, 2013

2150

,tan 2

22

221

3 θθ −��

���

−= −

Cat

Sau(25)

.322344 θθθθ −−= (26) In inverse kinematics equations, Eqs. (14-26), the first angle and fifth one are computed at first. After that the sumation of the angels of second, third and fourth links are obtained. Then in Eq. (18) the angle of the sixth links is calculated. There are two other configurations for sumation of the angels of second, third and fourth links and sixth link, presented in Eq. (17) and (19), respectively. Introducing variables wut ,, and q , the

the angels of the second, third and fourth links are attained seperately. The relation between the velocity of an end-effector and the angular velocity of joints, which is known as Jacobian matrix, expressed by:

,)( qqJX �� = (27)

where [ ]Tq 621 ... θθθ= is the angels of the links, [ ]T

zyx pppX ���� = is the velocity vector of the end-

effector of the manipulator, )(qJ is the Jacobian matrix and dt

dqq =� . The details of the Jacobian matrix is

presented as

,

0001

0

0

00

0

0

)(

5234234

562341111

462341111

23456343332

2524232221

1514131211

��������

��������

−−−=

ssc

jssccc

jscsss

scdjjj

jjjjj

jjjjj

qJ (28)

where

)),(( 564234233221151611 sdaccacaasccdj −+++−−= (29)

)),(( 26423423322112 sdassasacj −++−= (30)

)),(( 564234233113 sdassacj −+−= (31)

),( 564234114 sdascj +−= (32)

,51652341615 ssdcccdj +−= (33)

)),(( 564234233221151621 sdaccacaaccsdj −++++−= (34)

)),(( 56423423322122 sdassasasj −++−= (35)

)),(( 564234233123 sdassasj −+−= (36)

),( 564234124 sdassj +−= (37)

),( 5115234625 scsccdj +−= (38)

),( 5642342332232 sdaccacaj +−+−−= (39)

),( 56423423333 sdaccaj +−+−= (40)

),( 56423434 sdacj +−= (41)

,523411546 sccscj −−= (42)

.512345156 sscccj −= (43) Applying Lagrange method, the dynamical equation of 6R manipulator is attained in the form of

,)(),()( τθθθθθ =++ GCM ��� (44)

in which )(θM is the inertia matrix, ),( θθ �C is the centrifugal and Coriolis forces, )(θG is the gravity forces

and τ is the input torques. To apply the controller, state space representation of the system is needed.

Considering the states as

[ ] ,,,,,, 6161

T

x θθθθ ����= (45)

Page 5: Hardware Implementation of a Closed Loop Controller on 6R …irjabs.com/files_site/paperlist/r_972_130703170117.pdf · 2013-07-03 · selective leakage protector based on advanced

Intl. Res. J. Appl. Basic. Sci. Vol., 4 (8), 2147-2158, 2013

2151

state space representation of the system is shaped as

( )[ ] .,,,1

127

TGCMxxx −−= − τ�� (46)

Now the dynamical equation of the system is ready for applying the controller. Hardware of the Control System Embedded Microcontroller This setup is based on embedded microcontroller. There are three categories of micro controllers: 8, 16 and 32 bit processors from various companies. LPC1768, in this work, is a 32 bit micro controller based on ARM Cortex M3 processor. LPC1768 operates at up to 100 MHz frequency. The ARM Cortex M3 CPU incorporates at 3 stage pipeline and uses Harvard architecture with separate local instructions and data busses as well as a third bus for peripherals. The peripheral complement of the LPC1768 contains up to 512 KB of flash memory, up to 64 KB of data memory and 64 KB SRAM. In Fig. 2 the schematic of the hardware setup in the control loop is presented.

Figure 2. Schematic of the hardware of the system in closed loop form.

The commands are initiated in computers and sent to LPC1768. Next, the error is computed by comparing the position of the current angels and the desired ones. Then the control signals are sent to drivers to provide the needed power for DC motors. Structure of the ECU The ECU composed of three parts: main board, motor drivers and feedback system. The main board of the ECU consists of microcontroller, LPC1768, input feedback read, PWM output and digital communications. This microcontroller has 100 pins which allow the user to manage the driving of six motors easily and the 12-bit A/D which feedbacks the position of the links to the processor. The processor has also six pins for generating different PWMs that enable motors to drive in both directions. The main board is shown in Fig 3. The driver board of motors is another necessary part of the hardware. The processor board cannot produce the power of the motors and driver board is designed to overcome this problem. BTS7810, with an H-bridge design, is chosen to drive the motors. This driver is capable of providing 40 A and 48 V for the motors. The deriver board is presented in Figure 4.

Page 6: Hardware Implementation of a Closed Loop Controller on 6R …irjabs.com/files_site/paperlist/r_972_130703170117.pdf · 2013-07-03 · selective leakage protector based on advanced

Intl. Res. J. Appl. Basic. Sci. Vol., 4 (

supplies connected to general board of driverboard. switches for direction links for these measurements. The sensitivity and speed of response are two important items is this section. The feedback system is presented in F

Intl. Res. J. Appl. Basic. Sci. Vol., 4 (

In driver part there are power supplies to support supplies connected to general board of driverboard. Each driver switches for direction In order to provide feedback for computing the error links for these measurements. The sensitivity and speed of response are two important items is this section. The feedback system is presented in F

Intl. Res. J. Appl. Basic. Sci. Vol., 4 (

In driver part there are power supplies to support supplies connected to general board of driver

driver card has four digital inputs which two of them are relevant to PWM and the others are on/off switches for direction, and the power supplies for the motors are provided from other u

In order to provide feedback for computing the error links for these measurements. The sensitivity and speed of response are two important items is this section. The feedback system is presented in F

Intl. Res. J. Appl. Basic. Sci. Vol., 4 (8), 2

Fig

In driver part there are power supplies to support supplies connected to general board of driver

has four digital inputs which two of them are relevant to PWM and the others are on/off and the power supplies for the motors are provided from other u

In order to provide feedback for computing the error links for these measurements. The sensitivity and speed of response are two important items is this section. The feedback system is presented in Figure 5

Figure

2147-2158, 2013

Figure 3. Main b

Figure 4. Driver

In driver part there are power supplies to support supplies connected to general board of driver and each motor has its

has four digital inputs which two of them are relevant to PWM and the others are on/off and the power supplies for the motors are provided from other u

In order to provide feedback for computing the error links for these measurements. The sensitivity and speed of response are two important items is this section. The

5.

ure 5. Potentiometer in feedback system

, 2013

board of the hardware

Driver board of motors.

In driver part there are power supplies to support necessaryeach motor has its

has four digital inputs which two of them are relevant to PWM and the others are on/off and the power supplies for the motors are provided from other u

In order to provide feedback for computing the error during the links for these measurements. The sensitivity and speed of response are two important items is this section. The

Potentiometer in feedback system

of the hardware.

oard of motors.

necessary voltage to move each motor. The power each motor has its own driver card connected to general

has four digital inputs which two of them are relevant to PWM and the others are on/off and the power supplies for the motors are provided from other u

during the motionlinks for these measurements. The sensitivity and speed of response are two important items is this section. The

Potentiometer in feedback system.

to move each motor. The power driver card connected to general

has four digital inputs which two of them are relevant to PWM and the others are on/off and the power supplies for the motors are provided from other units.

motion, six potentiometers are set on links for these measurements. The sensitivity and speed of response are two important items is this section. The

to move each motor. The power driver card connected to general

has four digital inputs which two of them are relevant to PWM and the others are on/off

six potentiometers are set on links for these measurements. The sensitivity and speed of response are two important items is this section. The

2152

to move each motor. The power driver card connected to general

has four digital inputs which two of them are relevant to PWM and the others are on/off

six potentiometers are set on links for these measurements. The sensitivity and speed of response are two important items is this section. The

Page 7: Hardware Implementation of a Closed Loop Controller on 6R …irjabs.com/files_site/paperlist/r_972_130703170117.pdf · 2013-07-03 · selective leakage protector based on advanced

Intl. Res. J. Appl. Basic. Sci. Vol., 4 (8), 2147-2158, 2013

2153

The voltage of each potentiometer separately passes thorough a low pass filter and after that an ADC channel converts the voltage to a data. Embedded Code The embedded C language is used for writing code in IAR programs. The written code is completely modular. There are two ways to move the 6R robot arm: point to point and continues motions. In point to point motion there are two points: start point and end point. The algorithm that performs the point to point motion in the processor is presented in Fig. 6 (a). The trajectory between the start and end points of the manipulator is defined by PID controller. In continues motion user defines arrays of points of predefined trajectory. The manipulator must follow those arrays. The algorithm of continuous motion is presented in Fig. 6 (b). In these flowcharts there is a similar section for recording the data of path in the computer. In point to point motion, Fig. 6 (a), manipulator must move from first point to end point, in each scan of loop. At first, it calculates errors and compares it with decision of the robot. If errors are less than decision, the process exits the loop and informs user by sending finished data. If errors are bigger than the decision, it sets directions and torques of motors and sends signals to motor drivers and scans the loop again. In trajectory tracking the set points update in each time step and controller updates itself for tracking.

a b Figure 6. Flowcharts of the motions; (a) point to point; (b) continuous.

The PID algorithm In this section a brief formulation of PID algorithm, which used in this work, is presented. The reasons of choosing this algorithm are: 1) This is the first experiment of this controller setup so the algorithm is chosen as

Page 8: Hardware Implementation of a Closed Loop Controller on 6R …irjabs.com/files_site/paperlist/r_972_130703170117.pdf · 2013-07-03 · selective leakage protector based on advanced

Intl. Res. J. Appl. Basic. Sci. Vol., 4 (8), 2147-2158, 2013

2154

simply as possible to analyze the probable problems. 2) The PID controller works well for so many systems; however the algorithm is simple and systematic. The control law is considered as

],)(1)(

)([ 00

udtteTdt

tdeTteku

t

i

dp +++= (47)

where u is control input, pk is proportional gain, dT is derivative constant, iT is integration constant and )(te is

the error of the system. In order to facilitate the problem the discrete version of PID is used as in the following

,)]}1()([)()({)( 0

0

ukekeT

Tje

T

Tkekku d

k

ji

p +−−++= �=

(48)

in which T is the sampling time and the control input is obtain as

)]}.2()1(2)([)()]1()([)( −+−−++−−=∆ kekekeKkeKkekeKku dip (49)

To achieve the desired response, the best control gains should be found. There are some ways to

calculate the gains of the controller; in this project the following procedure is applied. First, the pK increased to

see alternative response, the half of that is picked as pK . Next, the iK increased to attain less error. Then the

dK factor increased to remove the overshoot.

Experimental results Point to point motion

In this section, the point )39.0,46.0,05.0(A is considered for start point and )58.0,07.0,52.0(B for end

point. The simulation time is selected 2.4 sec. since at start and end points the velocities of links are zero, the

states 127 ,..., xx are set as zero. Using the inverse kinematics equations the initial condition and desired values

are defined as

[ ] ,0314.0314.0314.0314.006.014.1)0( 61

Tx ×−= (50)

[ ] .0314.0314.0314.0314.006.014.0)4.2( 61

Tx ×−−−−−−=

(51)

Configuration of links during the motion and the trajectory of end effector are presented in Fig. 7. The variations of angles of links are presented in Fig. 8. The angular velocities of links are shown in Fig. 9 and the control inputs are shown in Figure 10.

Figure 7. Configuration of links and trajectory of 6R.

00.2

0.40.6

00.2

0.4

0

0.1

0.2

0.3

0.4

0.5

0.6

X (m)Y (m)

Z (

m)

Simulation Path

Actual Path

Start Point

End Point

Page 9: Hardware Implementation of a Closed Loop Controller on 6R …irjabs.com/files_site/paperlist/r_972_130703170117.pdf · 2013-07-03 · selective leakage protector based on advanced

Intl. Res. J. Appl. Basic. Sci. Vol., 4 (8), 2147-2158, 2013

2155

Figure 8. The variations of angles of links.

Figure 9. The angular velocities of links.

0 0.5 1 1.5 2-1

0

1

2

t (sec)

θ1 (

rad

)

0 0.5 1 1.5 2-1

0

1

t (sec)

θ3 (

rad

)

0 0.5 1 1.5 2-1

0

1

t (sec)

θ4 (

rad

)

0 0.5 1 1.5 2

-1

0

1

t (sec)

θ5 (

rad

)

0 0.5 1 1.5 2-1

0

1

t (sec)

θ6 (

rad

)

Simulation Path Actual Path Start Point End Point

0 0.5 1 1.5 2

-0.5

0

0.5

t (sec)

θ2 (

rad

)

0 0.5 1 1.5 2-1.5

-1

-0.5

0

t (sec)

ω1 (

rad

/s)

0 0.5 1 1.5 2-0.5

0

0.5

1

t (sec)

ω2 (

rad

/s)

0 0.5 1 1.5 2-1

-0.5

0

0.5

t (sec)

ω3 (

rad

/s)

0 0.5 1 1.5 2-10

-5

0

5

t (sec)

ω4 (

rad

/s)

0 0.5 1 1.5 2-1

-0.5

0

0.5

t (sec)

ω5 (

rad

/s)

0 0.5 1 1.5 2-1

-0.5

0

0.5

t (sec)

ω6 (

rad

/s)

Page 10: Hardware Implementation of a Closed Loop Controller on 6R …irjabs.com/files_site/paperlist/r_972_130703170117.pdf · 2013-07-03 · selective leakage protector based on advanced

Intl. Res. J. Appl. Basic. Sci. Vol., 4 (8), 2147-2158, 2013

2156

Figure 10. Control inputs of 6R.

Simulation result with PID can be improved in the sense of reducing the error and increasing the speed

of response. Since the limitations of motors do not allow any demand, the gains of the controller are selected in a way that the closest results to experimental ones are achieved. Continuous Motion In this section, the continuous motion is performed in a circular path. The time of simulation is selected

π2 and the desired path equations are presented in the following

,05.0)cos(46.0 += txe (52)

,1.0=ey

(53)

.05.0)cos(56.0 += tze (54)

Initial conditions are defined as

[ ] .002/6.08.03/0)0( 61

Tx ×−−= ππ

(55)

The variations of angles of links are presented in Fig. 11. The configuration of links during the motion and the trajectory of end effector are presented in Fig. 12.

0 0.5 1 1.5 2-200

0

200

400

t (sec)

τ 1 (

N.m

)

0 0.5 1 1.5 2-200

0

200

t (sec)

τ 2 (

N.m

)

0 0.5 1 1.5 2-500

0

500

1000

t (sec)

τ 3 (

N.m

)

0 0.5 1 1.5 2-20

0

20

t (sec)

τ 4 (

N.m

)

0 0.5 1 1.5 2-50

0

50

100

t (sec)

τ 5 (

N.m

)

0 0.5 1 1.5 2-50

0

50

100

t (sec)

τ 6 (

N.m

)

Page 11: Hardware Implementation of a Closed Loop Controller on 6R …irjabs.com/files_site/paperlist/r_972_130703170117.pdf · 2013-07-03 · selective leakage protector based on advanced

Intl. Res. J. Appl. Basic. Sci. Vol., 4 (8), 2147-2158, 2013

2157

Figure 11. The variations of angles of links.

Figure 12. Configuration of links and trajectory of 6R.

CONCLUSION

In this article, the PID method as a closed loop controller was implemented using ARM microcontroller. Two case studies were expressed: point to point motion and continuous trajectory tracking. The algorithm was applied on 6R manipulator and the details of the kinematics and state space representation of the robot were presented. In the hardware control system LPC1768 ARM Cortex M3 microcontroller was used. High speed computation ability of this processor provides the situation for applying closed loop control algorithms in on-line

0 0.5 1 1.5 2-0.5

0

0.5

1

t (sec)

θ1 (

rad

)

0 0.5 1 1.5 2-1.5

-1

-0.5

t (sec)

θ2 (

rad

)

0 0.5 1 1.5 20

1

2

3

t (sec)

θ3 (

rad

)

0 0.5 1 1.5 2-1

0

1

t (sec)

θ4 (

rad

)

0 0.5 1 1.5 2-1.8

-1.6

-1.4

t (sec)

θ5 (

rad

)

0 0.5 1 1.5 2-0.5

0

0.5

t (sec)

θ6 (

rad

)

Actual Path Simulation Path

00.2

0.40.6

0.8

-0.1

0

0.1

0.2

0.30

0.1

0.2

0.3

0.4

0.5

0.6

0.7

X (m)Y (m)

Z (

m)

Actual Path

Simulation Path

Page 12: Hardware Implementation of a Closed Loop Controller on 6R …irjabs.com/files_site/paperlist/r_972_130703170117.pdf · 2013-07-03 · selective leakage protector based on advanced

Intl. Res. J. Appl. Basic. Sci. Vol., 4 (8), 2147-2158, 2013

2158

form for driving six motors of the arm simultaneously. The mentioned capabilities and the send and receive information option in this board improved the control structure of 6R, respect to previous open loop control board. The new hardware does not have any limitation for obtaining more accuracy in position control; and the reasons for the errors in the results were incompatibility of motors, the clearance of gear boxes and nonlinearities in potentiometers. These limitations can be fixed by using encoders and changing some of the motors.

REFERENCES

Ahmadi R, Korayem MH, Jaafari N, Jamali Y, Kiomarsi M, Habibnejad A. 2009. Design, Modeling, Implementation and Experimental

Analysis of 6R Robot. International Journal of Engineering Science 21 (1): 71-84. Doosthoseini M, Korayem MH, Shafei AM, Kadkhodaei B. 2012. An experimental interface design for a single-link elastic manipulator

system. International Research Journal of Applied and Basic Sciences 3 (8): 1726-1734. Gao B. et al. 2010. Development of an infrared ray controlled fish-like underwater microrobot. IEEE International Conference on

Automation and Logistics, ICAL 2010, art. No. 5585399, p 150-155. Gouaillier D. et a., 2009. Mechatronic design of NAO humanoid, Robotics and Automation. IEEE International Conference on ICRA'09, p

769-774. Hamraz NJ, Korayem MH, Jamali Y, Kiumarsi M, Asadi MA, Rezaei S, Sohrabi A.2005. Design, Manufacturing and Performance Testing of

3R Manipulator. International Congress on Manufacturing Engineering, Tehran, December, 2005. Han SH, Hashimoto H. 2005. A robust real time adaptive controller design for robot manipulator with eight-joints based on DSPs. Journal of

Mechanical Science and Technology 19 (1): 1-14. Jamali Y, Korayem MH, Hamraz NJ, Sohrabi AM, Kiomarsi M, Asadi MA, Reazaee S.2005.Design & Manufacturing a Robot Wrist:

Performance Analysis. International Congress on Manufacturing Engineering, Tehran, December, 2005. Jung S, Kim SS. 2007. Hardware implementation of a real-time neural network controller with a DSP and an FPGA for nonlinear systems.

IEEE Transactions on Industrial Electronics 54 (1): 265-271. Korayem MH, Heidari FS. 2009. Simulation and experiments for a vision-based control of a 6R robot. Int. J. Adv. Manufacturing Technol.,

41(3-4): 367-385. Korayem MH, Irani M, Rafee Nekoo S. 2010. Analysis of manipulators using SDRE: A closed loop nonlinear optimal control approach.

Scientia Iranica, 17 (6 B): 456-467. LeGrand R. et al. 2005. The XBC: a modern low cost mobile robot controller. IEEE/RSJ International Conference on Intelligent Robots and

Systems, p 3896-3900. Li Y, Li S. 2012. Based on the ARM and PID control free pendulum balance system. Procedia Engineering 29: 3491-3495. Livingston D. 2007. A controller for robotics and microcontroller applications instruction. ASEE Annual Conference and Exposition,

Conference Proceedings. Ning K, Yang R. 2006. MAS based embedded control system design method and a robot development paradigm. Mechatronics 16 (6):

309-321. Reddy NM, Raju KN, Mouli CC, Reddy DC. 2012. Design and Implementation of Arm Cortex based Speed Control of DC Motor.

International Journal of Industrial Electronics and Control 4 (2): 53-60. Wiriya S, Distaklu N, Howimanporn S.2010.Speed Control System Design in Bicycle Robot by Low Power Method. The 2nd RMUTP

International Conference Green Technology and Productivity. p 195-201. Yang QC, Chen Y, Ye L. 2011. A New Design of Mine Selective Leakage Protector Based on Advanced RISC Machine Cortex-M3.

Procedia Engineering 15: 496-500. Yang. et al. 2009. Path-tracking controller design and implementation of a vision-based wheeled mobile robot. Proceedings of the

Institution of Mechanical Engineers. Part I: Journal of Systems and Control Engineering 223 (6), p 847-862.