You are on page 1of 5

ICCC 2013 • IEEE 9th International Conference on Computational Cybernetics • July 8-10, 2013 • Tihany, Hungary

Fuzzy Control of Robotic Arm


Implemented in PLC

Skulavik Tomas, Kopcek Michal, Kopcekova Alena


Institute of Applied Informatics, Automation and Mathematics
Slovak University of Technology in Bratislava,
Faculty of Materials Science and Technology,
Trnava, Slovak Republic
tomas.skulavik@stuba.sk, alena. kopcekova@stuba.sk, michal.kopcek@stuba.sk

Abstract— This article deals with a design of a fuzzy control to PLCs many software applications were developed by
system for robotic arm and its implementation to PLC. PLC manufacturers. Like other manufacturers, the
Fuzzy logic is used to calculate the proper speed of robot company SIEMENS offers the implementation of
tool center point depending on the tilt of the joystick handle intelligent control methods to PLCs. This is the software
in manual operating mode. In fully automatic mode the package FuzzyControl + +, using fuzzy methods and
fuzzy logic is used in form of a fuzzy PI controller to achieve fuzzy logic control and NeuroSystems package, based on
the desired velocity with the load compensation. Fuzzy the theory of artificial neural networks.
system was designed in the Siemes Fuzzy Control ++ and
was implemented to Simatic S7-300 PLC. II. MODEL OF A ROBOTIC ARM
Robotic arm from Fischertechnik is a manipulator
I. INTRODUCTION model with three degrees of freedom. Fig. 1 shows the
robotic arm with the cross-section of its workspace.
During the teaching of courses focused on
programmable logic controllers, the controlled processes
are not only simulated in software environment, but often
using the physical models (e.g. flexible production line,
pallet stacker, continuous stirred tank reactor). Some of
them need more sophisticated control algorithms (PI, PD,
PID) to achieve a desired speed, temperature or other
parameter. To use the algorithms from classic control
theory a mathematical model of the controlled system is
needed [1]. Sometimes is very difficult to describe the
system in this way. In another cases the mathematical Figure 1. Cross-section of the robotic arms workspace
model must not correspond with reality. For these reasons,
using a fuzzy logic in control algorithm may be useful. Anthropomorphic geometry is realized by three
The control of a robotic arm model represents a very good revolute joints. The anthropomorphic structure is the most
example. dexterous one, since all the joints are revolute [4]. On the
other hand, the correspondence between the degrees of
Information processing based on fuzzy logic is
freedom and the Cartesian space variables is lost, and
appropriate, often necessary, where processes are
wrist positioning accuracy varies inside the workspace.
specified by verbally expressed algorithms in the form of
The workspace is approximately a portion of a sphere and
"IF-THEN rules". For example, in complicated
its volume is large compared to manipulator encumbrance.
manufacturing processes it can be observed that operators
Fig. 2 shows the 3D model of the Fischertechnik robotic
take control actions on the basis of their experience using
arm and its 3D workspace.
simple if-then criteria ("If the temperature is high and the
pressure is medium, then I must open the valve halfway.")
and using this way, they often achieve good operation
with quality results. Fuzzy logic makes it possible to
transfer the "experience" of an expert to a computer and
obtain an initial and "automated" - though perhaps not yet
optimal - solution quickly [2].
Programmable logic controllers were mainly used in
standard automatic production. With the increase of
automation field not only the safety functions are
performed, but also the intelligent control is involved to
the process of automation. Many of PLC manufacturers Figure 2. 3D model of Fischertechnik robotic arm
produce so called safety PLC primarily designed to be
used in industrial safety relevant applications [3]. To
support the implementation of intelligent control methods

978-1-4799-0063-3/13/$31.00 ©2013 IEEE – 45 –


S. Tomas et al. • Fuzzy Control of Robotic Arm Implemented in PLC

Joints are actuated by electric motors with 9V DC manual mode. The rotation angle and the velocity of the
supply voltage and with 250 mA current consumption [5]. joints are controlled by the joystick handle. Fuzzy system
Two joints are connected with electric motors via screw was designed to control the velocity depending on the tilt
line. Third joint is connected to the actuator via cog- angle of the joystick handle. The designed fuzzy system is
wheel. Each screw line is permanently linked to the called Fuzzy Linex and performs a task of a transfer
coding wheel, which is a part of an incremental encoder function. In the automatic mode the desired velocity is set
(IRC), working on optical principle. Starting position of by the master control system and not with the joystick
all three joints is ensured with limit switches. The robotic handle as in the manual mode.
arm is equipped with a gripper driven by DC electric The input to the Fuzzy Linex is the tilt of the joystick
motor with 9V DC supply voltage and with 200 mA handle which is represented by voltage from 0 to 10V.
current consumption. Two limit switches are mounted on The fuzzy system compute the proper output signal, which
the gripper to identify the full opening and clamping of an is the desired velocity represented by voltage from 0 to
empty gripper. The third switch is located on the inner 10V. The joystick has two potentiometers and their wipers
edge of gripper and is used to identify the snapping of a are connected to handle. When the handle is tilted to the
manipulated object [5]. left or right, one of the potentiometers changes its value.
Model of the manipulator is controlled by When it is tilted to or apart, the second one changes its
programmable logic controller Siemens Simatic S7-300 value. With the same tilt (towards and apart) two of the
[6]. Motors and encoders can not be connected directly to robot joints are controlled, but not at the same time. The
signal modules. This is because of different supply joints are selected by the switch located on the top of the
voltages for motors and their relatively high current handle. That is the reason why the designed fuzzy system
consumption. Encoders have also different supply has only two inputs and two outputs (one input and output
voltages and they need some other electronic parts for is the same for two joints). The fuzzy system was
their proper functionality. Therefore was necessary to designed in the Fuzzy Control ++. Fig. 4 and Fig. 5 show
design an interface to connect the model to the Simatic’s the membership functions for the input 1 and input 2 of
signal modules. The design of interface and its connection the fuzzy controller. Inputs correspond to the tilt angle of
to Simatic S7-300 was described in more detail in [5]. the handle when it is moved to the left or right (Input 1)
and towards or apart (Input 2).
III. ROBOTIC ARM CONTROL SYSTEM
The control system (Fig. 3) for the above mentioned
robotic arm was implemented in Simatic S7-300 PLC with
CPU 315F-2 PN/DP [7].

Figure 4. Membership functions for the input 1

Figure 3. Robotic arm control system


Figure 5. Membership functions for the input 2
The basic operations – gripper function, motor direction
control, end positions recognition, etc, are controlled The potentiometers are connected to analog input of the
without fuzzy logic in the master control system. The PLC signal module. Voltages from 0 to 10 V are
master control system consists of the main program block represented by values from 0 to 32500. These are the
OB1 and remedy functions FC. These functions and minimum and maximum values for input 1. Membership
blocks have been implemented to the robot control system functions Left, Middle, Right for Input 1 and Up, Middle,
using the Simatic manager and Step7. The main control Down for Input 2 are the positions of the handle.
program was implemented in LAD. The fuzzy logic is
used not only in automatic mode, but also in manual Fig. 6 shows the membership functions for the output 1
mode, where the movement of the robot tool center point from the fuzzy controller.
is controlled with the joystick. It is possible to control all
the three joints and also the gripper with the joystick in the

– 46 –
ICCC 2013 • IEEE 9th International Conference on Computational Cybernetics • July 8-10, 2013 • Tihany, Hungary

Figure 6. Membership functions for the output 1


This output represents the driving voltages from 0V to Figure 8. Membership functions for the error input
10V for the joint motor. Membership functions are in the
form of singletons and represent the motor speed. Both
outputs have the same shape and boundaries of the
membership functions. Control rules of the fuzzy system
are as follows:

If Input1 is LEFT then Output 1 is FAST


If Input1 is MIDDLE then Output 1 is SLOW
If Input1 is RIGHT then Output 1 is FAST
If Input2 is UP then Output 2 is FAST
If Input2 is MIDDLE then Output 2 is SLOW Figure 9. Membership functions for the change of error input
If Input2 is DOWN then Output 2 is FAST
The inputs and outputs that correspond to the other
motors of the robotic arm, which are controlled by the
With the membership functions and rules mentioned fuzzy system, are designed in the same way.
above, the control system is able to change the velocity of
the individual joints according to the tilt of the joystick Fig. 10 shows the membership functions for the output
handle. The above mentioned fuzzy system computes the that corresponds to the control signal.
velocity depending on the tilt of the handle. The system
itself has no prove that the tool center point is moving
with the desired speed. The speed may vary upon a mass
that the robotic arm carries or upon the contradictions in
robots gearing. The compensation of the bigger speed
fluctuations should be done by a proper tilt of the joystick
handle in manual mode. In automatic mode was this type
of compensation not possible. To ensure that the motors
have the desired velocity independently on the mass held
by the gripper, another fuzzy controller was designed.
Control loop with the fuzzy PI controller is shown in Figure 10. Membership functions for the output
Fig. 7.
By the introduction of a new inputs and new
membership functions, the rule base of the fuzzy system
must have been redesigned too. The fuzzy rules for
calculating the value of the output 1 are as follows:

If Error is N and Change of error is N then Output is N


If Error is Z and Change of error is N then Output is N
If Error is P and Change of error is N then Output is Z
If Error is N and Change of error is Z then Output is P
Figure 7. Robot control system with mass compensation If Error is Z and Change of error is Z then Output is Z
If Error is P and Change of error is Z then Output is N
Signals from the incremental counters (IRCs) from If Error is N and Change of error is P then Output is Z
every joint are used to calculate the real velocity of the
motors. The IRCs signals were used just to detect the If Error is Z and Change of error is P then Output is P
current position of the tool center point in manual mode. If Error is P and Change of error is P then Output is P
In the automatic mode the master system calculates the
error and change of error from IRC signals. Fig. 8 and
Fig 9 show the membership functions for the error input
and change of error input.

– 47 –
S. Tomas et al. • Fuzzy Control of Robotic Arm Implemented in PLC

IV. RESULTS to slow down (frequency of the pulses are lower) because
of the higher load (without the change of desired speed).
Above mentioned features of the control system were
tested on the model of robotic arm from Fischertechnik.
First experiment which has been done on the control
system was oriented to test the manual mode of the robot
control. Fig. 11 shows dependence of the calculated
velocity of the joints upon a tilt of the joystick handle. The
above mentioned figure was print screened from Curve
Plotter which is a part of the Fuzzy Contol ++. Curve
Plotter plots the actual waveforms of selected input and
output signals from the fuzzy system.

Figure 12. Voltage (blue) signal and IRC signal (red) from motor,
controlled by the fuzzy system without the mass compensation

Fig. 13 shows the voltage of the motor (channel A –


blue signal) and a signal from the corresponding IRC
(channel B – red signal).

Figure 11. Dependency of the calculated control voltage (yellow,


cyan) of the joint upon a tilt (blue, purple) of the joystick handle
Figure 13. Voltage (blue) signal and IRC signal (red) from motor,
By the up and down tilt of the joystick handle the controlled by the fuzzy system with the mass compensation
movement of the joint motor M1 or M2 is controlled. As it
was mentioned earlier the controlled motor is selected by The signals were measured on the robotic arm
the switch located on the top of the joystick handle. controlled by the fuzzy system with the mass
Yellow waveform represents the calculated control compensation. When the motor starts to slow down
voltage which is supplied to the selected motor. The blue (because of the higher load, without the change of desired
waveform represents the tilt towards and apart of the speed), the voltage start to raise, until the motor reach the
joystick handle. Towards tilt is represented by the analog desired velocity. After the motor runs by the desired speed
values less than 8000 and the apart tilt is represented by (Fig. 14) the voltage will remain stable.
the analog values above 10712. Fuzzy system was
designed with the dead band in the area of joystick default
position to avoid the unwanted reactions to the handle
vibrations. Control voltage of the motor M3 is represented
by the cyan waveform. The tilt left and right of the
joystick handle is represented by the purple waveform.
Left tilt is represented by the analog values less than 7900.
Right tilt is represented by the analog values above 11500.
To rotate the joints motors the analog value of control
voltage of approximately 8000 is needed. This analog
value is only for the no-load operation. With the increase
of load the analog value of the control voltage must be
higher.
In Fig. 12 the voltage of the motor (channel A) and a
signal from the corresponding IRC (channel B) are shown. Figure 14. Voltage (blue) signal and IRC signal (red) from motor,
controlled by the fuzzy system with the mass compensation
These signals were measured by an oscilloscope on the
joint of the robotic arm controlled by the fuzzy system
without the mass compensation. It can be seen, that the When the motor stops, the voltage rise for a small
supply voltage on the motor (which correspond to the period of time and than it quickly falls to its minimum.
desired velocity) is constant all the time the motor started This ensures that the motor will not be damaged by

– 48 –
ICCC 2013 • IEEE 9th International Conference on Computational Cybernetics • July 8-10, 2013 • Tihany, Hungary

overloading. This last feature is provided by the master [2] SIEMENS AG “FuzzyControl++ V. 5.0 User`s manual,“ Siemens
control system. AG, I&S IT PS 213, Erlangen 2003.
[3] K. RÁSTOČNÝ, J. ŽDÁNSKY, “Specificities of safety PLC
based implementation of the safety functions,” Proceedings of
V. CONCLUSION International Conference Applied Electronics 2012, Pilsen, ISBN
This paper shows the advantages of using the fuzzy 978-80-261-0038-6, ISSN 1803-7232, IEEE Catalog Number:
logic when the mathematical model of the controlled CFP1269A-PRT, p. 229-232, 5-7 September 2012.
system is not available. It has been shown that fuzzy [4] B. Siciliano, L. Sciavicco, L. Villani, and G. Oriolo, “Robotics
Modeling, Planning and Control,” Springer, London, 2009.
control can be implemented in PLC Simatic S7-300 with
the help of Fuzzy Control++. From the measured [5] T. Skulavik, and P. Schreiber, “Interface for an robotic arm from
Fischertechnik and Simatic S7-300,” International Doctoral
characteristics can be seen that the designed fuzzy control Seminar, Smolenice Castle, SR, 15–17 May 2011, pp 400–405,
system meets the required criteria (mass compensation AlumniPress Trnava, 2011.
both in manual and automatic mode), which are often used [6] M. Kopček, G. Križanová, “Models used for PID controller and
as the requirements for the robotic arm control systems. It PLC programming teaching,”. Proceedings of the 8th International
is obvious that fuzzy control and PLCs together may be Scientific-Technical Conference. Kouty nad Desnou, Czech
successfully used in other control applications too. Republic, June 9-12, 2008. - Pardubice : University of Pardubice,
2008. - ISBN 978-80-7395-077-4
[7] M. Strémy, “Combined Discrete Control Systems,”. Ilmenau
Universitätsverlag Ilmenau, 2012. Scientific Monographs in
REFERENCES Automation and Computer Science; - ISBN 978-3-86360-014-3
[1] L. F. Lewis, M. D. Dawson, and T. C. Abdallah, “Robot .
Manipulator Control: Theory and Practice,” Marcel Dekker, Inc.
New York, 2004.

– 49 –

You might also like