pid pick&place robot
TRANSCRIPT
-
8/7/2019 PID Pick&Place robot
1/7
The Implementation of PID Controller in the Pick and Place
Robot
H. Ferdinando, H. Wicaksono and R. WibowoDept. of Electrical Engineering, Petra Christian University, Indonesia
Abstract A control system for pick and place robot
is implemented. The control algorithm uses the PID
(Proportional-Integral-Derivative). The system 3-DOF
robot with specific task, i.e. to pick certain a letter
blocks and places it to the desired location. The robot
is controlled with the AT89S51 microcontroller. The
command for the specific letter blocks comes from a
computer. The computer and the AT89S51 are
connected via RS-232. The time sampling of the system
is 5ms. After tuning the PIDs constants, the ratio of
the constant for P, I and D is 20:0.1:34. The
experiments show that the rise time of the system is1.41s; the settling time is 4.03s and the maximum
overshoot is 1.62%. It is recommended that the
constant for Proportional controller is between 2 and
70, the greater the constant the longer the rise time.
Big value of the constant also contributes to the
number of oscillation. For the Integral controller, it is
10 and 50, the greater the constant the more the
oscillation occurred. This makes the motor run
abruptly.
Keywords PID, pick and place robot, AT89S51
I.II. INTRODUCTION
The PID (Proportional-Integral-Derivative) controller
is the most popular control algorithm in industries. The
power of this controller lies on the simplicity of the
control algorithm. Although there are many new control
algorithms developed nowadays, this controller still exists.
There are many applications of the PID controller in
industries, e.g. robotic arm, conveyor, heating process,
etc. The goal is one, i.e. to reach the setting point fast with
small overshoot.
This paper discusses the role of the PID controller in
controlling pick and place robotic arm. The robot will pick
certain block of letter and then place it in the desired
place. The control algorithm is applied to the movementof the main body. The controller is the AT89S51
microcontroller. It receives command from computer via
RS-232. The final goal is to get system with fast rise time,
fast settling time and minimum overshoot.
This paper is organized as follow; the first section
gives introduction to the project. The PID controller is
discussed briefly on the next section. For those who do not
familiar with pick and place robot can read the following
section, then it comes the design of the system for
mechanics, hardware and software part. It continues with
experiment for the system and conclusion closes this
paper.
III. THE PID CONTROLLER BRIEF INTRODUCTIONThe PID controller combines three control algorithms,
i.e. Proportional, Integral and Derivative controllers. Each
controller has its own constant to adjust the output of the
controller based on the error signal. Each controller hasdifferent contribution to the response of the system.
To get a good PID controller system, one must tune
the constants. Although it seems independent, the
constants do not. This gives complexity in tuning them.
The tune process, however, can be done via several
algorithms such as Ziegler-Nichols, Cohen-Coen, etc [1].
Each algorithm has its own advantages and disadvantages.
The power of the PID controller lies on its simplicity.
One only set three constants in order to get good response.
It is simple for the number of parameter is only three.
Besides, it can be implemented without digital controller.
One can make the PID controller with Operational
Amplifier and several passive components. Off course this
kind of PID controller has limited capabilities, but one canuse it to control simple system.
The more complex PID controller uses digital
controller such as microcontroller, PC (personal
computer) or PLC (programmable logic controller). These
equipments give better PID controller but with higher
cost. The chosen controller is based on the complexity of
the plant.
IV. PICK AND PLACE ROBOTA pick and place robot is a material handling robot that
can work 24 hours a day without worries or fatigue [2].
This robot is a common robot in industries. The task is topick some object and place it in the desired place.
When it is controlled, then the position control is the
main issue. It must be controlled such that the robot can
pick the object at certain place accurately and place it at
the desired place accurately as well. It is the role of the
controller to achieve this goal. One can use many
algorithms to achieve it but the goal is one, i.e. to pick and
place object accurately, fast and with small overshoot.
-
8/7/2019 PID Pick&Place robot
2/7
The application of the pick and place robot is in
assembling production process, for example. Here, the
robot must pick certain part and place it to the specific
place. The assembling process of the cassette uses this
robot.
Another application is insert machine for the electronic
printed circuit board (pcb). Here, the robot picks the
component, inserts it to the hole, cuts the lead and bendsit. The insert machine can finish the whole component in a
pcb fast, compare to the human.
V. MECHANICS DESIGNThe mechanic design is based on figure 1. The primary
and secondary arms can rotate 300o
and the gripper can
move up and down (see figure 2).
Fig. 1. Mechanic diagram of the robot
Fig. 2. How the robot move
The robot is supported by a main body. The main body
has base plate. On the base plate the letter blocks are
placed. Figure 3 shows the whole base plate from top. The
letter block is picked one by one and placed at the desired
place
Fig. 3. Base place (top view)
VI. HARDWARE DESIGNFigure 4 shows the block diagram of the system. The
system uses several additional circuits. They are discussed
in this section.
Fig. 4. Block diagram of the system
The position sensor for the system is a potentiometer.
It is a linear ten turn potentiometer. The PID controller is
implemented in a microcontroller MCS-51 family, i.e.
AT89S51 [3]. The number of position sensors is two, one
for the primary arm and the other for the secondary arm.
The gripper uses two limit switches. Figure 1 shows the
position of the potentiometer (close to the motor 1 and 2)
To read the current position, the AT89S51 needs A/D
converter. The ADC0809 is used. The signals, however,cannot be read directly for the signal range does not match
to the range of the ADC0809 [4]. For this reason, an
additional circuit is used. It is called zero and span circuit.
The arms must be able to turn CW and CCW. For this
purpose, an H-bridge is used to drive the motors. The H-
bride uses LM298N [5]. This chip can provide current up
to 3A.
AT89S51PC
ADC0809 Potentiometer1
Potentiometer2
Limit switches
DAC0808
Comparator
Triangle wave
generator
H-bridge
RS-232
2
1
3
letter
place/slot
arm
gear box
main body
motor 1
primary
armmotor 2
secondary
arm
motor 3
-
8/7/2019 PID Pick&Place robot
3/7
The movement of the arms must be able to be
controlled. It means when the current position is far from
the desired position, then the arm must move fast, and
vice versa. For the motor is DC motor, it needs to control
the voltage drop at the motor terminal. This leads to the
PWM (Pulse Width Modulation) system.
The PWM circuit using a simple triangle wave
generator, an input reference signal and a comparator. Thecomparator will give output either HIGH or LOW
according to the status of both inputs. The input reference
signal is produced by the AT89S51 via DAC0808. For the
output of the DAC0808 is current [6], then the current to
voltage converter is used. The DAC0808 gets data from
the AT89S51. Figure 5 shows the simplified PWM circuit.
The frequency of the PWM signal is 1kHz. This frequency
depends on the frequency of the triangle wave. This value
is chosen for the motor will turn abruptly in low frequency
of PWM.
Fig. 5. Simplified PWM circuit
VII. SOFTWARE DESIGNThe software in the AT89S51 is written in C [7] for
the computation uses floating point number. To use
assembly language can lengthen the development time.
The AT89S51 receives command from a computer. User
inputs the command using the HyperTerminal. The
command is simply one letter. It means the robot must
pick that letter and place it at the pre-set place.
The robot moves its arm one by one instead of
simultaneously. This makes the implementation simple.
A. Time SamplingThe control algorithm uses PID. For this purpose, there
are three constants for the controller. It also needs a time
sampling in the computation. The time sampling is 20ms.
It is assumed that the motor has slow response for the load
is big.
The AT89S51 must be set such that it will repeat a
bunch of task every 20ms. The interrupt timer is used for
this purpose. Those tasks are reading the current position
of the primary arm, compare it with the desired position
from PC (via RS-232), calculate the PID control action
and drive the robot. When there is time remaining, then
the system is idle, waiting for the next interrupt timer.
Figure 6 shows the part of interrupt timer routine.
void InitCounter(void){
Counter=0;
EA=0; // disable all interrupts
TH0=256-18;// TL0 = 238
TMOD=0x22; // chose mode 2 setiap timer
PT0=1; // bit prioritas timer0ET0=1; // enable interrupt of timer0
TR0=1; // start timer
EA=1; // enable all interrupts
}
void Counter_Bit() interrupt 1 using 1 {
Counter++;
if (Counter==0){
SamplingPID=1;
}
}
Fig. 6. Part of interrupt timer routine
The flag SamplingPID guards the main program such
that when the time is come, then the PID process will run.As soon as the process starts, then this flag will be cleared.
This makes the main program waits until the next time
sampling.
B. PID ControllerThe constants of PID parameter could have floating
point value. For this reason, the implementation uses C
language.
To make the system simple and easy for modification, the
constants are floating point. Figure 7 shows the PID
controller implementation in the AT89S51.
void CalCulatePID(void){YN1=Y;
ErrN2=ErrN1;
ErrN1=Err;
Err=SetPoint-CurPoint;
T=0.005;
Y= YN1 + KP*(Err-ErrN1) + KI*Err*T +
((KD/T)*(Err+ErrN2-2*ErrN1));
if (Y>255) Y=255;
if (Y
-
8/7/2019 PID Pick&Place robot
4/7
(a)
(b)
(c)
(d)
Fig. 8. PWM signal for duty cycle (a) 25% (b) 50% (c) 75% (d) 100%
The experiments show that the duty cycles do not fit to
the design. For 25%, 50%, 75% and 100%, the
implementation results 25.34%, 50.23%, 75.57% and
99.53% respectively.
The problem of those deviations is that there is small
error in the frequency of the triangle wave. If the triangle
wave is 1 kHz exactly then the duty cycle of both design
and implementation will be the same. This deviation is not
major problem since the controller will compensate it. The
problem is how to find good combination of PIDs
constants which can compensate that deviation. Goodcompensation is shown when the system can reach the
goal of the design related to rise time, settling time and
maximum overshoot.
B. PID ControllerThe initial constant for PID controller in 20ms time
sampling is 2.3, 3.5 and 0.026 for P, I and D respectively.
Figure 9 shows the result.
Fig. 9. Response of the system
Rise time, settling time and maximum overshoot are
3.36s, 32.62s and 30% respectively. This result is not
good. The rise time must be small and so must the settling
time. The maximum overshoot is too big for control
position.
To change the constant to 2.3, 70 and 0.001 for P, I
and D respectively does not give better results. This
combination makes the oscillation continue forever.Figure 10 shows it.
Fig. 10. Bad combination of PID parameters
This combination should not be used for the settling
time is at infinity, although the rise time is good. The
system becomes unstable for the Derivative constant is too
small.
C. Sampling TimeThese results indicate that the PID constants must be
tuned in order to get good performance. It is also
interesting to see how the sampling time influences the
system. It uses the best combination of the PID controller.
Time Sampling 20ms: The PID constants are 9, 8.5 and0.026 for P, I and D respectively. Figure 11 shows the
result. The orise time is 2.98s with settling time and
maximum overshoot are 6.28s and 0.9%. The result is
better than that of figure 9. But the rise time, however, is
still not satisfying. Also the settling time is considered
slow.
Kp=9 Ki=8.5 Kd=0.026
0
20
40
60
80
100
120
0 2 4 6 8 10 12 14 16
Fig. 11. One of response system with sampling time 20ms
From many experiments later, it is difficult to find
good combination of PIDs parameter in order to haveTime (s)
AD
Cvalue
ADCvalue
Time (s)
Time (s)
ADCvalue
-
8/7/2019 PID Pick&Place robot
5/7
good performance. The hypothesis is that the sampling
time is too slow. With sampling time 20ms, the system
gets control action every 20ms. This makes the system
cannot response as fast as possible. Therefore, to choose
20ms as sampling time is not good. It is necessary to use
smaller sampling time.
Time Sampling 5ms: from the previous sub-section, thenew sampling time is 5ms. 5ms is chosen for the motor is
loaded with its arm. The arm is little bit heavy. So 5ms is
enough to get better performance.
The PID constants are 15, 10 and 0.1. Figure 12 shows
the result.
Kp=15 Ki=10 Kd=0.1
0
20
40
60
80
100
120
140
0 1 2 3 4 5 6 7 8
Fig. 12. Response of the system with sampling time 5ms; Kp=15, Ki=10and Kd=0.1
The rise time is 2.43s, the settling time is 5.82s and the
maximum overshoot is 2.43%. The result is better
compare to the previous sub-section. But it is still
important to improve its performance.
Figure 13 shows another experiment with different
combination of the PIDs parameter. The chosen
parameters are 20, 34, 0.1. The rise time of the system is
1.41s with settling time 4.03s and maximum overshoot
1.62%. The performance of the system is improved again.
Although the PIDs parameters seem independent,they do not. This makes the tuning process more difficult.
Kp=20 Ki=34 Kd=0.1
0
20
40
60
80
100
120
140
0 1 2 3 4 5 6
Fig. 13. Response of the system with sampling time 5ms; Kp=20, Ki=34
and Kd=0.1
D. PIDs Parameters ExplorationIt is necessary to explore the PIDs parameters on this
robot. The purpose of this experiment is to get some
insight about the PIDs parameters in the pick and place
robot.
One parameter will be varied while the other two
parameters are constant. The sampling time is 2ms.
Proportional Parameter: the starting point of this
experiment is the result from figure 13. The I and D
parameters are 34 and 0.1 respectively with variation in Pparameter.
Figure 14 shows the result of this variation. The
experiment shows that the smaller the value of P
parameter, the better the rise time. It is shown that the rise
time is better than Kp=20 with sampling time 5ms, it is
around 0.4s. The settling time is also improved, i.e.
around 0.5s.
0
20
40
60
80
100
120
140
0 500 1000 1500 2000 2500 3000
Fig. 14. Result of the P parameter variation (black: Kp=2, white: Kp=35,
grey: Kp=70)
Integral Parameter: the starting point of this experiment
is the result from figure 13. The P and D parameters are
20 and 0.1 respectively with variation in I parameter.
Figure 15 shows the result of this variation. From rise
time point of view, the system with big I parameter has
fast response. Small value needs longer time to reach the
setting point.
0
20
40
60
80
100
120
140
0 500 1000 1500 2000 2500 3000
Fig. 15. Result of the I parameter variation (dark grey: Ki=10, white:
Ki=20, light grey: Ki=50)
Derivative Parameter: the starting point of this
experiment is the result from figure 13. The P and Iparameters are 20 and 34 respectively with variation in D
parameter.
Figure 16 shows the result of this variation. The plot of
the response for several experiments is difficult to see.
The responses are almost the same, except that the D
parameter cannot be greater than 1. With D parameter is
equal to 1; the response has large steady-state error.
Time (s)
ADCvalu
e
Time (s)
ADCvalue
Time (ms)
ADCva
lue
Time (ms)
ADCvalue
-
8/7/2019 PID Pick&Place robot
6/7
0
20
40
60
80
100
120
140
160
180
0 500 1000 1500 2000 2500
Fig. 16. Result of the D parameter variation
E. Overall ResponseAfter all explorations of the PID parameter, it is
necessary to see the overall response of the system. For
the robot is positioned to pick and place a letter block, the
experiments is about the performance of the robot to pick
the letter block for each letter only.
The initial position is between 5th and 6th slots in the
base plate (see figure 3). The slot is a place where the
letter block is placed. The primary arm will move to the
target letter and the performance is measured. The
performance of the system is represented by rise time (0-
90%), settling time (5%) and maximum overshoot.
Time Sampling 20ms: Table 1 shows the summary of
this experiment with time sampling 20ms. The PID
parameters are from sub-section 7.3.1, i.e. Kp=9, Ki=8.5
and Kd=0.024.
From table 1, it shown that the further the letter, the
longer the rise time. But this is not always the case. A and
Z as the furthest letter do not have the largest rise time.
The largest rise time for the left hand side is for letter
B. If letter B is omitted, then the rise time is increasing
from letter M to A. This is the desired situation. The
anomaly of rise time for letter B could be due to the
mechanic, since the mechanic is not balance.
The maximum overshoot of the system for the left
hand side is also varied. Letter M has the largest value.
This is due to its position. To set the P parameter smaller
will solve this problem but the rest of the letter will have
bad performance.
For the settling time, there is no specific information,
except that the settling time for letters between J and D
has small value.
The rise time for the right hand side letters is wore
than the left hand side is. Here, the rise time changes
abruptly from letter to letter. The stability of the mechanicgives its contribution for this problem.
The maximum overshoot is interesting. The value is
large for the letter close to the initial point. To reduce the
P parameter value will solve this problem but the overall
performance will be bad.
The settling time for the right hand side seems random.
There is no specific pattern.
TABLE 1PERFORMANCE OF THE SYSTEM FOR EACH LETTER WITH TIME
SAMPLING 20ms
Letter
position
Rise Time
(s)
Max. Over Shoot
(%)
Settling Time
(s)
A 2.92 0.00 3.90
B 3.14 0.00 10.96
C 3.02 2.83 38.10
D 2.86 3.01 11.62
E 2.84 1.06 7.46
F 2.68 0.00 3.92
G 2.48 0.00 3.12
H 2.50 0.00 2.90
I 2.46 0.00 2.94
J 2.31 14.54 21.36
K 2.24 6.38 12.14
L 2.22 0.27 6.36
M 2.04 21.21 30.72
N 3.3 21.92 39.40
O 2.14 27.61 20.66
P 2.24 7.40 9.32Q 3.66 10.00 17.6
R 2.54 19.69 16.84
S 2.64 10.81 7.1
T 2.66 3.33 6.50
U 4.20 8.51 6.80
V 2.44 4.25 10.34
W 4.26 14.00 27.42
X 3.22 4.67 6.80
Y 3.24 7.01 15.22
Z 3.56 4.13 26.86
Time Sampling 5ms: Table 2 shows the summary of this
experiment with time sampling 5ms. The PID parameters
are from sub-section 7.3.2, figure 13, i.e. Kp=20, Ki=34and Kd=0.1
The overall performance is better than the previous
experiment. From the experiments, it was known that
sampling time 5ms has better performance than that of
with sampling time 20ms.
Here the rise time for both sides seems random, i.e.
there is no specific pattern. But the largest rise time for the
left hand side is still letter M. The rise time for the right
hand side has almost the same pattern as in the sub-section
7.5.1.
That phenomenon is also happened for the maximum
overshoot and the settling time. This makes the analysis
about mechanic instability must be considered.
IX. CONCLUSIONS The time sampling of the system determines the
performance of the system. Choosing suitable
time sampling makes the tuning process easier.
The comparison between 20ms and 5ms shows
that time sampling 5ms is better than the other.
Time (ms)
ADCvalu
e
-
8/7/2019 PID Pick&Place robot
7/7
TABLE 2PERFORMANCE OF THE SYSTEM FOR EACH LETTER WITH TIME
SAMPLING 5ms
Letter
position
Rise
Time
(s)
Max. Over
Shoot
(%)
Settling Time
(s)
A 1.62 0.83 8.05
B 1.76 0.00 2.43
C 1.70 4.71 4.90
D 1.64 0.00 3.99
E 1.67 0.00 8.00
F 1.62 0.00 2.22
G 1.86 9.21 5.31
H 1.58 1.42 8.37
I 1.44 1.58 5.41
J 1.79 14.5 1.49
K 1.24 0.00 1.37
L 1.59 17.5 2.96
M 1.89 30.3 9.59
N 1.74 0.00 2.45O 1.46 14.8 6.46
P 2.05 3.70 3.36
Q 1.43 10.0 2.80
R 1.40 0.00 5.61
S 1.40 10.8 78.20
T 1.91 12.5 44.20
U 1.20 0.00 11.55
V 1.43 1.06 37.65
W 1.58 30.0 24.51
X 1.42 6.48 11.05
Y 1.33 8.77 10.69
Z 1.41 5.78 16.16
Different time sampling has different PIDparameter combination. So, to change the time
sampling means to tune the combination of the
PID parameters.
The mechanic gives contribution due to itsstability. Small instability can be compensated by
the controller but it is difficult to compensate the
large instability.
Large P parameter value makes the system haslarge rise time. This is interesting for many
literatures state that large P parameter value will
give small rise time [1]
The I parameter value must be large in order toget smaller settling time. I parameter contributesto the elimination of the steady-state error.
The D parameter value does not have biginfluence, except that the value must be smaller
than 1.
The combination of PID parameters for timesampling 5ms is Kp=20, Ki=34 and Kd=0.1.
REFERENCES
[1] Katsuhiko Ogata. Modern Control Engineering 5th ed. Prentice-Hall Inc.
[2] Pick and Place Robot Work Cell [http://www.robots.com/pick-and-place-robot.htm]
[3] Atmel Corporation. AT89S51 Datasheet. January 3, 2005[http://www.atmel.com/dyn/resources/prod_documents/doc2487.p
df][4] NationalCorporation.ADC0809 Datasheet. October 18, 1999
[http://www.national.com/ds.cgi/ad/adc0808.pdf]
[5] L298 Datasheet. Italy: StMicroelectronics. October 6, 2000[6] National Corporation. DAC0808 Datasheet. January 3, 2005
[http://www.national.com/ds.cgi/da/dac0808.pdf]
[7] Hartanto, Budi. Pembuatan Program C, Yogyakarta: ANDI, 2003