CHAPTER 3
CONTROL and A/D and D/A
conversion
1
CHAPTER 3
CONTROL and A/D and D/A conversion
Controller and its techniques are a main core of any modern automatic system.
It must be connected firmly with other parts of the system as shown in fig.1.
Controlle Interfac Drive Actuato Plant
Set Interfac Sensors
poi
Fig.1: closed loop automated system.
PID control technique1:
The most important control technique in industry is the PID (Proportional
Integral Derivative) controller there are two main configurations of PID
controller as shown in fig.2 and fig.3 where in the parallel configuration the
constant of each branch is assigned separately and in idle configuration the
proportional constant is multiplied by all branches. Tuning the PID controller is
by determining values of the three constants of the controller.
Fig.2: Parallel PID.
1
Godfrey C Onwubolu, ‘Mechatronics: Principles and Applications’, Solutions, 2005, 672,
[Link]
2
Fig.3: Idle PID controller.
Fig.4: Effect of PID parameters on response.
There are many methods to tune these values the first common step of all of
them is to notice the open loop step response of the plant shown in fig.5.
Depending on this response you can determine to use PID, PI or PD controller
and modify the initial values. Fig.4 shows the effect of increasing each
parameter of them.
3
Parameter Effect
Kp Increasing this parameter in the
parallel configuration decreases rise
time and increases ripples.
KI Increases overshot percentage and
decreases steady state error.
KD Decreases ripples and overshot
percentage but increases rise time and
threaten the system to be under
damped if increased too much (don’t
reach set point)
Fig.5: second order step response.
4
This controller can be applied using many control devices like op-Amp
(operational amplifier), micro controllers, PLC (programmable logic controller)
…etc.
Fuzzy control technique2:
It is intelligent control technique can deal with linguistic variables, non-
deterministic values and multi input multi output systems. Also, it is a robust
controller which means it can cope with changes happening in system.
To establish a fuzzy controller first you require having experience with the
system or its model first and putting this experience in the controller. This
controller consists of fuzzy memberships a set of memberships for each input
and each output notice that the input of the actuator is the output of the
controller and the input of the controller is the output of the sensor (interfaced),
rules data base containing the recommended action due to happening of each
membership of controller inputs with other controllers’ inputs memberships,
this action is a controller output/ outputs membership/s, and FIS (fuzzy
inference system) containing memory of inputs and outputs data and
defuzzification method as shown in fig.6.
After establishing controllers’ parts, it can be applied to the system to that the
values from sensors are to be applied to the memberships of their equivalent
inputs then rules are to be applied to them in order to determine each output
memberships to be used. Then for each output memberships defuzzification
equation is to be applied to give exact value of the output to be sent to the
actuator. This controller can be applied using few control devices like
computers, FPGA (field programmable gates array) and hardly microcontroller/
microprocessor.
2
R. Baxter et al., Fundamentals of Arificial Intelligence, Animal Genetics, vol. 39, 2008.
5
Fig.6: Fuzzy controller.
NN (Neural networks):
It is human effort to simulate the human brain method of thinking. Two of the
main applications of neural networks are black box modelling which developed
to machine learning and deep learning the second is classification. The main
concept is connecting neurons (mathematical function) by weights which store
the trained information as shown in fig.7. Also, it can classify behaviours of
complicated systems according to neighbourhood concept to be modelled later.
Main advantages of NN are robustness, coping with nonlinearity of systems and
generalizability while its main disadvantage is it doesn’t give a mathematical
equation for any model. It can be used to get experience for designing fuzzy
controller, can resemble a model of any controller to be used instead of it or can
be used to replace the fuzzy controller itself. In this case it is called neuro fuzzy.
To get a model using NN you must provide a set of data containing inputs and
their corresponding outputs which is categorized as supervised learning. This
data set can be either of limited amount or from open source dug by the
software in this case we call it deep learning. Preparing a model by NN has
three stages training, validation and testing.
6
Fig.7: Back propagation feed forward NN.
For testing it is preferred to have small data set to test the network yourself.
Regression and error of all stages indicate existence of over fitting or not.
Optimization:
There are a lot of optimization techniques. They can be used for determining the
optimal values to operate the system or set the controller. These techniques are
mainly simulating natures’ method for surviving. Genetic algorithm simulates
living beings’ way of evolution from generation to the next to conquer a
problem in their life or surrounding environment. Harmony search simulates the
universal tendency to get harmony between waves of all interacting things. Ant
colony optimization which simulates ants’ behaviour in searching for food and
so on nearly every living creature was simulated for developing an optimization
technique.
7
FPGA (field-programmable gate array)3:
A field-programmable gate array (FPGA) is a logic device that contains a two-
dimensional array of generic logic cells and programmable switches. The
conceptual structure of an FPGA device is shown in fig.8. A logic cell can be
configured (i.e., programmed) to perform a simple function, and a
programmable switch can be customized to provide interconnections among the
logic cells. A custom design can be implemented by specifying the function of
each logic cell and selectively setting the connection of each programmable
switch. Once the design and synthesis are completed, we can use a simple
adaptor cable to download the desired logic cell and switch configuration to the
FPGA device and obtain the custom circuit. Since this process can be done "in
the field" rather than "in a fabrication facility (fab)," the device is known as
field programmable. This device can be highly affected by any electromagnetic
fields nearby, so it is not suitable for industrial environment, but it has suitable
alternative but require to be manufactured not field programmed.
Fig.8: FPGA principle design.
3
Pong P. Chu, FPGA Prototyping by Verilog Examples, FPGA Prototyping by Verilog Examples, 2008,
[Link]
8
Microcontroller4:
Each microcontroller contains a microprocessor connected to output/ input,
power and addresses terminals and buffered from them. Inputs and outputs can
be connected after interfacing them to the microcontroller or a port can be
designed, addressed and connected to it using data and address buses to be used
later like executed in ARDUINO open architecture interfaced microcontroller.
Microcontrollers’ construction is mainly based on transistors of different types.
It contains microprocessor, non-volatile memory ROM (read only memory),
volatile memory RAM (random access memory), timers, counters, A/D
analogue to digital converter, D/A digital to analogue converter and buffered
terminals for data and address buses as shown in fig.9.
Fig.9: Microcontroller main parts and its possible connections.
4
Wego Wang, Mechatronics and Automatic Control Systems, 2013.
9
Microprocessor5:
Is a transistor-based device (till now) which can be connected using data,
address and control buses to the outer world to get and process data then decide
control action or display results. It doesn’t contain any other parts except
processor and its terminals so memories, buffers, ports, power and data
acquisition must be interfaced and connected to it externally as in our computers
mother boards as shown in fig.10.
Fig.10: Microprocessor construction and possible connections.
5
Wang.
10
In industrial automation, the conversion between analog and digital signals is
essential for interfacing sensors, actuators, and control systems as shown in
fig.11.
Fig.11: usage of A/D and D/A converters.
Analog-to-Digital Conversion (A/D) is the process of converting continuous
analog signals into discrete digital values. This is essential for digital processing
systems that require numerical data for analysis and control.
A/D conversion steps:
1) Sampling: The analog signal is sampled at specific intervals. The
sampling rate must be high enough to capture the signal accurately,
adhering to the Nyquist theorem(“the sampling rate must be greater than
twice the maximum frequency component in the signal to be acquired”)
as shown in fig.12.
≥2 ℎ ℎ
Number of sampled levels for the analog signal N=2n where n is the
number of digits used for representing the signal.
11
The A/D converter receives signal as a voltage and compares it to
reference voltage for each binary digit as shown in fig.13. that’s how
binary digits are tailed left to right from highest to lowest digits. The best
way for digitizing signals is the decision tree shown in fig.14.
2) Hold: The sampled signal is held constant during the quantization
process as shown in fig.15.
3) Quantization: The held signal is converted into a finite number of levels.
Each level corresponds to a binary value. So, to increment the binary
code by 1 the increment of analogue value must equal or exceed the
resolution value as shown in fig.14 and 15.
4) Encoding: The quantized levels are encoded into a digital format,
typically binary.
Fig.12: Aliasing Effect.
Example 1:
A process analog variable that has physical range of 0V to 10V is at level 2.9V.
that digital approximation will the A/D converter transmit to the process control
computer input register?
Sol:
Process variable X=2.9 V
12
Digital approximation Y=?
Using the decision tree shown in fig.14:
5.0 0
2.5 01
3.75 010
The digital (binary) approximation 010 is used to represent the analog value 2.9
in this case. The representative value (midpoint) of the range of analog values
covered by digital 010 is:
3.75 " 2.5 6.25
3.125
2 2
Therefore, the round off error in the conversion is:
3.125 $ 2.900 0.225&
Fig.13: Sampling comparator.
Resolution of A/D converter is a function of the binary digits assigned to the
digital approximation and the full range if the continuous variable:
'
2(
R: full- Scale range of the continuous process variable.
13
n: the number of binary digits assigned to the digital approximation.
The maximum error of the A/D conversion can be half the resolution:
1 ' '
) * ± , ( - ± (./
2 2 2
Fig.14: Decision tree for digitization.
Example 2:
An automatic process control computer monitors the approach of a robot to an
object by means of a radio frequency proximity device that is capable of sensing
distance. The range of robot distance to the object is 48 in. the A/D converter
uses a 6 bit register for the digital approximation to the analog value, which can
be assumed to be accurate and linear throughout the range from 0 to 48 in. what
is the resolution of the A/D converter for this process variable, and what is the
maximum error?
Solution:
14
' 48 48 3
2( 22 64 4
' 48 48 3
) * ± (./ ± 3 ±
2 2 128 8
Fig.15: Processes of holding and quantization.
After taking the decision by the controller it is required to transfer it to the
actuators through interface and drivers if required. The main step to do that is to
convert the signal from digital to analog signal.
D/A converter:
Digital-to-Analog Conversion (DAC) is the reverse process of A/D conversion,
where discrete digital values are transformed back into continuous analog
signals.
How D/A Converters Work:
1. Input Processing: The digital input is received, often as binary numbers.
2. Conversion: The DAC converts these numbers into corresponding voltage or
current levels using various methods (e.g., weighted resistor
networks).
3. Output Smoothing: The output may undergo filtering to smooth out the step
changes inherent in digital signals.
15
Key Parameters of D/A Converters
• Resolution: The number of bits in the digital input, determining the output voltage
resolution.
• Accuracy: The closeness of the actual output voltage to the ideal output voltage.
• Settling Time: The time required for the output voltage to reach its final value after a
change in the digital input.
The analog output can be calculated as follows:
(
56 1 '
'4 " , -" 86(
26 2 2(
67/
5/ 59 5( 1 '
', " " ⋯ " (- " , (- " 86(
2 4 2 2 2
Where:
Y is the approximation to the continuous process variable.
R is the full-scale range of the continuous variable.
56 ( " 1: )th order binary bit value.
n is the number of binary digits allocated to the D/A conversion.
Ymin is the minimum value the process variable is expected to assume.
Example 3:
A binary computer register contains a digitized approximation to a continuous
process variable that has a range of 1200 to 1800 psi. the register currently reads
1011. What process pressure does this represent?
Solution:
5/ 59 5( 1 '
', " " ⋯ " ( - " , ( - " 86(
2 4 2 2 2
1 0 1 1 1 (1800 $ 1200)
(1800 $ 1200) , " " " - " , - " 1200
2 4 8 16 2 16
1706.25
16
Disadvantages of A/D AND D/A converting is:
• Sampling Rate:
o High sampling rates are necessary for fast-changing signals; however, they
require more data storage and processing power.
• Quantization Error:
o The difference between actual and quantized values can lead to inaccuracies.
o Mitigated by using higher-resolution converters.
• Signal Noise:
o Industrial environments are prone to electrical noise, which can impact
accuracy.
o Filtering and shielding are often necessary.
• Latency:
o Both A/D and D/A conversions introduce slight delays, which may affect real-
time control in fast applications.
• Cost and Power Consumption:
o High-resolution, high-speed converters are more expensive and may consume
more power, impacting design choices.
17