Professional Documents
Culture Documents
Abstract— PID (Proportional – Integral - Derivative) performance a sine micro stepping driver system model of
controllers are the most widely used closed loop controllers due stepper motor is introduced. Different types of digital PID
to their simplicity, robustness, effectiveness and applicability for algorithm based on parallel, serial and mixed architecture is
much kind of systems. With the rapid development of technology, implemented and simulated in [5]. The structure proposed in
implementation of PID controller has gone several steps from [6] is based on a distributed arithmetic algorithm where, a
using analog components in hardware to using some software- Look-Up-Table mechanism inside the FPGA is utilized and in
based program to execute PID instructions digitally in some [7] System on a Programmable Chip (SOPC)-based PID
processor-based systems. And also, these developments have controller Intellectual Property (IP) core is implemented on
brought an alternative solution to implement PID instructions in
FPGA using hardware description language.
Programmable Logic Devices (PLD). Field Programmable Logic
Array (FPGA) is the most advanced members of PLDs. This For a low voltage synchronous buck converter, FPGA
paper presents the digital PID algorithm on FPGA. The based PID controller is designed and implemented in [8]. And
controller algorithm is developed using VHDL and implemented also, FPGA has been used in motion control systems which are
using Altera DE0 Nano Board. As the controlled system, five axis employed all sort of robotic applications, such as in [9] and
robot arm is selected, which have five dc motor and four [10], a technique has been adopted for the generation of the
potentiometer to determine the positions of motors. The results control input for controlling the DC motor driver circuit and
show that digital PID controller and also multi-feedback control decoding the optical encoder data for using it for speed
systems can be implemented successively using FPGA devices.
feedback in the PID control loop. In [11], an FPGA controller
Keywords—fpga, digital pid, pwm, vhdl, robot arm
is designed and programmed to control the speed of the
permanent magnet DC motor of a portable dough mixing
machine, using digital PID algorithm with PWM signals. In
I. INTRODUCTION
[12], a simple approach for designing a fractional order FPGA
The new and effective theories and design methodologies based PI controller for controlling the speed of a DC motor is
are being continually developed in the automatic control field, presented and in [13], for multi-axis systems a high
however, Proportional – Integral – Derivative (PID) controllers performance PID IP core controller is described. In [14] the
are still the most widely adopted controllers in industry. Owing design and implementation of a fuzzy-control based speed
to the advantage of simple structure, good stability, reliable control IC for permanent magnet synchronous motor is
operation, robustness and effectiveness, the PID controllers are presented, with Simulink/Modelsim co-simulation and FPGA
properly used in different areas such as aerospace, process realization. And also robotic control applications are one of the
control, manufacturing, robotic, automation, transportation most recent targeted fields covered by FPGA. For a three
systems and real time multi tasking applications. degree-of-freedom (DOF) wafer-handling robot, three current
The implementation of PID control has same evolutionary vector controllers, three position/speed controllers and one
stages from the early mechanical and pneumatic designs to trajectory planning are implemented in a single FPGA chip
software based microcontroller systems. But these systems [15]. For a modular reconfigurable robot controller is proposed
encounter some difficulties such as overloading or computing which based on the Advanced RISC Machine (ARM)
speed limits to implement the requirements of modern control processor and FPGA [16].
systems. Recently, Field Programmable Gate Arrays (FPGA) In this paper, the design and implementation of a FPGA-
has become alternative solution for the realization of digital based digital PID controller for a five axis robot arm is
control systems, particularly PID [1]. And some works about presented. The organization of this paper is as follows: In
how to implement PID controller using FPGA has begun to be section II, digital PID controller algorithm, five axis robot arm
published. In [2], the basic discrete PID equation and algorithm and FPGA development board are described, in section III, the
is given, and in addition to PID algorithm in [3], some implementation of analog input interface, digital PWM block
peripheral interfaces (analog to digital converter and digital to and digital PID block implemented in FPGA and the results are
Analog converter) are introduced, in [4], to verify the design discussed. In section IV, the conclusion of the work is given.
This project is supported by Yildiz Technical University Scientific
Research Projects Coordination Unit under rule 2012-04-04-YL02.
764
II.STRUCTURE OF CLOSED LOOP CONTROL SYSTEM u[k ] = K p e[k ] + ui [k − 1] + K i e[ k ] + K d (e[k ] − e[ k − 1]) (5)
The overall block diagram of the system is shown in Fig. 1. where K i is the integral gain, K d is the derivative gain, e[k]
is the current error signal, e[k-1] is the previous error signal
r[ k ] e[k ] u[k ] y (t ) and u[k] is the control signal, u[k-1]is the previous integral
control signal. The discrete PID algorithm given (5) is known
b[k ] as the absolute form or position form of PID algorithm [17].
765
To compare these signal values the mathematical model of
each joint is obtained for base, shoulder, elbow, and wrist
respectively and the results are shown in Fig. 7.
θ m (t)
θ 4 (s) 0.492
=
E4 (s) s(s + 30.9)
Fig. 3. The diagram of the motor and the mechanical load [20] θ3 (s) 0.8232
=
E3 (s) s (s+ 28.10)
θ m ( s) 1 /( Ra J m ) A (6)
= = θ 2 (s) 0.7374
E a (s) s[s + (1 J m )( Dm + ( K t K b Ra ))] s(s + B ) E2 (s)
=
s(s+ 24.55)
Fig. 5. The graphics for axis 1 and axis 2 (Channel 1: 5.00 V/Div, 50.0
ms/Div - Channel 2: 100.0 mV/Div Time/Div - 50.0 ms/Div)
766
motors position values as a voltage level and transmit these to B. Digital PWM Block
FPGA as s digital value, push button for reset the system and Pulse width modulation is a simple method of using
LEDs to see the same values about the program values. rectangular digital waveform to control an analog variable by
changing ON and OFF ratio or the output pulse in discrete time
III.IMPLEMENTATION domain. It is used in a variety of applications ranging from
In FPGA, three basic blocks are executed, which are communications to automatic control. In this application, pulse
Analog Input Interface Block, Digital PWM Block and, Digital width modulation (PWM) block implemented within FPGA
PID Block. In this section, these blocks is introduced. The and adjusts on and off period of each terminal of the full H-
FPGA design is generally synchronous, that means that the bridges to control five DC motors at the robot axes.
design is clock based and each rising edge allows all the D-flip The total PWM period T can be stated as in (7) and where
flops to simultaneously take a new state. But, most of the Ton= ON time and Toff = OFF time.
designs need one more clock which works in a different
frequency. To solve this problem, there are some techniques
about clock domain crossing (CDC). In this design, a binary T = Ton + Toff (7)
counter is created (33 bits) triggered by 50 MHz main
oscillator clock and suitable divided bits are chosen for ADC, The output voltage is calculated as in (8), where Vout is the
digital PID and digital PWM blocks. average output voltage, Vin is the input voltage and D is the
duty cycle.
A. Analog Input Interface
The ADC performs the function of converting a
⎛ Ton ⎞
continuous-valued analog signal into a discrete-valued digital Vout = ⎜ ⎟Vin , Vout = DVin , (8)
signal. FPGAs are well suited for serial analog to digital ⎜T +T ⎟
⎝ on off ⎠
converters owing to serial interface consuming less
communication lines while the FPGA is fast enough to
The simplest digital PWM architecture, counter-based
accommodate to high speed serial data. The DE0Nano board
PWM, and can be easily implemented only by an n-bit counter
contains ADC120S02 analog to digital converter provides up to
and n-bit comparator shown in Fig. 11. The counter counts
8 channels of analog input and converts them into a 12-bit
each positive transit of reference clock and when the value of
digital signal [20]. ADC receives analog signals via the eight
counter is less than the digital settling code K, the output
analog inputs from IN0 to IN7. When performing a
(A<B) of the comparator remains high level state until the
conversation, the ADC reads the signal on one of these eight
content of the counter is large then K [21]. Therefore, this
input channels and converts it to a digital output. These eight
output will generate a pulse width corresponding to duty cycle
pins are part of 2x13 GPIO header. The ADC also has four
and a frequency.
wires connected to the FPGA and these wires are used to
control the ADC and allow communication between ADC and
the FPGA. ADC120S02 is a high speed, low power 12 bit
converter. In this study the first four channels of ADC is used
actively. The ADC is connected both the FPGA and the 2x13
GPIO header as shown in Fig 9.
767
four closed loop digital PID algorithm is executed so K d is set to zero. The parameters for each axes is given in
simultaneously in FPGA for control base, shoulder, elbow and Table I.
wrist motors.
In the loop, the first step is that the previous error signal TABLE I. PID PARAMETERS
e[k-1] and the total previous integral signal ui[k-1] is updated.
Axis 1 Axis 2 Axis 3 Axis 4
Then the present error e[k] is obtained to subtract reference
point from the output of the system. The reference and the Kp 40 50 60 130
output of the system are both 12 bits wide and the sign of the Ki 4 5 6 13
result is checked to see if the error is positive or negative. If
the error sign is positive or zero the sign bit is set to ‘0’, Below, the application results for a pick and place
otherwise is set to ‘1’. Then e[k], e[k-1] are multiplied by the experiment are given for each axis of robot. The reference
PID parameters. The sign bits of the multiplicands are found position is calculated by using Matlab and the real time motor
with XOR to get the sign bit of the products. With the multiple position is obtained by using Quanser Q2 data accusation
12 bit two signals, the result is found as 24 bits. After two board.
additions, the output of PID controller is found 26 bits. As a
result, 26 bits value is reduced to 12 bits duty cycle value. All 2.2
reference pos i ti on
of the values in PID control algorithm are binary. In the 2
real ti me motor pos i ti on for axi s 1
position (volt)
the algorithm is 20ms. The block diagram of the digital PID 1.8
1.4
0 10 20 30 40 50 60 70
time (seconds)
Kp Kd Ki
Fig. 13. Reference and real time motor position for axis1
Kd
1.7
position(Volt)
1.6
1.5
1.4
1.3
0 10 20 30 40 50 60 70
time (second)
the help of linear system model which obtained in Section II, 1.6
1.5
parameters, the overshoot for all robot axes are assumed to be
zero. However, theoretical studies show proportional control 1.4
satisfy, but in the real system owing to unmodelled nonlinear
1.3
disturbance and dead-zones requires integral control. In this
method at first K i and K d parameters are set to zero and the 1.2
768
International Conference on Instrumentation, Measurement, Computer,
2.05 reference position Communication and Control, 2011.
real time motor position for axis 4
[5] V. Subasri, K. Lavanya, and B. Umamaheswari, "Implementation of
2 digital PID controller in Field Programmable Gate Array
(FPGA)," Proceeding of the International Conference on Power
position (Volt)
1.95
Electronics (IICPE), 2006..
[6] Y. F. Chan, M. Moallem, and W. Wang, "Efficient implementation of
PID control algorithm using FPGA technolog,." Proceeding of the 43rd
1.9
IEEE Conference on Decision and Control (CDC), 2004.
[7] S. Yang, M. Gao, J. Lin and Z. Li, "The IP core design of PID controller
1.85 based on SOPC," Proceeding of the International Conference on
Intelligent Control and Information Processing (ICICIP), 2010.
1.8 [8] S. Chander, P. Agarwal, and I. Gupta, "FPGA-based PID controller for
0 10 20 30 40 50 60 70
time (second) DC-DC converter." Proceeding of the International Conference
on Power Electronics, Drives and Energy Systems (PEDES), 2010.
[9] S. Ghosh, R. K. Barai, S. Bhattarcharya, P. Bhattarcharya, S. Rudra, A.
Fig. 16. Reference and real time motor position for axis 4 Dutta, R. Peyne, "An FPGA based implementation of a flexible digital
PID controller for a motion control system." Proceeding of the
International Conference on Computer Communication and Informatics
Fig 13, 14, 15 and 16 show the trajectory of each robot axes (ICCCI), 2013.
against the reference trajectory, respectively. Four axis [10] B. Behnam and M. Mansouryar, "Modeling and simulation of a DC
controllers are executed simultaneously, with help of the motor control system with digital PID controller and encoder in FPGA
parallel nature of FPGA as they are seen in the results. The using Xilinx system generator." Proceeding of the International
Conference on Instrumentation Control and Automation (ICA), 2011.
axes keep tracking the reference trajectories without overshoot
[11] J. O. Inwelegbu and T. A. Nwodoh. "FPGA controller design and
except axis 4; small overshoots and steady-state errors are simulation of a portable dough mixing machine." Nigerian Journal of
caused by undesired noise and mechanical problems. Technology , vol: 30.1, 2011.
[12] C. I. Muresan, S. Folea, G. Mois, E. H. Dulf, "Development and
IV.CONCLUSIONS implementation of an FPGA based fractional order controller for a dc
motor," Mechatronics, vol: 23.7, pp. 798-804, 2013.
In this paper, FPGA-based digital parallel PID controller is
[13] A. Astarloa, J. LAzaro, U. Bidarte, J. Jimenez, A. Juloaga, "FPGA
designed and implemented for multi axes control systems. technology for multi-axis control systems," Mechatronics, vol.19.2 pp.
Altera DE0 Nano board is used to control five axes robotic arm 258-268, 2008
as a multi axes system. The digital PID block, digital PWM [14] Y. S. Kung, N. V. Quynh, N. T. Hieu, C. C. Huang, L. C. Huang,
block and Analog Input Interface block are successfully "Simulink/Modelsim Co-Simulation and FPGA Realization of Speed
designed on an FPGA to control the position of four motor Control IC for PMSM Drive." Procedia Engineering, vol. 23, pp. 718-
which is places in joint of robot. VHDL language is used for 727, 2011.
coding. The results demonstrate that FPGA can be shown as a [15] Y. S. Kung, C. T. Hsu, H. H. Chou, T. W. Tsui, "FPGA-realization of a
motion control IC for wafer-handling robot," Proceeding of the
flexible solution for multi axes systems. The digital PID International Conference on Industrial Informatics (INDIN), 2010.
controller is implemented on FPGA in some study seen in
[16] M. Xu, W. Zhu and Y. Zou. "Design of a reconfigurable robot controller
literature, but this paper shows that how to control a real based on fpga," Proceeding of the International Conference
model-unknown system with digital PID using FPGA. on Embedded Computing, 2008.
[17] M.Gopal, Digital Control & Stat War method 3E, Tata McGraw-Hill
REFERENCES Education, 2008
[18] Norman S. Nise, Control System Engineering, John Wiley & Sons,
California State Polytechnic University, Pomonai.
[1] B. V. Sreenivasappa and R. Y. Udaykumar, "Design and implementation [19] DE0 Nano User Manuel v:1.9. Available: http://www.terasic.com
of FPGA based low power digital PID controllers," Proceeding of the
International Conference on Industrial and Information Systems (ICIIS), [20] Using DE0 Nano ADC, Altera University Program. Available:
2009. http://www.altera.com
[2] L. Bing and C. Hua, "The research of the PID controller based on [21] H. C. Chen, "A high-resolution digital PWM controller using capacitor
FPGA," Proceeding of the International Conference on Electronic and integration," Proceeding of the International Conference on Next-
Mechanical Engineering and Information Technology (EMEIT), 2011 Generation Electronics (ISNE), 2010.
[3] A. Trimeche, A. Sakly, A. Mtıba and M. Benrejeb, "PID control [22] MATLAB, Siso Design Tool
implementation using FPGA technology,” 3rd International Design and http://www.mathworks.com/help/control/getstart/siso-design-tool.html
Test Workshop, 2008.
[4] D. Feng, L. Yan, L. Xu, W. Li, "Implement of digital PID controller
based on FPGA and the system co-simulation," Proceeding of the First
769