SlideShare a Scribd company logo
1 of 66
ELECTRONIC SYSTEMS
Lab Report
Andrew Dilucia
A10938
1
Contents
Introductionโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆp2
Part 1
Inverting Op Ampโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p3
Inverting Bufferโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p7
Non-Inverting Amplifierโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ..โ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p9
Non-Inverting Bufferโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ..โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p14
Low Pass Filterโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p15
High Pass Filterโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p18
Band Pass Filterโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p20
Butterworth Filterโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆ.โ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p23
Chebyshev Filterโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.....โ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p27
Integration Amplifierโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p30
Differentiator Amplifierโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ..โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p32
Balanced Line Driverโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆ...โ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p34
Part 2
Blood Pressure Monitorโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ..โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...p40
Part 3
Simple AM Receiverโ€ฆโ€ฆโ€ฆ.โ€ฆ.โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ..โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ..p43
Part 4
Switched Mode Power Supply (Flyback Converter)โ€ฆโ€ฆ..โ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p47
Part 5
PID Controllerโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p49
Part 6
Music Circuitโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p55
Part 7
Code Generationโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p59
Conclusionโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p64
Referencesโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p65
2
Introduction
Electronic systems can be found all around us in everyday life, like for example in a stereo
system or a blood pressure monitor. They can be defined as the interconnection of parts or
components that processes information that has been inputted from various devices such as
sensors or computers to various types of outputs by electronic means.
For this report I was tasked with the investigation of various aspects of electronic systems
mainly revolving around op amps. Throughout the semester I simulated and tested various
systems to verify the outputs and recorded the results to analyse the data collected, to confirm
the circuit was working as expected. These investigations involved building various
electronic systems within Scilab/XCOS, which is a piece of simulation software to test the
circuit. I also used Multisim to try simulate some models that I could not get working in
Scilab.
The investigations contained seven parts and they are;
Various Op Amp Circuits
Blood Pressure Monitor
Simple AM Receiver
Switch Mode Power Supply
PID Controller
Music Circuit
Code Generation
This report was created to document the various stages of my investigations and were carried
out by simulating the various systems in the lab on a PC or on my laptop.
3
Part 1
For this part of my investigations I was tasked with modelling variations of the op-amp
circuit.
Inverting Op Amp
The first one I simulated was the inverting amplifier and below is a schematic diagram.
Inverting Amplifier Schematic Diagram
(Ece.rice.edu, 2016, accessed 2016)
The gain of an inverting amplifier is controlled by using external components which are an
input resistor(R1) and a feedback resistor(RF). The ratio between these resistances set the
gain. Also the point where the input and feedback resistors meet is known as a virtual earth
and can be thought of as 0 Volts. The input is connected to the inverting input on the op-amp
therefore the output would be inverted too. We can calculate the gain with the following
formula;
(๐‘น ๐น)
(๐‘น๐Ÿ)
= โˆ’๐‘ฎ๐’‚๐’Š๐’(๐‘จ)
As we can see from the formula the feedback resistor divided by the input resistor gives the
gain but it is a negative number and this is because it is inverted. I built the model for the
inverting amplifier in XCOS with a gain of 100 and can be seen below;
Inverting Amplifier XCOS Model (100 gain)
4
As we can see from the picture of the model on the previous page the input resistor was set to
1Kโ„ฆ (highlighted in blue) and the feedback resistor was set to 100Kโ„ฆ (highlighted in red).
So when I use the formula from the previous page I could calculate what the expected output
should be.
โˆ’
(๐‘น ๐น)
(๐‘น๐Ÿ)
= ๐‘ฎ๐’‚๐’Š๐’(๐‘จ)
โˆ’
๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ๐ŸŽ๐ŸŽ
๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ
= โˆ’๐Ÿ๐ŸŽ๐ŸŽ
๐‘ฎ๐’‚๐’Š๐’ = โˆ’๐Ÿ๐ŸŽ๐ŸŽ
To prove that the gain should be 100, I first altered the final integration time to 1.0E-6 and
this is the overall run time for the simulation as seen below
XCOS Model Parameters
I then ran the simulation in XCOS and below are the scope results for a gain of 100.
Inverting Amplifier Scope Results (100 gain)
5
As we can see from the scope results on the previous page, when a 1V, 100KHz signal was
injected into the circuit the output is 100 times greater than the input. This proved that the
ratio between these two resistors controls the gain.
I then altered the feedback resistor to 50Kโ„ฆ to alter the gain down from 100 to 50 and this
can be seen below.
Inverting Amplifier XCOS Model (50 gain)
I then ran the simulation and below are the scope results.
Inverting Amplifier Scope Results (50 gain)
6
As we can see from the scope results on the previous page, when a 1V, 100KHz signal was
injected into the circuit the output is now 50 times greater than the input. This proves that the
ratio between these two resistors controls the gain.
Next I tried setting the resistance of both to the same value and this would give a gain of 1.
This can be seen on the next page.
Inverting Amplifier XCOS Model (1 gain)
I then ran the simulation and below are the scope results.
Inverting Amplifier Scope Results (1 gain)
As we can see from the scope results when a 1V, 100KHz signal was injected into the circuit
the output was the same as the input. This proved that the ratio between these two resistors
once again controls the gain. Therefore, we can see the inverting amplifier uses negative
feedback to accurately control the overall gain of the amplifier.
7
Inverting Buffer
Next I simulated an inverting buffer and this circuit is exactly the same as an inverting
amplifier. The inverting buffer is a single input device which produces the state opposite the
input. If the input is high, the output is low and vice versa. Below is a schematic diagram for
an inverting buffer.
Inverting Buffer Schematic Diagram
(Stack Exchange Inc, 2016, accessed 2016)
As we can see from the above schematic the circuit is exactly the same as for an inverting
amplifier except this time, the value of the feedback and input resistors would be identical
therefore giving a gain of 1. I built the model for the inverting buffer in XCOS with an input
of 1KHz and can be seen below;
Inverting Buffer XCOS Model (1KHz)
As we can see the frequency was set in rad/s and 6284 rad/s is equal to 1KHz. I then ran the
simulation and the scope results can be seen on the next page.
8
Inverting Buffer Scope Results (1KHz)
Next I was tasked with raising the input to a frequency of 150KHz and adjust the scope clock
accordingly. Below is a picture of that model.
Inverting Buffer XCOS Model (150KHz)
As we can see from the picture above, I altered the input frequency to 942477.795 rad/s
which is equal to 150KHz and the scope clock was changed from 1e-5s to 1e-6s. Also both
resistors were set to 10Kโ„ฆ and I then ran the simulation. The scope results can be seen on the
next page.
9
Inverting Buffer Scope Results (150KHz)
As we can see from the scope results that the clock was adjusted accordingly and after I had
magnified the results I could see that the signals frequency had increased greatly.
Non-Inverting Amplifier
I then simulated a non-inverting amplifier and a schematic diagram can be seen below;
Non-inverting Amplifier Schematic Diagram
(Ece.rice.edu, 2016, accessed 2016)
As we can see from the schematic, unlike the inverting amplifier the input voltage signal is
applied directly to the non-inverting input on the op-amp and means the output gain would be
positive in value. We can calculate the gain with the following formula;
๐Ÿ +
(๐‘น2)
(๐‘น๐Ÿ)
= ๐‘ฎ๐’‚๐’Š๐’(๐‘จ)
As we can see from the formula, the feedback resistor divided by the input resistor gives the
gain but this time 1 is added to it. Therefore, the output is controlled by the ratio of the
resistors similar to the inverting amplifier but the sum has 1 added to it. I then built the model
for the non-inverting amplifier in XCOS with a gain of 11 and can be seen on the next page.
10
Non-Inverting Amplifier XCOS Model (11 gain)
As we can see the feedback resistor was set to 10Kโ„ฆ and R1 set to 1Kโ„ฆ, which should give
an output signal 11 times greater than the input. So when we use the formula from the
previous page we can calculate what the expected output should be.
๐Ÿ +
(๐‘น2)
(๐‘น๐Ÿ)
= ๐‘ฎ๐’‚๐’Š๐’(๐‘จ)
๐Ÿ +
๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ๐ŸŽ
๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ
= ๐Ÿ๐Ÿ
๐‘ฎ๐’‚๐’Š๐’ = ๐Ÿ๐Ÿ
I then ran the simulation and the scope results can be seen below.
Non-Inverting Amplifier Scope Results (11 gain)
As we can see from the scope results above, the output gain was 11 which proved that the
circuit was working as a non-inverting amplifier.
11
Next I was tasked with varying the gain to 1, 2 and 20. Below is the model for a gain of 1.
Non-Inverting Amplifier XCOS Model (1 gain)
As we can see from the picture above R1 was set to 100Kโ„ฆ and R2 was set to 1Kโ„ฆ.
Therefore, when using the formula from the previous page we can calculate what the output
gain would be.
๐Ÿ +
(๐‘น2)
(๐‘น๐Ÿ)
= ๐‘ฎ๐’‚๐’Š๐’(๐‘จ)
๐Ÿ +
๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ
๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ๐ŸŽ๐ŸŽ
= ๐Ÿ. ๐ŸŽ๐Ÿ
๐‘ฎ๐’‚๐’Š๐’ = ๐Ÿ. ๐ŸŽ๐Ÿ
As the ratio of the resistors can never be zero, 1.01 is the closest to 1 that I could simulate
without increasing the value of resistance further. Next I ran the simulation and below are the
scope results.
Non-Inverting Amplifier Scope Results (1 gain)
12
As we can see from the scope results on the previous page the output gain is around 1. Next I
altered the values for the resistors to produce a gain of 2 and below is a picture of the XCOS
model.
Non-Inverting Amplifier XCOS Model (2 gain)
As we can see from the picture above R2 and R1 was set to 1Kโ„ฆ therefore when using the
formula, we can calculate what the output gain would be.
๐Ÿ +
(๐‘น2)
(๐‘น๐Ÿ)
= ๐‘ฎ๐’‚๐’Š๐’(๐‘จ)
๐Ÿ +
๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ
๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ
= ๐Ÿ
๐‘ฎ๐’‚๐’Š๐’ = ๐Ÿ
Next I ran the simulation and below are the scope results.
Non-Inverting Amplifier Scope Results (2 gain)
13
As we can see from the scope results on the previous page the output gain is exactly 2. Next I
altered the values for the resistors to produce a gain of 20 and below is a picture of the XCOS
model.
Non-Inverting Amplifier XCOS Model (20 gain)
As we can see from the picture above R2 was set to 19Kโ„ฆ and R1 was set to 1Kโ„ฆ.
Therefore, when using the formula from the previous page we can calculate what the output
gain would be.
๐Ÿ +
(๐‘น2)
(๐‘น๐Ÿ)
= ๐‘ฎ๐’‚๐’Š๐’(๐‘จ)
๐Ÿ +
๐Ÿ๐Ÿ—๐ŸŽ๐ŸŽ๐ŸŽ
๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ
= ๐Ÿ๐ŸŽ
๐‘ฎ๐’‚๐’Š๐’ = ๐Ÿ๐ŸŽ
I then ran the simulation and below are the scope results.
Non-Inverting Amplifier Scope Results (20 gain)
As we can see from the scope results on the previous page the output gain is exactly 20.
14
Non-Inverting Buffer
Next I simulated a non-inverting amplifier and a schematic diagram can be seen below;
Non-Inverting Buffer Schematic Diagram
(Open Music Labs, 2016, accessed 2016)
The non-inverting buffer is a single input device which has a gain of 1, mirroring the input at
the output. It has value for impedance matching and for isolation of the input and output.
Therefore, a Buffer is an amplifier which has a gain of unity, a high input impedence and
low output impedence. It can be used as a bridge between two circuits, where one circuit has
a high output impedence and the other circuit has a low input impedence. The buffer would
prevent the second circuit from interfering with the first circuit working correctly. We can
calculate the gain with the following formula;
๐‘ฎ๐’‚๐’Š๐’( ๐‘จ) =
(๐‘ฝ๐’๐’–๐’•)
(๐‘ฝ๐’Š๐’)
= +๐Ÿ
I then built the model for the non-inverting buffer in XCOS and can be seen below.
Non-Inverting Buffer XCOS Model
15
As we can see in the picture on the previous page, the feedback loop is without a resistor
therefore this creates direct feedback so the gain should be equal to 1. The buffer can
replicate weak signals however it can drive enough current to be further amplified if needed. I
then ran the simulation and below are the scope results.
Non-Inverting Buffer Scope Results
As we can see from the scope results that the output signal gain is equal to 1, as the output
was the same as the input.
Low Pass Filter
Next I simulated a 1st Order Low Pass Filter and a schematic diagram can be seen below;
1st Order Low Pass Filter Schematic Diagram
(Electronicshub.org, 2015, accessed 2016)
A first-order low pass active filter consists simply of a passive RC filter stage providing a low
frequency path to the input of a non-inverting buffer giving it a DC gain of one, Av = +1 or
unity gain. The cut off frequency for a low pass filter can be calculated with the following
formula;
๐Ÿ
๐Ÿ๐…๐‘น๐‘ช
= ๐‘ช๐’–๐’• ๐’๐’‡๐’‡ ๐’‡๐’“๐’†๐’’๐’–๐’†๐’๐’„๐’š
16
I then built the model for the Low Pass Filter in XCOS and this can be seen below.
Low Pass Filter XCOS Model
As we can see from the model, the configuration of the 10Kโ„ฆ resistor and 100nf capacitor is
for a low pass filter and once the signal has travelled through the filter it is then fed into a
non-inverting amplifier. I then ran the simulation and below are the scope results.
Low Pass Filter Scope Results
This information could be analysed further by using a program to process the matrix A in the
workspace. I then executed the program FFTProg.sce in the Scilab console window. This
program will print the matrix, plot it and show the Fast Fourier Transform (FFT). The FFT
scope results can be seen on the next page.
17
Low Pass Filter FFT Scope Results(a)
Low Pass Filter FFT Scope Results(b)
From these FFT scope results, I could see the circuit was acting as a Low-pass filter allowing
the lower frequencies to pass while beginning to block the signal at around 110KHz.
18
High Pass Filter
Next I simulated a 1st Order High Pass Filter and a schematic diagram can be seen below;
1st Order High Pass Filter Schematic Diagram
(Electronicshub.org, 2015, accessed 2016)
As we can see from the schematic diagram, a first-order high pass active filter consists simply
of a passive CR filter stage providing a high frequency path to the input of a non-inverting
buffer giving it a DC gain of one, Av = +1 or unity gain. The cut off frequency for a high
pass filter can be calculated with the following formula;
๐Ÿ
๐Ÿ๐…๐‘น๐‘ช
= ๐‘ช๐’–๐’• ๐’๐’‡๐’‡ ๐’‡๐’“๐’†๐’’๐’–๐’†๐’๐’„๐’š
I then built the model for a high pass filter in XCOS and this can be seen below.
High Pass Filter XCOS Model
As we can see from the model, the configuration of the 100nf capacitor and 10Kโ„ฆ resistor is
for a high pass filter and once the signal has travelled through the filter it is then fed into a
non-inverting amplifier. I then ran the simulation and the scope results can be seen on the
next page.
19
High Pass Filter Scope Results(a)
High Pass Filter Scope Results(b)
This information could be analysed further by using the FFT program to process the matrix A
in the workspace. I then executed the program FFTProg.sce in the Scilab console window.
This program then printed the matrix, plotted it and showed the FFT. The FFT scope results
can be seen on the next page.
High Pass Filter FFT Scope Results(a)
20
High Pass Filter FFT Scope Results(b)
From these FFT scope results, I could see the circuit was acting as a high pass filter allowing
the higher frequencies to pass while beginning to block the signal at lower frequencies.
Band Pass Filter
Next I simulated a 1st Order Band Pass Filter and a schematic diagram can be seen below;
1st Order Band Pass Filter Schematic Diagram
(Electronics Tutorials, 2016, accessed 2016)
As we can see from the schematic diagram, a first order band pass active filter consists
simply of a passive CR high pass filter combined with a passive RC low pass filter. The cut
off frequencies for low pass and high pass filters can be calculated with the following
formula;
๐Ÿ
๐Ÿ๐…๐‘น๐‘ช
= ๐‘ช๐’–๐’• ๐’๐’‡๐’‡ ๐’‡๐’“๐’†๐’’๐’–๐’†๐’๐’„๐’š
These 2 cut off frequencies are then combined to create a band pass where the cut off
frequency for the high pass filter would be the start of the band pass and the cut off frequency
for the low pass would be the end of the band pass. Therefore, only signals above or below
these two cut off frequencies would be allowed to pass through the circuit. I then built the
model for a band pass filter in XCOS and this can be seen on the next page.
21
Band Pass Filter XCOS Model
As we can see from the model, the configuration of the high pass filter and then the low pass
filter. I then ran the simulation and the scope results can be seen on the below.
Band Pass Filter Scope Results(a)
Band Pass Filter Scope Results(b)
22
The information from the scope results could be analysed further by using the FFT program
to process the matrix A in the workspace. I then executed the program FFTProg.sce in the
Scilab console window. This program then printed the matrix, plotted it and showed the FFT.
The FFT scope results can be seen below.
Band Pass Filter FFT Scope Results(a)
Band Pass Filter FFT Scope Results(b)
From these FFT scope results, I could see the circuit was acting as a band pass filter.
23
Next I was tasked with investigating Butterworth and Chebyshev filters.
Butterworth Filters
The Butterworth filter is a type of filter used in signal processing and it is designed so the
passband has a frequency response that is as flat as possible. The response has no ripples in
the response because the passband is designed to have a frequency response which is as flat
as mathematically possible from 0Hz until the cut off frequency at -3Db with no ripples.
Therefore, the Butterworth design ensures a flat response in the pass band and an adequate
roll off. This reason makes the Butterworth filter, the ideal filter to use in audio circuits. The
gain for the filter can be calculated with the following formula;
๐‘ฏ( ๐’‹๐Ž) =
๐Ÿ
โˆš ๐Ÿ + ๐“”ยฒ(
๐Ž
๐Ž๐’‘
)ยฒโฟ
I then built a second order low pass Butterworth filter in XCOS and this can be seen in the
picture below.
2nd Order Butterworth Low Pass Filter
As we can see from the model, the configuration of the 1Kโ„ฆ resistors and 10nf capacitor is
for a second order low pass filter and once the signal has travelled through the filter it is then
fed into a non-inverting amplifier. I then ran the simulation and below are the scope results.
2nd Order Butterworth Low Pass Filter Scope Results
24
The information from the scope results could be analysed further by using the FFT program
to process the matrix A in the workspace. I then executed the program FFTProg.sce in the
Scilab console window. This program then printed the matrix, plotted it and showed the FFT.
The FFT scope results can be seen below.
2nd Order Butterworth Low Pass Filter FFT Scope Results(a)
2nd Order Butterworth Low Pass Filter FFT Scope Results(b)
As we can see from these results, the circuit is behaving like a low pass filter. However, the
frequency response is similar to a Chebyshev response with a ripple and no matter what I
tried I could not get the simulation to produce the response that was required. Therefore, I
built the simulation in Multisim and this can be seen in the picture on the next page.
25
Butterworth Low Pass Filter Multisim Model
As we can see from the picture above I built the same 2nd order low pass circuit in Multisim I
then ran the simulation and below is the a.c. sweep scope results.
Butterworth Low Pass Filter Multisim Scope Results
As we can see from these results in Multisim, the response looks more like a Butterworth
response where the passband is a lot smoother. However, it still has a slight ripple near the
cut off frequency and the roll off should be slightly steeper so it is still not reacting quite as
expected.
26
Within Scilab or XCOS when you build and simulate circuits, code can be generated for the
circuits. Also you can enter code within the Scilab console window to simulate various
circuits and I will explain this further in Part 7. However, you can simulate the Butterworth
filter frequency response by entering the following code;
//squared magnitude response of Butterworth filter
h=buttmag(13,300,1:1000);
mag=20*log(h)'/log(10);
plot2d((1:1000)',mag,[2],"011"," ",[0,-180,1000,20])
After entering the above code and pressing return, the following response was achieved;
Butterworth Low Pass Filter Response Graph
As we can see from the graph above what the correct response for a Butterworth low pass
filter should look like as there is a flat passband with no ripple and an adequate roll off.
27
Chebyshev Filters
Chebyshev filters are filters that have a steeper roll off and more of a passband or stopband
ripple than Butterworth filters. They minimize the error between the idealised and the actual
filter characteristic over a range of the filter but with ripples in the passband. There are two
types of Chebyshev low pass filters. Type 1 has an all pole transfer function, where it has an
equi-ripple passband and a monotonically decreasing stopband. A type 2 has both poles and
zeros. Its band is monotonically decreasing and it has an equi-ripple stopband. By allowing
some ripple in the passband or stopband magnitude response, a Chebyshev filter can achieve
a steeper roll off than the same order Butterworth filter. This is the reason this type of filter is
not used within audio circuits. The gain for both filters can be calculated with the following
formulas;
Type 1
๐‘ฎ๐’( ๐Ž) =
๐Ÿ
โˆš๐Ÿ + ๐“”ยฒ๐‘ป๐’ยฒ(
๐Ž
๐Ž๐ŸŽ
)
Type 2
๐‘ฎ๐’( ๐Ž, ๐Ž๐ŸŽ) =
๐Ÿ
โˆš ๐Ÿ +
๐Ÿ
๐“”ยฒ๐‘ป๐’ยฒ(
๐Ž๐ŸŽ
๐Ž
)
I then built a second order low pass Chebyshev filter in XCOS and this can be seen in the
picture below.
2nd Order Chebyshev Low Pass Filter
As we can see from the model, the configuration of the 1Kโ„ฆ resistors and 10nf capacitor is
for a second order low pass filter and once the signal has travelled through the filter it is then
fed into a non-inverting amplifier. I then ran the simulation and on the next page are the
scope results.
28
Chebyshev Low Pass Filter Scope Results
The information from the scope results could be analysed further by using the FFT program
to process the matrix A in the workspace. I then executed the program FFTProg.sce in the
Scilab console window. This program then printed the matrix, plotted it and showed the FFT.
The FFT scope results can be seen below.
Chebyshev Low Pass Filter FFT Scope Results(a)
Chebyshev Low Pass Filter FFT Scope Results(b)
As we can see from the results on the previous page the output response had a ripple on the
passband and a very steep roll off which are characteristics of a Chebyshev response.
29
As I mentioned earlier about generating code for circuits with the Butterworth low pass filter
for a frequency response graph, we can do the same for a Chebyshev low pass filter by
entering the following code into the console window in Scilab;
Type 1
//Chebyshev; ripple in the passband
n=13;epsilon=0.2;omegac=3;samples=0:0.05:10;
h=cheb1mag(n,omegac,epsilon,samples);
plot2d(samples,h)
xtitle('','frequencies','magnitude')
Type 2
//Chebyshev; ripple in the stopband
n=10;
omegar=6;
A=1/0.2;
Samples=0.0001:0.05:10;
h2=cheb2mag(n,omegar,A,Samples);
plot(Samples,log(h2)/log(10))
xtitle("", "frequencies", "magnitude in dB");
//Plotting of frequency edges
minval=(-max(-log(h2)))/log(10);
plot2d([omegar;omegar],[minval;0],[2],"000");
//Computation of the attenuation in dB at the stopband edge
attenuation=-log(A*A)/log(10);
plot2d(Samples',attenuation*ones(Samples)',[5],"000")
Both these pieces of code produce the following frequency response graphs as seen below
and on the next page.
Type 1 Chebyshev Low Pass Filter Response Graph
30
Type 2 Chebyshev Low Pass Filter Response Graph
As we can see from the graph above and on the previous page what the correct responses for
a Chebyshev low pass filter should look like. In type 1 there is a ripple present on the
passband and in type 2 the ripple is after the passband.
Integrator
Next I investigated integrator and differentiator op amp circuits. An integrator is an op amp
circuit that performs the mathematical operation of integration with respect to time, where we
can cause the output to respond to changes in the input voltage over time as the op amp
integrator produces an output voltage which is proportional to the integral of the input
voltage. It integrates and inverts the input voltage Vin(t) over a time period t, t0, <t, <t1,
producing an output voltage at time t = t1 of;
๐‘ฝ๐’๐’–๐’•( ๐’•๐Ÿ) = ๐‘ฝ๐’๐’–๐’•( ๐’•๐ŸŽ)โˆ’
๐Ÿ
๐‘น๐‘ช
โˆซ ๐‘ฝ๐’Š๐’( ๐’•) ๐’…๐’•
๐’•๐Ÿ
๐’•๐ŸŽ
๐‘ฝ๐’๐’–๐’• = โˆ’
๐Ÿ
๐‘น๐‘ช
โˆซ ๐‘ฝ๐’Š๐’( ๐’•) ๐’…๐’•
๐’•๐Ÿ
๐’•๐ŸŽ
๐‘ฝ๐’๐’–๐’• = โˆ’
๐Ÿ
๐’‹๐Ž๐‘น๐‘ช
๐‘ฝ๐’Š๐’
First I built the Integrator circuit in XCOS with a sinusoidal input and below is picture of that
model.
Integrator Sine-wave XCOS Model
31
I then ran the simulation and below are the scope results.
Integrator Sign-wave Scope Results
As we can see from the scope results above the output signal from the integrator is out of
phase by 90 degrees with the input signal and proved the circuit was working correctly. I then
changed the input signal within the model from a sinusoidal to a square wave and below is a
picture of my XCOS model.
Integrator Square-wave XCOS Model
I then ran the simulation and the scope results can be seen on the next page.
32
Integrator Square-wave Scope Results
As we can see from the scope results above that the output of the integrator, when the input
signal is from a square-wave generator responds in a saw-tooth manner. This proved the
circuit was working correctly, as this was the output response I was expecting.
Differentiator
A Differentiator is an op amp circuit that performs the mathematical operation of
differentiation, where it produces a voltage output which is directly proportional to the input
voltages rate of change with respect to time. Therefore, the faster or larger the change to the
input voltage signal, the greater the current and then greater the output voltage change in
response, becoming more of a spike in response. It differentiates the inverted signal over time
and the output signal can be calculated with the following formula;
๐‘ฝ๐’๐’–๐’• = โˆ’ ๐‘น๐‘ช
๐’…๐‘ฝ๐’Š๐’
๐’…๐’•
First I built the Integrator circuit in XCOS with a sinusoidal input and below is picture of that
model.
Differentiator Sine-wave XCOS Model
33
I then ran the simulation and below are the scope results.
Differentiator Sine-wave Scope Results(a)
As we can see from the graph results above the output signal from the differentiator has
changed from a sine wave to a cosine wave and the output is just a fraction of the input
signal. I then changed the input signal within the model from a sinusoidal to a square wave
and below is a picture of my XCOS model.
Differentiator Square-wave XCOS Model
I then ran the simulation and the scope results can be seen on the next page.
34
Differentiator Square-wave Scope Results
As we can see from the results above that when a square wave is inputted into a differentiator
the output now has a spike on it and this is dependant, by the RC time constant. This proved
the circuit was working correctly, as this was the output response I was expecting.
Differential Balanced Line Driver
A balanced line driver uses two wires for the signal, with the signal equal in amplitude in
each wire and is opposite in phase. Only the out of phase signal is detected by the remote
balanced receiver, and any in phase signal is rejected. Interference such as RF as well as other
noise will be picked up equally by both wires in the cable and so will be in phase. It will
therefore be rejected by the receiver. In this way, it is possible to have long interconnects,
with a shield connected at one end only. By configuring the circuit like this it cuts the earth
loop, and the balanced connection ensures that only the wanted signal is passed through to the
amplifier. Therefore, a balanced line driver takes an unbalanced signal and converts it to a
balanced signal. The balanced signal makes it easier to cancel out the noise, therefore leaving
a clean signal. The main advantage of the balanced line format is it has good rejection of any
external noise when fed to a differential amplifier.
The system usually uses twisted pair conductors to connect a transmitter with a receiver. A
balanced line transmitter splits the signal and is usually fed into buffers, one to buffer the
signal while the other is to buffer and invert the signal. This creates a balanced signal with the
signal on both conductors where when the signal swings positive on one conductor it swings
exactly the same amount negative on the other.
The balanced line receiver is a differential amplifier which amplifies the difference between
the two input signals. By connecting one signal onto the inverting input and one signal to the
non-inverting input the resultant output voltage will be proportional to the difference between
the two input signals. The Vout of the differential amplifier can be calculated with the
following formula;
๐‘ฝ๐’๐’–๐’• =
๐‘น๐Ÿ‘
๐‘น๐Ÿ
(๐‘ฝ๐Ÿ โˆ’ ๐‘ฝ๐Ÿ)
35
In a balanced system the noise would be induced into the centre conductors and the shields
signal equally but the noise is cancelled out because the noise is on both of the signal lines
and the signal used by the amplifier in the receiver is the difference between the two signal
lines. If the noise has a magnitude of 1.5V, the differential amplifier sees 1.5V minus 1.5V
equals 0V. Balanced lines work because the noise from surrounding environment is induced
into both wires equally and by measuring the difference between the two wires at the
receiving end, the original signal can be recovered while the noise is cancelled.
I then built the model for a differential balanced line driver in XCOS and this can be seen
below.
Differential Balanced Line Driver XCOS Model
As we can see from the model above, the signal is split with one line inverted before being
fed into a receiver which is a differential amplifier. Also within the model is a sinewave
generator that simulates noise on in the circuit. I then opened the control parameters block for
the sine-wave input signal and set the frequency of the noise to 314 rad/s which is 50Hz.
Square-wave Parameters Block 50Hz
I then ran the simulation and the scope results can be seen on the next page.
36
Differential Balanced Line Driver 2V 50Hz Noise Signal Scope Results
As we can see from the above results the two lines have the signal on them however they are
in anti-phase and are beginning to show some effects of noise with the slight curve of the
signal. The output signal that was achieved was smooth with no signs of noise and was
amplified up from 5V to 10V. This proved the circuit was working correctly and below is a
picture of those results.
Differential Balanced Line Driver Input & Output Signal Scope Results
I then opened the control parameters block for the sine-wave input signal and set the
frequency of the noise to 15000 rad/s which is 2387Hz. This can be seen on the next page.
37
Square-wave Parameters Block 2387Hz
I then ran the simulation and the scope results can be seen below.
Differential Balanced Line Driver 2V 2387Hz Noise Signal Scope Results
As we can see from the above results, now that the frequency has been increased the two
lines clearly have noise on them and equal amounts of noise is seen on both However, the
output signal that was achieved was smooth with no signs of noise and was amplified up from
5V to 10V. This proved the circuit was working and below is a picture of those results.
Differential Balanced Line Driver 2V 2387Hz Input & Output Signal Scope Results
38
I then opened the control parameters block for the sine-wave input signal and set the
frequency of the noise to 30000 rad/s which is 4775Hz. This can be seen below.
Square-wave Parameters Block 4775Hz
I then ran the simulation and the scope results can be seen below.
Differential Balanced Line Driver 2V 4775Hz Trace Scope B
As we can see from the above results, now the frequency of the noise has been increased even
more, the signals are showing more distortion and equal amounts of noise on both. However,
the output signal that was achieved was smooth with no signs of noise and was amplified up
from 5V to 10V. This proved the circuit was working and on the next page is a picture of
those results.
39
Differential Balanced Line Driver 2V 4775Hz Trace Scope A
RS-485
RS-485 allows multiple devices to communicate at half-duplex on a single pair of wires plus
a signal ground wire at distances up to 1200 meters. The function of the signal ground wire is
to tie the signal ground of each of the nodes to one common ground. With RS-485, both the
length of the network and the number of nodes can easily be extended using a variety of
repeater products on the market. On this network data is transmitted differentially on two
wires twisted together and this is referred to as a twisted pair. The properties of differential
signals provide high noise immunity and long distance capabilities. Only one device at a time
can drive the line so when the drivers are not in use they must be put into a high-impedance
mode. Some RS-485 hardware handles this automatically and in other cases the RS-485
device software must use a control line to handle the driver. RS-485 software handles
addressing, turn-around delay, and possibly the drivers tri-state features of RS-485.
Throughout this part of my investigations I learned about various ways op amps can be
configured to obtain a desired output response and was able to simulate all of the circuits
successfully. Within XCOS, the Butterworth filter was tricky to tune so the output response
was smooth and without ripples. However, I believe I built a model in Multisim that produces
an output that is adequate.
40
Part 2
Blood Pressure Monitor
A blood pressure monitor uses an inflatable air-bladder cuff and a listening device or pressure
sensor to measure blood pressure in an artery. The cuff is worn on the upper arm or can
nowadays be worn on the wrist. This monitoring can be performed by using either a manually
inflated cuff with a stethoscope for listening to arterial wall sounds or a blood pressure
monitor that contains a pressure sensor for sensing arterial wall vibrations.
For this part of my investigations I built the blood monitor model in XCOS and this can be
seen in the picture below;
Blood Pressure Monitor XCOS Model(a)
In the model as seen above there is a voltage source to simulate a heartbeat and another
voltage source to simulate noise on the circuit. The two signals are then combined and after
the microphone signal has been buffered, it is then passed through a low pass filter. Next is a
ramp function that simulates the signal from the arm cuff. I then ran the simulation and the
scope results can be seen below.
Blood Pressure Monitor Trace
41
These results simulate a response from a blood pressure monitor and the teeth in the output
represent heart beats. The plot shows the rise in pressure from the arm cuff accompanied by
the heart beats monitored by a microphone.
I then replaced the 15Kโ„ฆ resistor that is connected to the heartbeat mains voltage supply with
a variable resistor and this can be seen in the picture below;
Blood Pressure Monitor XCOS Model(b)
As we can see from the model above that I replaced the resistor with a variable resistor and
set the resistance to 50Kโ„ฆ. I then ran the simulation and below are the results.
Blood Pressure Monitor Variable Resistor 50Kโ„ฆ Scope Results
As we can see from the above results that by increasing the resistance of the variable resistor,
then this reduces the heart beat signals.
Next I increased the resistance to 100Kโ„ฆ and then 200Kโ„ฆ and the results can be seen on the
next page.
42
Blood Pressure Monitor Variable Resistor 100Kโ„ฆ Scope Results
Blood Pressure Monitor Variable Resistor 200Kโ„ฆ Scope Results
As we can see from both sets of results, that when the resistance is increased this reduces the
heartbeat signals. Also when I injected noise into the circuit and the higher the frequency that
was inputted, then the simulation took longer to finish running.
Throughout this part of my investigations I learned about a blood pressure monitor and how
by simulating the pressure in the arm cuff with resistance on the circuit causes the output to
become smoother. Also the simulation produced the correct response which proved I had
simulated it correctly.
43
Part 3
Simple AM Receiver
Amplitude modulation is used in a variety of applications. Although it is not as widely used
as it was in previous years, it can still be found within broadcast transmissions or air band
radio to name a couple.
Amplitude modulation (AM) is a method of injecting data onto an alternating current (AC)
carrier signal. The highest frequency of the modulating data is normally less than 10 percent
of the carrier frequency. The instantaneous amplitude (overall signal power) varies depending
on the instantaneous amplitude of the modulating data. This moves the information signal to
a new location which is above and below the carrier frequency. These components are called
the USB Upper Sideband and LSB Lower Sideband and they are a mirror image of each
other.
Below is an equation which shows how AM works;
Vc(t) = Ac(1 + Am sinฯ‰mt) sinฯ‰ct
This can be simplified to the equation below;
Vc(t) = (1 + msinฯ‰mt) sinฯ‰ct
Vc(t) is the term for the modulated carrier wave form and the part of the equation that is
highlighted in red is the amplitude term with an average value of one and will increase +m or
-m from that value. Also ฯ‰m is the modulated frequency and ฯ‰c is the carrier signal in
rad/secs so the amplitude of the carrier wave is being modulated by the information wave.
For this part of my investigations I built a simple AM receiver model in XCOS and this can
be seen in the picture below;
Simple AM Receiver XCOS Model
44
As we can see from the model on the previous page the simple AM receiver is made up of
sub-systems. They are the information signal and carrier which produces the AM signal. Next
is an envelope detector that is followed by a low pass filter. Then there are the bias resistors
feeding the signal into a buffer and the last sub-system is an inverting amplifier.
The analogue information signal is supplied by a sinusoidal generator and this generates a
tone at the angular frequency of the information signal which was set to 5KHz. This is then
added to a constant of 1 and is multiplied by a carrier signal that was set to 100KHz.
This creates an AM signal that is fed into the envelope detector which is a diode and a low
pass filter. This diode detects the signal by first rectifying the AM carrier so the AM signals
value are no longer zero and because the received signals are weak, diodes with very low turn
on voltages are used. Then the half wave rectified pulses are fed through a low pass filter and
are therefore smoothed, so the carrier frequency is removed and the slowly changing
envelope is obtained as an output.
The biasing in this circuit is similar to voltage divider biasing, however this circuit uses an op
amp to buffer the bias voltage and this can help cut down on consumption of power within
the circuit. This will give a more accurate gain as well as offset values because the impedance
produced from the biasing and the op amp, that is fed into the rest of the circuit will be
negligible compared to another method. It also can produce to numerous circuits, a bias
voltage that is very stable and removes any cross coupling between the circuits signals.
Finally, the output from the buffer is fed into an inverting amplifier where the demodulated
signal is amplified.
I then ran the simulation and the results can be seen below as well as the next couple of
pages.
AM Receiver Information Signal Scope Results
45
AM Receiver Modulated Signal Scope Results
As we can see from the scope results above and on the previous page that when an amplitude
modulated signal is created, the amplitude of the signal is varied in line with the variations in
intensity of the sound wave. In this way the overall amplitude or envelope of the carrier is
modulated to carry the audio signal.
From the results above we can clearly see 100% modulation on the carrier signal and the
information signal can be seen to change in line with the carrier signal. When the information
signal is maximum (1) the modulated signal is maximum (2V) and when it is minimum (-1)
the modulated signal is minimum (0V).
The next two sets of scope results show the demodulated and final output signals, which can
be seen below as well as the on the next page.
AM Receiver Demodulated Signal Scope Results
46
AM Receiver Output Signal Scope Results
The demodulated signal scope results show the half wave rectified signal has been attempted
to be reconstructed by the filter. However, the output signal is not smooth but contains
fluctuations within it and this is caused by the values of the resistor as well as the capacitor.
In the final graph the final output signal can be seen to have increased in output therefore it
must have been amplified by the final inverting op amp within the circuit.
Throughout this part of my investigations I learned about the different subsystems within an
AM receiver and how it works. Also the simulation produced the correct response which
proved I had simulated it correctly.
47
Part 4
Switch Mode Power Supply
Flyback converters are used to convert AC to DC and DC to DC with galvanic isolation
between the input and any outputs. It is derived from a buck-boost converter where the
Inductor is split and acts like an isolation transformer. This means that the ratios of voltage
are multiplied with the advantage of isolation. So because it is similar to a boost converter the
principles of both converters are similar.
When the switch is activated, an input voltage would be connected to the primary side of the
transformer. Due to this the current and magnetic flux in the primary side increase storing
energy in the transformer. Now because of this, a negative voltage is induced into the
secondary side of the transformer making the diode reverse biased (due to the winding
polarities) and output load receives energy from the output capacitor. If the switch is then
deactivated, the magnetic flux and current in the Primary side of the transformer will drop.
Then the voltage on the Secondary side of the transformer is turned to positive and therefore
forward biasing the diode and allowing current to flow. Any energy stored in the core of the
transformer then recharges the capacitor which supplies the load.
So a Flyback converter is an isolated converter and will also need isolation of the control
circuit. The control circuit is made up of the voltage and current mode control and both need
a signal related to the output voltage.
For this part of my investigations I built a Flyback converter model in XCOS and this can be
seen in the picture below
Flyback Converter XCOS Model
I set the input voltage to 240V, then ran the simulation and the scope results are on the next
page.
48
Flyback Converter Scope Results
As we can see from the above results the output voltage is just below 100V compared to the
240V inputted into the circuit. Also the output current is spiking up to around 30A at every
step of the switch, switching on.
One advantage of the Flyback converter circuit over the other switched mode power supplies
is that many of them need a separate inductor for storage. Therefore, since the transformer in
a Flyback converter is the storage inductor, there is no need for a separate one. This along
with the fact that the rest of the Flyback converters circuitry is simple makes the Flyback
converter a cost effective and extremely popular within industry. Another advantage is it has
greater efficiency as the transistor or mosfet loses little power when switching. There are also
other advantages such as they are smaller as well as lighter in weight and produce lower heat
due to their higher efficiency.
I tried to apply feedback to the system to control the level of output, however I could not get
the simulation to work and below is a picture of the model.
Flyback Converter feedback XCOS Model
Throughout this part of my investigations I learned about a Flyback converter and the
advantages of isolated power supplies. I could not get the feedback model to work and will
revisit this at a later date.
49
Part 5
PID Controller
A Proportional Integral Derivative (PID) controller is a control loop used throughout
industrial control systems and is the most commonly used as a feedback controller. It
calculates the value of error by comparing the output with the input. The calculation involves
three separate constant parameters and they are known as a three term control. They are the
proportional, the integral and the derivative values. These values can be interpreted in terms
of time. Proportional (P) depends on the present error, integral (I) depends on the
accumulation of past errors, derivative (D) is the prediction of future errors, based the rate of
change of the current. The sum of these actions is applied to alter the process via a control
element like say a valve of a heating element. The three terms can be calculated wit following
formulas;
๐‘ท๐’“๐’๐’‘๐’๐’“๐’•๐’Š๐’๐’๐’‚๐’ ๐‘ถ๐’–๐’•๐’‘๐’–๐’• = Kp e(t)
๐‘ฐ๐’๐’•๐’†๐’ˆ๐’“๐’‚๐’•๐’Š๐’๐’ ๐‘ถ๐’–๐’•๐’‘๐’–๐’• = ๐‘ฒ๐’Šโˆซ ๐’†( ๐’•) ๐’…๐’•
๐’•
๐ŸŽ
๐‘ซ๐’†๐’“๐’Š๐’—๐’‚๐’•๐’Š๐’—๐’† ๐‘ถ๐’–๐’•๐’‘๐’–๐’• = ๐‘ฒ๐’…
๐’…
๐’…๐’•
๐’†(๐’•)
When adding these three formulas together you can calculate the output of the PID controller
as seen below;
๐‘ท๐‘ฐ๐‘ซ ๐‘ช๐’๐’๐’•๐’“๐’๐’๐’๐’†๐’“ ๐‘ถ๐’–๐’•๐’‘๐’–๐’• = ๐Š๐ฉ ๐ž(๐ญ)+ ๐‘ฒ๐’Šโˆซ ๐’†( ๐’•) ๐’…๐’•
๐’•
๐ŸŽ
+ ๐‘ฒ๐’…
๐’…
๐’…๐’•
๐’†(๐’•)
I then built the model for a PID controller in XCOS and this model can be seen in the picture
below.
PID Controller XCOS Model(a)
50
I then ran the simulation but it would not complete indicating an error in the circuit.
Therefore, I built an alternative model and this can be seen below.
PID Controller XCOS Model(c)
As we can see in the model, the three sub-systems of a PID controller with a step input. I then
ran the simulation and below are the results.
Proportional, Integral and Derivative Scope Results(a)
As we can see from the results above, they are the outputs of the individual sub-systems and
the top results are for the proportional amplifier which shows an output of 1 when the step
activates at 0.1 seconds. This is correct as the gain was set to 1. The middle results are for the
integration amplifier and these results show an output of 10 when the step activates. The
bottom results are for the derivative amplifier and these results show the output rising from 0
in a linear fashion after the step is activated at 0.1 seconds. All three results are added
together to give the final PID output signal these results can be seen on the next page.
51
Final PID Output Signal Scope Results(a)
As we can see from the above results that the final output signal is the sum of all three signals
from the earlier results. Here the output is around 11 and rising in a linear fashion over time.
This is the 1 output from the proportional amplifier, 10 output from the integration amplifier
and the linear characteristic rise in output from the derivative amplifier added together.
In the model I then changed the values for the proportional to 0.4, integral to 4 and derivative
to 0.5 and this can be seen in the picture below.
PID Controller XCOS Model(c)
I then ran the simulation and on the next page are the results.
52
Proportional, Integral and Derivative Scope Results(b)
As we can see from the results on the previous page, the different signals from the sub-
systems and below are the results of the final output from the PID controller.
Final PID Output Signal Scope Results(b)
The results above show us the sum of the three sub-systems which is around 5 and rising in a
linear fashion.
I then built a model for a PID controller, however I used the individual op amp circuits that
make up the three sub-systems. By connecting an inverting amplifier with an integrator
amplifier and differentiator amplifier. This is then connected to a summer amplifier to add the
three signals together and a picture of that model can be seen on the next page.
53
Analogue PID Controller XCOS Model
I then ran the simulation and below as well as on the next page are the results
Proportional Output Signal Scope Results
Integral Output Signal Scope Results
54
Derivative Output Signal Scope Results
As we can see from the results on the previous page the results for the proportional, integral
as well as derivative outputs and below is the final PID results.
Final PID Output Signal Scope Results
The above results show the sum of the three sub-systems that are within the PID controllers
output. As we can see it has a steep ramp when the step is activated at 0.1 seconds and is also
showing signs of an overshoot with a peak before levelling out with an output of around a
value of 4.
Throughout this part of my investigations I learned about the different subsystems within a
PID controller with regards to the proportional, integration and differentiator amplifiers. I
also learned how to calculate the output responses of each amplifier. Also the simulations
produced the correct response which proved I had simulated it correctly.
55
Part 6
Music Circuit
For this part of my investigations I was tasked to research a music amplifier or fuzzbox and
build a simulation model from the circuit diagram as seen below.
Music Circuit Diagram
(Whitbread 2016, accessed 2016)
From the circuit diagram we can see what a basic system looks like. In this system the signal
is fed into non-inverting amplifier that is AC coupled with split resistors and below is a
picture of its circuit diagram.
AC Coupled Non-Inverting Amplifier with Split Resistors
(Poole, 2016, accessed 2016)
An AC coupled amplifier has the bias voltage connected to the non-inverting input and the
bias is simply the voltage we would expect to see at the output when no signal is applied.
Within this configuration it is important that the values of the resistors and capacitors are
applicable for the frequencies required. The gain, cut off frequency and output of this op amp
can be calculated with the following formulas on the next page;
56
๐‘ฝ๐’ƒ =
๐‘๐Ÿ’
๐‘๐Ÿ‘ + ๐‘๐Ÿ’
๐‘ฝ๐’”
๐‘ฉ๐’Š๐’‚๐’” ๐‘น๐’†๐’”๐’Š๐’”๐’•๐’‚๐’๐’„๐’†(๐‘น๐Ÿ“) =
๐‘๐Ÿ‘ ๐ฑ ๐‘๐Ÿ’
๐‘๐Ÿ‘ + ๐‘๐Ÿ’
๐‘ฎ๐’‚๐’Š๐’ = ๐Ÿ + (
๐‘๐Ÿ
๐‘๐Ÿ
)
๐’‡๐’„ =
๐Ÿ
(๐Ÿ๐›‘)(๐‘๐Ÿ“ ๐ฑ ๐‚๐Ÿ)
๐‘ฝ๐’ = ๐‘ฎ๐‘ฝ๐’Š + ๐‘ฝ๐’ƒ
The transistors in the music circuit operate such that one conducts for the positive half cycle
and the other conducts for the negative half cycle, thus producing a full cycle of output
signal. This high power output signal from the transistors is then used to drive a speaker or
subwoofer of low impedance. Therefore, when a small input current is fed between the base
and emitter, you get a much larger output current flowing between the emitter and the
collector. So the weak signal is fed into the base and you use the output from the collector to
drive a speaker. The biasing for the transistors is provided by the diodes as well as the 1Kโ„ฆ
resistors. This arrangement biases the transistors just above cut off and reduces the crossover
distortion.
I then built the model in XCOS and below is a picture of that model.
Music Circuit XCOS Model
57
I then ran the simulation however the simulation did not produce the desired output and I
received an error message which are shown below;
Scilab Error Message
Music Circuit Scope Results
Clearly there is a problem which I think is a timing problem within the simulation and
whatever I try, the problem could not be rectified. Therefore, I built the same circuit within
Multisim and below is a picture of that model.
Music Circuit Multisim Model
58
I then set the frequency to 6kHz which can be seen in the picture below;
Function Generator Parameters Block
Next I ran the simulation and below are the results I achieved.
Music Circuit Output Scope Results
As we can see from the above results the smaller trace is the input signal and the bigger one
is the output signal. It is clear that the input signal has been amplified as it is now around
twice as big as the input signal.
Throughout this part of my investigations I learned about the different sections within a
music amplifier. I learned about an AC coupled non inverting amplifier with split resistors
and how to calculate the output response. Even though I could not achieve an adequate
response in XCOX, I believe I built a model in Multisim that produces an output that is
adequate.
59
Part 7
Code Generation
As I mentioned earlier, C code can be generated by building and simulating models. Where
the code for a specific function can be inputted into Scilab such as a filter, like for the
response of the Butterworth filter at the end of part 1 and even the FFT program used in the
filter investigations is generated from code. The FFT file can be opened in SciNotes and this
can be seen below.
FFT Code
To generate code for a specific model I first needed to download some software call X2C
which is an open source code generator for Scilab/XCOS and then I followed the installation
instructions to pair X2C with Scilab. This loaded the X2C libraries into the Scilab console
window and within the file explorer I loaded a demo model for an LED that was to be
switched on and off with a square-wave input. The path of the location for the demo is in the
picture below and a picture of the demo model is on the next page.
Scilab File Browser(a)
60
X2C Demo Model Generated in XCOS
I then double clicked on the start communicator box which opened the controller and then I
double clicked on the other orange box which loads it into the controller. Next I clicked the
create code tab on the controller and this created the files, X2C.c and X2C.h. This can be
seen in the picture below;
Scilab File Browser(b)
Next I right clicked on both files, then opened both files in SciNote and the X2C.c files code
can be seen on the next few pages.
61
X2C.c Code
62
X2C.c Code (continued)
63
X2C.c Code (continued)
As we can see from the previous couple of pages the code that has been generated and this
along with the X2C.h file can be uploaded into software like MPLabX for example, where it
can be uploaded into a microcontroller via a programmer or development board. With some
changes to the code the model could be altered to react differently and this is handy when
time is limited to build a new circuit.
Throughout this part of my investigations I learned about how C code can be generated from
different models with XCOS and X2C. This extremely handy as you can simulate numerous
models, then convert the model to code and upload the code to a microcontroller.
64
Conclusion
To conclude these investigations went well and I learned a lot. Electronic systems are all
around us and an important part of the modern world. This report introduced me to ways, to
control the output of circuits such as how the various ways an op amp can be configured to
produce a desired response. I also learned that simulation software was excellent for the
purpose of my investigations and I believe I was successful acquiring the correct output
responses.
As mentioned, I learned about the various ways to control the output of op amps and the
different configurations the op amps can be connected in. I simulated various filters, learned
how to calculate the cut off frequencies and about how balanced line drivers remove noise
from the system. I also covered a blood pressure monitor learning how it works and the effect
of noise on the system.
With the AM receiver simulation, the outputs showed me the information signal being fed
into the circuit and when combined with a carrier signal the output is a modulated signal. It is
then demodulated and this signal is amplified ready to be received. I also learned about the
various parts of the AM receiver circuit and what their operation was.
The Flyback converter simulation taught me about switched mode power supplies and the
advantages that comes with the circuit. I also learned about PID controllers, with their
individual sub-systems that combine to create the PID output that was expected and how it
can be constructed using op amps with proportional, integration and differentiator amplifiers.
My investigations of the music circuit, was difficult as I could not get the simulation to run in
XCOS, however I did manage to simulate the circuit in Multisim where I learned about an
AC coupled inverting amplifier with split resistors and what the function of the transistors
within the circuit was.
Finally, with regards to code generation I learned that with the assistance of X2C software,
which is a code generator for Scilab/XCOS, I can build a model and then convert it into some
C code. This code can then be opened in some software like MPLabX and then be uploaded
into a microcontroller via a programmer or development board.
All together I have learned a lot this semester and although XCOS was tricky to use, I still
simulated almost all circuits in XCOS. If I could not, I used Multisim to complete my
investigations and it should hold me in good stead throughout what I hope to be a long career,
because electronic systems are embedded throughout industry.
65
References
Ece.rice.edu. (2016) Experiment 5.2 Voltage Amplifiers. [Internet], Available from:
<http://www.ece.rice.edu/~jdw/243_lab/exp5.2.html> [Accessed 28th April 2016].
Electronicshub.org. (2015) Active Low Pass Filter. [Internet], Available from:
<http://www.electronicshub.org/active-low-pass-filter/> [Accessed 30th April 2016].
Electronics Tutorials. (2016) Passive Band Pass Filter. [Internet], Available from:
<http://www.electronics-tutorials.ws/filter/filter_4.html> [Accessed 30th April 2016].
Open Music Labs. (2016) Op-Amps: Part ii. [Internet], Available from:
<http://www.openmusiclabs.com/learning/analog/op-amps-part-ii/> [Accessed 28th April
2016].
Poole, I. (2016) Non-inverting amplifier circuit using an op-amp. [Internet], Available
from; <http://www.radio-electronics.com/info/circuits/opamp_non_inverting/op_amp_non-
inverting.php> [Accessed 28th April 2016].
Stack Exchange Inc. (2016) Inverting buffer with op-amps. [Internet], Available from:
<http://electronics.stackexchange.com/questions/148356/inverting-buffer-with-op-amps>
[Accessed 28th April 2016].
Whitbread, M, (2016) Electronic Systems: Module Handbook. [Internet], Available from:
<Moodle> [Accessed 28th April 2016].

More Related Content

What's hot

Op amp comparator
Op amp comparatorOp amp comparator
Op amp comparatorAhmadoof
ย 
Presentation on Op-amp by Sourabh kumar
Presentation on Op-amp by Sourabh kumarPresentation on Op-amp by Sourabh kumar
Presentation on Op-amp by Sourabh kumarSourabh Kumar
ย 
Operational amplifiers
Operational amplifiersOperational amplifiers
Operational amplifiersamritash10
ย 
Lab 2 Report More Linear Operational Amplifiers
Lab 2 Report More Linear Operational AmplifiersLab 2 Report More Linear Operational Amplifiers
Lab 2 Report More Linear Operational AmplifiersKatrina Little
ย 
Chapter 5 operational amplifier
Chapter 5 operational amplifierChapter 5 operational amplifier
Chapter 5 operational amplifierHattori Sidek
ย 
Lab 4 Report Switching Voltage Regulators
Lab 4 Report Switching Voltage Regulators Lab 4 Report Switching Voltage Regulators
Lab 4 Report Switching Voltage Regulators Katrina Little
ย 
Buffer op amplifier
Buffer op amplifierBuffer op amplifier
Buffer op amplifiervaibhav jindal
ย 
10.5.4 Voltage Regulation
10.5.4 Voltage Regulation10.5.4 Voltage Regulation
10.5.4 Voltage Regulationguest2749c1f
ย 
Op amp-electronics
Op amp-electronicsOp amp-electronics
Op amp-electronicshumakhan1357
ย 
Lab 5 Report Precision Diodes and Applications
Lab 5 Report Precision Diodes and ApplicationsLab 5 Report Precision Diodes and Applications
Lab 5 Report Precision Diodes and ApplicationsKatrina Little
ย 
Eet3082 binod kumar sahu lecturer_23
Eet3082 binod kumar sahu lecturer_23Eet3082 binod kumar sahu lecturer_23
Eet3082 binod kumar sahu lecturer_23BinodKumarSahu5
ย 
Lab 7 Report Voltage Comparators and Schmitt Triggers
Lab 7 Report Voltage Comparators and Schmitt TriggersLab 7 Report Voltage Comparators and Schmitt Triggers
Lab 7 Report Voltage Comparators and Schmitt TriggersKatrina Little
ย 
Sem2 ic b1_op_amp
Sem2 ic b1_op_ampSem2 ic b1_op_amp
Sem2 ic b1_op_ampJitin Pillai
ย 
Operational amplifier parameters
Operational amplifier parametersOperational amplifier parameters
Operational amplifier parametersUshaRani289
ย 
Negative feedback Amplifiers
Negative feedback AmplifiersNegative feedback Amplifiers
Negative feedback AmplifiersYeshudas Muttu
ย 
Lab 8
Lab 8Lab 8
Lab 8Andy Chu
ย 
Op amp as differentiator
Op amp as differentiator Op amp as differentiator
Op amp as differentiator hepzijustin
ย 
Lab 3 Report Linear Voltage Regulators
Lab 3 Report Linear Voltage RegulatorsLab 3 Report Linear Voltage Regulators
Lab 3 Report Linear Voltage RegulatorsKatrina Little
ย 
Feedbacck Amplifier
Feedbacck AmplifierFeedbacck Amplifier
Feedbacck AmplifierBhaskar Kumar Jha
ย 

What's hot (20)

Op amp comparator
Op amp comparatorOp amp comparator
Op amp comparator
ย 
Presentation on Op-amp by Sourabh kumar
Presentation on Op-amp by Sourabh kumarPresentation on Op-amp by Sourabh kumar
Presentation on Op-amp by Sourabh kumar
ย 
Operational amplifiers
Operational amplifiersOperational amplifiers
Operational amplifiers
ย 
Lab 2 Report More Linear Operational Amplifiers
Lab 2 Report More Linear Operational AmplifiersLab 2 Report More Linear Operational Amplifiers
Lab 2 Report More Linear Operational Amplifiers
ย 
Chapter 5 operational amplifier
Chapter 5 operational amplifierChapter 5 operational amplifier
Chapter 5 operational amplifier
ย 
Lab 4 Report Switching Voltage Regulators
Lab 4 Report Switching Voltage Regulators Lab 4 Report Switching Voltage Regulators
Lab 4 Report Switching Voltage Regulators
ย 
Lab1
Lab1Lab1
Lab1
ย 
Buffer op amplifier
Buffer op amplifierBuffer op amplifier
Buffer op amplifier
ย 
10.5.4 Voltage Regulation
10.5.4 Voltage Regulation10.5.4 Voltage Regulation
10.5.4 Voltage Regulation
ย 
Op amp-electronics
Op amp-electronicsOp amp-electronics
Op amp-electronics
ย 
Lab 5 Report Precision Diodes and Applications
Lab 5 Report Precision Diodes and ApplicationsLab 5 Report Precision Diodes and Applications
Lab 5 Report Precision Diodes and Applications
ย 
Eet3082 binod kumar sahu lecturer_23
Eet3082 binod kumar sahu lecturer_23Eet3082 binod kumar sahu lecturer_23
Eet3082 binod kumar sahu lecturer_23
ย 
Lab 7 Report Voltage Comparators and Schmitt Triggers
Lab 7 Report Voltage Comparators and Schmitt TriggersLab 7 Report Voltage Comparators and Schmitt Triggers
Lab 7 Report Voltage Comparators and Schmitt Triggers
ย 
Sem2 ic b1_op_amp
Sem2 ic b1_op_ampSem2 ic b1_op_amp
Sem2 ic b1_op_amp
ย 
Operational amplifier parameters
Operational amplifier parametersOperational amplifier parameters
Operational amplifier parameters
ย 
Negative feedback Amplifiers
Negative feedback AmplifiersNegative feedback Amplifiers
Negative feedback Amplifiers
ย 
Lab 8
Lab 8Lab 8
Lab 8
ย 
Op amp as differentiator
Op amp as differentiator Op amp as differentiator
Op amp as differentiator
ย 
Lab 3 Report Linear Voltage Regulators
Lab 3 Report Linear Voltage RegulatorsLab 3 Report Linear Voltage Regulators
Lab 3 Report Linear Voltage Regulators
ย 
Feedbacck Amplifier
Feedbacck AmplifierFeedbacck Amplifier
Feedbacck Amplifier
ย 

Viewers also liked

Design & Construction of Switched Mode Power Supplies
Design & Construction of Switched Mode Power Supplies Design & Construction of Switched Mode Power Supplies
Design & Construction of Switched Mode Power Supplies Sachin Mehta
ย 
Logic families 1
Logic families 1Logic families 1
Logic families 1Amierulz Zuhdi
ย 
Rs 232 interface
Rs 232 interfaceRs 232 interface
Rs 232 interfacePREMAL GAJJAR
ย 
Max 232
Max 232Max 232
Max 232Samarth
ย 
Uart
UartUart
Uartsean chen
ย 
Max 232
Max 232Max 232
Max 232Atul Uttam
ย 
Digital communication viva questions
Digital communication viva questionsDigital communication viva questions
Digital communication viva questionsishan0019
ย 
Digital Communication
Digital CommunicationDigital Communication
Digital CommunicationSujina Ummar
ย 
5 use adverbs of duration in sentences
5 use adverbs of duration in sentences5 use adverbs of duration in sentences
5 use adverbs of duration in sentencesJennifer Maderazo
ย 

Viewers also liked (13)

Design & Construction of Switched Mode Power Supplies
Design & Construction of Switched Mode Power Supplies Design & Construction of Switched Mode Power Supplies
Design & Construction of Switched Mode Power Supplies
ย 
Logic families 1
Logic families 1Logic families 1
Logic families 1
ย 
Rs 232 interface
Rs 232 interfaceRs 232 interface
Rs 232 interface
ย 
Max 232
Max 232Max 232
Max 232
ย 
Uart
UartUart
Uart
ย 
Max 232
Max 232Max 232
Max 232
ย 
Rs 232 y rs-485
Rs 232 y rs-485Rs 232 y rs-485
Rs 232 y rs-485
ย 
TTL(Transistor Transistor Logic)
TTL(Transistor Transistor Logic)TTL(Transistor Transistor Logic)
TTL(Transistor Transistor Logic)
ย 
Digital communication viva questions
Digital communication viva questionsDigital communication viva questions
Digital communication viva questions
ย 
RS 232
RS 232RS 232
RS 232
ย 
Digital Communication
Digital CommunicationDigital Communication
Digital Communication
ย 
5 use adverbs of duration in sentences
5 use adverbs of duration in sentences5 use adverbs of duration in sentences
5 use adverbs of duration in sentences
ย 
ASk,FSK,PSK
ASk,FSK,PSKASk,FSK,PSK
ASk,FSK,PSK
ย 

Similar to Electronic Systems report

Voltage Amplifier
Voltage Amplifier Voltage Amplifier
Voltage Amplifier jawad ahmad
ย 
Op ampdesignfinalproject
Op ampdesignfinalprojectOp ampdesignfinalproject
Op ampdesignfinalprojectJeff Webb
ย 
Operational amplifier
Operational amplifierOperational amplifier
Operational amplifiershire ali
ย 
computer-science_engineering_analog-digital-electronics_classification-of-amp...
computer-science_engineering_analog-digital-electronics_classification-of-amp...computer-science_engineering_analog-digital-electronics_classification-of-amp...
computer-science_engineering_analog-digital-electronics_classification-of-amp...HarshSharma117268
ย 
Continuous Low Pass Filter Realization using Cascaded stages of Tow-Thomas Bi...
Continuous Low Pass Filter Realization using Cascaded stages of Tow-Thomas Bi...Continuous Low Pass Filter Realization using Cascaded stages of Tow-Thomas Bi...
Continuous Low Pass Filter Realization using Cascaded stages of Tow-Thomas Bi...Karthik Rathinavel
ย 
Common emitter amplifier by YEASIN NEWAJ
Common emitter amplifier by YEASIN NEWAJCommon emitter amplifier by YEASIN NEWAJ
Common emitter amplifier by YEASIN NEWAJYeasinNewaj
ย 
2 ee414 - adv electroncs - lab 1 - loren schwappach
2   ee414 - adv electroncs - lab 1 - loren schwappach2   ee414 - adv electroncs - lab 1 - loren schwappach
2 ee414 - adv electroncs - lab 1 - loren schwappachLoren Schwappach
ย 
Ee321 lab expt 7_negative_feedback_in_ amplifiers
Ee321 lab expt 7_negative_feedback_in_ amplifiersEe321 lab expt 7_negative_feedback_in_ amplifiers
Ee321 lab expt 7_negative_feedback_in_ amplifierssagarchawla76
ย 
Operational Amplifiers
Operational AmplifiersOperational Amplifiers
Operational Amplifierstaruntiru
ย 
Switching Voltage Regulator
Switching Voltage RegulatorSwitching Voltage Regulator
Switching Voltage Regulatoribercovich
ย 
Oscillator Circuit using Multisim Software
Oscillator Circuit using Multisim SoftwareOscillator Circuit using Multisim Software
Oscillator Circuit using Multisim Softwarerishiteta
ย 
Unit-I Characteristics of opamp
Unit-I Characteristics of opampUnit-I Characteristics of opamp
Unit-I Characteristics of opampDr.Raja R
ย 
Positive feedback: Oscillators
Positive feedback: OscillatorsPositive feedback: Oscillators
Positive feedback: OscillatorsYeshudas Muttu
ย 

Similar to Electronic Systems report (20)

Operational amplifier
Operational amplifierOperational amplifier
Operational amplifier
ย 
Sarah
SarahSarah
Sarah
ย 
Voltage Amplifier
Voltage Amplifier Voltage Amplifier
Voltage Amplifier
ย 
Op ampdesignfinalproject
Op ampdesignfinalprojectOp ampdesignfinalproject
Op ampdesignfinalproject
ย 
Operational amplifier
Operational amplifierOperational amplifier
Operational amplifier
ย 
Operational amplifier part 01
Operational amplifier part 01Operational amplifier part 01
Operational amplifier part 01
ย 
Oscillator.pptx
Oscillator.pptxOscillator.pptx
Oscillator.pptx
ย 
computer-science_engineering_analog-digital-electronics_classification-of-amp...
computer-science_engineering_analog-digital-electronics_classification-of-amp...computer-science_engineering_analog-digital-electronics_classification-of-amp...
computer-science_engineering_analog-digital-electronics_classification-of-amp...
ย 
Continuous Low Pass Filter Realization using Cascaded stages of Tow-Thomas Bi...
Continuous Low Pass Filter Realization using Cascaded stages of Tow-Thomas Bi...Continuous Low Pass Filter Realization using Cascaded stages of Tow-Thomas Bi...
Continuous Low Pass Filter Realization using Cascaded stages of Tow-Thomas Bi...
ย 
Common emitter amplifier by YEASIN NEWAJ
Common emitter amplifier by YEASIN NEWAJCommon emitter amplifier by YEASIN NEWAJ
Common emitter amplifier by YEASIN NEWAJ
ย 
Pagra
PagraPagra
Pagra
ย 
2 ee414 - adv electroncs - lab 1 - loren schwappach
2   ee414 - adv electroncs - lab 1 - loren schwappach2   ee414 - adv electroncs - lab 1 - loren schwappach
2 ee414 - adv electroncs - lab 1 - loren schwappach
ย 
opamp
opampopamp
opamp
ย 
Ee321 lab expt 7_negative_feedback_in_ amplifiers
Ee321 lab expt 7_negative_feedback_in_ amplifiersEe321 lab expt 7_negative_feedback_in_ amplifiers
Ee321 lab expt 7_negative_feedback_in_ amplifiers
ย 
Operational Amplifiers
Operational AmplifiersOperational Amplifiers
Operational Amplifiers
ย 
Switching Voltage Regulator
Switching Voltage RegulatorSwitching Voltage Regulator
Switching Voltage Regulator
ย 
Oscillator Circuit using Multisim Software
Oscillator Circuit using Multisim SoftwareOscillator Circuit using Multisim Software
Oscillator Circuit using Multisim Software
ย 
Unit-I Characteristics of opamp
Unit-I Characteristics of opampUnit-I Characteristics of opamp
Unit-I Characteristics of opamp
ย 
Report
ReportReport
Report
ย 
Positive feedback: Oscillators
Positive feedback: OscillatorsPositive feedback: Oscillators
Positive feedback: Oscillators
ย 

Electronic Systems report

  • 2. 1 Contents Introductionโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆp2 Part 1 Inverting Op Ampโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p3 Inverting Bufferโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p7 Non-Inverting Amplifierโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ..โ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p9 Non-Inverting Bufferโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ..โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p14 Low Pass Filterโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p15 High Pass Filterโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p18 Band Pass Filterโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p20 Butterworth Filterโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆ.โ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p23 Chebyshev Filterโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.....โ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p27 Integration Amplifierโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p30 Differentiator Amplifierโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ..โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p32 Balanced Line Driverโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆ...โ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p34 Part 2 Blood Pressure Monitorโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ..โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...p40 Part 3 Simple AM Receiverโ€ฆโ€ฆโ€ฆ.โ€ฆ.โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ..โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ..p43 Part 4 Switched Mode Power Supply (Flyback Converter)โ€ฆโ€ฆ..โ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p47 Part 5 PID Controllerโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p49 Part 6 Music Circuitโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p55 Part 7 Code Generationโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ...โ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p59 Conclusionโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p64 Referencesโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆโ€ฆ.p65
  • 3. 2 Introduction Electronic systems can be found all around us in everyday life, like for example in a stereo system or a blood pressure monitor. They can be defined as the interconnection of parts or components that processes information that has been inputted from various devices such as sensors or computers to various types of outputs by electronic means. For this report I was tasked with the investigation of various aspects of electronic systems mainly revolving around op amps. Throughout the semester I simulated and tested various systems to verify the outputs and recorded the results to analyse the data collected, to confirm the circuit was working as expected. These investigations involved building various electronic systems within Scilab/XCOS, which is a piece of simulation software to test the circuit. I also used Multisim to try simulate some models that I could not get working in Scilab. The investigations contained seven parts and they are; Various Op Amp Circuits Blood Pressure Monitor Simple AM Receiver Switch Mode Power Supply PID Controller Music Circuit Code Generation This report was created to document the various stages of my investigations and were carried out by simulating the various systems in the lab on a PC or on my laptop.
  • 4. 3 Part 1 For this part of my investigations I was tasked with modelling variations of the op-amp circuit. Inverting Op Amp The first one I simulated was the inverting amplifier and below is a schematic diagram. Inverting Amplifier Schematic Diagram (Ece.rice.edu, 2016, accessed 2016) The gain of an inverting amplifier is controlled by using external components which are an input resistor(R1) and a feedback resistor(RF). The ratio between these resistances set the gain. Also the point where the input and feedback resistors meet is known as a virtual earth and can be thought of as 0 Volts. The input is connected to the inverting input on the op-amp therefore the output would be inverted too. We can calculate the gain with the following formula; (๐‘น ๐น) (๐‘น๐Ÿ) = โˆ’๐‘ฎ๐’‚๐’Š๐’(๐‘จ) As we can see from the formula the feedback resistor divided by the input resistor gives the gain but it is a negative number and this is because it is inverted. I built the model for the inverting amplifier in XCOS with a gain of 100 and can be seen below; Inverting Amplifier XCOS Model (100 gain)
  • 5. 4 As we can see from the picture of the model on the previous page the input resistor was set to 1Kโ„ฆ (highlighted in blue) and the feedback resistor was set to 100Kโ„ฆ (highlighted in red). So when I use the formula from the previous page I could calculate what the expected output should be. โˆ’ (๐‘น ๐น) (๐‘น๐Ÿ) = ๐‘ฎ๐’‚๐’Š๐’(๐‘จ) โˆ’ ๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ๐ŸŽ๐ŸŽ ๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ = โˆ’๐Ÿ๐ŸŽ๐ŸŽ ๐‘ฎ๐’‚๐’Š๐’ = โˆ’๐Ÿ๐ŸŽ๐ŸŽ To prove that the gain should be 100, I first altered the final integration time to 1.0E-6 and this is the overall run time for the simulation as seen below XCOS Model Parameters I then ran the simulation in XCOS and below are the scope results for a gain of 100. Inverting Amplifier Scope Results (100 gain)
  • 6. 5 As we can see from the scope results on the previous page, when a 1V, 100KHz signal was injected into the circuit the output is 100 times greater than the input. This proved that the ratio between these two resistors controls the gain. I then altered the feedback resistor to 50Kโ„ฆ to alter the gain down from 100 to 50 and this can be seen below. Inverting Amplifier XCOS Model (50 gain) I then ran the simulation and below are the scope results. Inverting Amplifier Scope Results (50 gain)
  • 7. 6 As we can see from the scope results on the previous page, when a 1V, 100KHz signal was injected into the circuit the output is now 50 times greater than the input. This proves that the ratio between these two resistors controls the gain. Next I tried setting the resistance of both to the same value and this would give a gain of 1. This can be seen on the next page. Inverting Amplifier XCOS Model (1 gain) I then ran the simulation and below are the scope results. Inverting Amplifier Scope Results (1 gain) As we can see from the scope results when a 1V, 100KHz signal was injected into the circuit the output was the same as the input. This proved that the ratio between these two resistors once again controls the gain. Therefore, we can see the inverting amplifier uses negative feedback to accurately control the overall gain of the amplifier.
  • 8. 7 Inverting Buffer Next I simulated an inverting buffer and this circuit is exactly the same as an inverting amplifier. The inverting buffer is a single input device which produces the state opposite the input. If the input is high, the output is low and vice versa. Below is a schematic diagram for an inverting buffer. Inverting Buffer Schematic Diagram (Stack Exchange Inc, 2016, accessed 2016) As we can see from the above schematic the circuit is exactly the same as for an inverting amplifier except this time, the value of the feedback and input resistors would be identical therefore giving a gain of 1. I built the model for the inverting buffer in XCOS with an input of 1KHz and can be seen below; Inverting Buffer XCOS Model (1KHz) As we can see the frequency was set in rad/s and 6284 rad/s is equal to 1KHz. I then ran the simulation and the scope results can be seen on the next page.
  • 9. 8 Inverting Buffer Scope Results (1KHz) Next I was tasked with raising the input to a frequency of 150KHz and adjust the scope clock accordingly. Below is a picture of that model. Inverting Buffer XCOS Model (150KHz) As we can see from the picture above, I altered the input frequency to 942477.795 rad/s which is equal to 150KHz and the scope clock was changed from 1e-5s to 1e-6s. Also both resistors were set to 10Kโ„ฆ and I then ran the simulation. The scope results can be seen on the next page.
  • 10. 9 Inverting Buffer Scope Results (150KHz) As we can see from the scope results that the clock was adjusted accordingly and after I had magnified the results I could see that the signals frequency had increased greatly. Non-Inverting Amplifier I then simulated a non-inverting amplifier and a schematic diagram can be seen below; Non-inverting Amplifier Schematic Diagram (Ece.rice.edu, 2016, accessed 2016) As we can see from the schematic, unlike the inverting amplifier the input voltage signal is applied directly to the non-inverting input on the op-amp and means the output gain would be positive in value. We can calculate the gain with the following formula; ๐Ÿ + (๐‘น2) (๐‘น๐Ÿ) = ๐‘ฎ๐’‚๐’Š๐’(๐‘จ) As we can see from the formula, the feedback resistor divided by the input resistor gives the gain but this time 1 is added to it. Therefore, the output is controlled by the ratio of the resistors similar to the inverting amplifier but the sum has 1 added to it. I then built the model for the non-inverting amplifier in XCOS with a gain of 11 and can be seen on the next page.
  • 11. 10 Non-Inverting Amplifier XCOS Model (11 gain) As we can see the feedback resistor was set to 10Kโ„ฆ and R1 set to 1Kโ„ฆ, which should give an output signal 11 times greater than the input. So when we use the formula from the previous page we can calculate what the expected output should be. ๐Ÿ + (๐‘น2) (๐‘น๐Ÿ) = ๐‘ฎ๐’‚๐’Š๐’(๐‘จ) ๐Ÿ + ๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ๐ŸŽ ๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ = ๐Ÿ๐Ÿ ๐‘ฎ๐’‚๐’Š๐’ = ๐Ÿ๐Ÿ I then ran the simulation and the scope results can be seen below. Non-Inverting Amplifier Scope Results (11 gain) As we can see from the scope results above, the output gain was 11 which proved that the circuit was working as a non-inverting amplifier.
  • 12. 11 Next I was tasked with varying the gain to 1, 2 and 20. Below is the model for a gain of 1. Non-Inverting Amplifier XCOS Model (1 gain) As we can see from the picture above R1 was set to 100Kโ„ฆ and R2 was set to 1Kโ„ฆ. Therefore, when using the formula from the previous page we can calculate what the output gain would be. ๐Ÿ + (๐‘น2) (๐‘น๐Ÿ) = ๐‘ฎ๐’‚๐’Š๐’(๐‘จ) ๐Ÿ + ๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ ๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ๐ŸŽ๐ŸŽ = ๐Ÿ. ๐ŸŽ๐Ÿ ๐‘ฎ๐’‚๐’Š๐’ = ๐Ÿ. ๐ŸŽ๐Ÿ As the ratio of the resistors can never be zero, 1.01 is the closest to 1 that I could simulate without increasing the value of resistance further. Next I ran the simulation and below are the scope results. Non-Inverting Amplifier Scope Results (1 gain)
  • 13. 12 As we can see from the scope results on the previous page the output gain is around 1. Next I altered the values for the resistors to produce a gain of 2 and below is a picture of the XCOS model. Non-Inverting Amplifier XCOS Model (2 gain) As we can see from the picture above R2 and R1 was set to 1Kโ„ฆ therefore when using the formula, we can calculate what the output gain would be. ๐Ÿ + (๐‘น2) (๐‘น๐Ÿ) = ๐‘ฎ๐’‚๐’Š๐’(๐‘จ) ๐Ÿ + ๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ ๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ = ๐Ÿ ๐‘ฎ๐’‚๐’Š๐’ = ๐Ÿ Next I ran the simulation and below are the scope results. Non-Inverting Amplifier Scope Results (2 gain)
  • 14. 13 As we can see from the scope results on the previous page the output gain is exactly 2. Next I altered the values for the resistors to produce a gain of 20 and below is a picture of the XCOS model. Non-Inverting Amplifier XCOS Model (20 gain) As we can see from the picture above R2 was set to 19Kโ„ฆ and R1 was set to 1Kโ„ฆ. Therefore, when using the formula from the previous page we can calculate what the output gain would be. ๐Ÿ + (๐‘น2) (๐‘น๐Ÿ) = ๐‘ฎ๐’‚๐’Š๐’(๐‘จ) ๐Ÿ + ๐Ÿ๐Ÿ—๐ŸŽ๐ŸŽ๐ŸŽ ๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ = ๐Ÿ๐ŸŽ ๐‘ฎ๐’‚๐’Š๐’ = ๐Ÿ๐ŸŽ I then ran the simulation and below are the scope results. Non-Inverting Amplifier Scope Results (20 gain) As we can see from the scope results on the previous page the output gain is exactly 20.
  • 15. 14 Non-Inverting Buffer Next I simulated a non-inverting amplifier and a schematic diagram can be seen below; Non-Inverting Buffer Schematic Diagram (Open Music Labs, 2016, accessed 2016) The non-inverting buffer is a single input device which has a gain of 1, mirroring the input at the output. It has value for impedance matching and for isolation of the input and output. Therefore, a Buffer is an amplifier which has a gain of unity, a high input impedence and low output impedence. It can be used as a bridge between two circuits, where one circuit has a high output impedence and the other circuit has a low input impedence. The buffer would prevent the second circuit from interfering with the first circuit working correctly. We can calculate the gain with the following formula; ๐‘ฎ๐’‚๐’Š๐’( ๐‘จ) = (๐‘ฝ๐’๐’–๐’•) (๐‘ฝ๐’Š๐’) = +๐Ÿ I then built the model for the non-inverting buffer in XCOS and can be seen below. Non-Inverting Buffer XCOS Model
  • 16. 15 As we can see in the picture on the previous page, the feedback loop is without a resistor therefore this creates direct feedback so the gain should be equal to 1. The buffer can replicate weak signals however it can drive enough current to be further amplified if needed. I then ran the simulation and below are the scope results. Non-Inverting Buffer Scope Results As we can see from the scope results that the output signal gain is equal to 1, as the output was the same as the input. Low Pass Filter Next I simulated a 1st Order Low Pass Filter and a schematic diagram can be seen below; 1st Order Low Pass Filter Schematic Diagram (Electronicshub.org, 2015, accessed 2016) A first-order low pass active filter consists simply of a passive RC filter stage providing a low frequency path to the input of a non-inverting buffer giving it a DC gain of one, Av = +1 or unity gain. The cut off frequency for a low pass filter can be calculated with the following formula; ๐Ÿ ๐Ÿ๐…๐‘น๐‘ช = ๐‘ช๐’–๐’• ๐’๐’‡๐’‡ ๐’‡๐’“๐’†๐’’๐’–๐’†๐’๐’„๐’š
  • 17. 16 I then built the model for the Low Pass Filter in XCOS and this can be seen below. Low Pass Filter XCOS Model As we can see from the model, the configuration of the 10Kโ„ฆ resistor and 100nf capacitor is for a low pass filter and once the signal has travelled through the filter it is then fed into a non-inverting amplifier. I then ran the simulation and below are the scope results. Low Pass Filter Scope Results This information could be analysed further by using a program to process the matrix A in the workspace. I then executed the program FFTProg.sce in the Scilab console window. This program will print the matrix, plot it and show the Fast Fourier Transform (FFT). The FFT scope results can be seen on the next page.
  • 18. 17 Low Pass Filter FFT Scope Results(a) Low Pass Filter FFT Scope Results(b) From these FFT scope results, I could see the circuit was acting as a Low-pass filter allowing the lower frequencies to pass while beginning to block the signal at around 110KHz.
  • 19. 18 High Pass Filter Next I simulated a 1st Order High Pass Filter and a schematic diagram can be seen below; 1st Order High Pass Filter Schematic Diagram (Electronicshub.org, 2015, accessed 2016) As we can see from the schematic diagram, a first-order high pass active filter consists simply of a passive CR filter stage providing a high frequency path to the input of a non-inverting buffer giving it a DC gain of one, Av = +1 or unity gain. The cut off frequency for a high pass filter can be calculated with the following formula; ๐Ÿ ๐Ÿ๐…๐‘น๐‘ช = ๐‘ช๐’–๐’• ๐’๐’‡๐’‡ ๐’‡๐’“๐’†๐’’๐’–๐’†๐’๐’„๐’š I then built the model for a high pass filter in XCOS and this can be seen below. High Pass Filter XCOS Model As we can see from the model, the configuration of the 100nf capacitor and 10Kโ„ฆ resistor is for a high pass filter and once the signal has travelled through the filter it is then fed into a non-inverting amplifier. I then ran the simulation and the scope results can be seen on the next page.
  • 20. 19 High Pass Filter Scope Results(a) High Pass Filter Scope Results(b) This information could be analysed further by using the FFT program to process the matrix A in the workspace. I then executed the program FFTProg.sce in the Scilab console window. This program then printed the matrix, plotted it and showed the FFT. The FFT scope results can be seen on the next page. High Pass Filter FFT Scope Results(a)
  • 21. 20 High Pass Filter FFT Scope Results(b) From these FFT scope results, I could see the circuit was acting as a high pass filter allowing the higher frequencies to pass while beginning to block the signal at lower frequencies. Band Pass Filter Next I simulated a 1st Order Band Pass Filter and a schematic diagram can be seen below; 1st Order Band Pass Filter Schematic Diagram (Electronics Tutorials, 2016, accessed 2016) As we can see from the schematic diagram, a first order band pass active filter consists simply of a passive CR high pass filter combined with a passive RC low pass filter. The cut off frequencies for low pass and high pass filters can be calculated with the following formula; ๐Ÿ ๐Ÿ๐…๐‘น๐‘ช = ๐‘ช๐’–๐’• ๐’๐’‡๐’‡ ๐’‡๐’“๐’†๐’’๐’–๐’†๐’๐’„๐’š These 2 cut off frequencies are then combined to create a band pass where the cut off frequency for the high pass filter would be the start of the band pass and the cut off frequency for the low pass would be the end of the band pass. Therefore, only signals above or below these two cut off frequencies would be allowed to pass through the circuit. I then built the model for a band pass filter in XCOS and this can be seen on the next page.
  • 22. 21 Band Pass Filter XCOS Model As we can see from the model, the configuration of the high pass filter and then the low pass filter. I then ran the simulation and the scope results can be seen on the below. Band Pass Filter Scope Results(a) Band Pass Filter Scope Results(b)
  • 23. 22 The information from the scope results could be analysed further by using the FFT program to process the matrix A in the workspace. I then executed the program FFTProg.sce in the Scilab console window. This program then printed the matrix, plotted it and showed the FFT. The FFT scope results can be seen below. Band Pass Filter FFT Scope Results(a) Band Pass Filter FFT Scope Results(b) From these FFT scope results, I could see the circuit was acting as a band pass filter.
  • 24. 23 Next I was tasked with investigating Butterworth and Chebyshev filters. Butterworth Filters The Butterworth filter is a type of filter used in signal processing and it is designed so the passband has a frequency response that is as flat as possible. The response has no ripples in the response because the passband is designed to have a frequency response which is as flat as mathematically possible from 0Hz until the cut off frequency at -3Db with no ripples. Therefore, the Butterworth design ensures a flat response in the pass band and an adequate roll off. This reason makes the Butterworth filter, the ideal filter to use in audio circuits. The gain for the filter can be calculated with the following formula; ๐‘ฏ( ๐’‹๐Ž) = ๐Ÿ โˆš ๐Ÿ + ๐“”ยฒ( ๐Ž ๐Ž๐’‘ )ยฒโฟ I then built a second order low pass Butterworth filter in XCOS and this can be seen in the picture below. 2nd Order Butterworth Low Pass Filter As we can see from the model, the configuration of the 1Kโ„ฆ resistors and 10nf capacitor is for a second order low pass filter and once the signal has travelled through the filter it is then fed into a non-inverting amplifier. I then ran the simulation and below are the scope results. 2nd Order Butterworth Low Pass Filter Scope Results
  • 25. 24 The information from the scope results could be analysed further by using the FFT program to process the matrix A in the workspace. I then executed the program FFTProg.sce in the Scilab console window. This program then printed the matrix, plotted it and showed the FFT. The FFT scope results can be seen below. 2nd Order Butterworth Low Pass Filter FFT Scope Results(a) 2nd Order Butterworth Low Pass Filter FFT Scope Results(b) As we can see from these results, the circuit is behaving like a low pass filter. However, the frequency response is similar to a Chebyshev response with a ripple and no matter what I tried I could not get the simulation to produce the response that was required. Therefore, I built the simulation in Multisim and this can be seen in the picture on the next page.
  • 26. 25 Butterworth Low Pass Filter Multisim Model As we can see from the picture above I built the same 2nd order low pass circuit in Multisim I then ran the simulation and below is the a.c. sweep scope results. Butterworth Low Pass Filter Multisim Scope Results As we can see from these results in Multisim, the response looks more like a Butterworth response where the passband is a lot smoother. However, it still has a slight ripple near the cut off frequency and the roll off should be slightly steeper so it is still not reacting quite as expected.
  • 27. 26 Within Scilab or XCOS when you build and simulate circuits, code can be generated for the circuits. Also you can enter code within the Scilab console window to simulate various circuits and I will explain this further in Part 7. However, you can simulate the Butterworth filter frequency response by entering the following code; //squared magnitude response of Butterworth filter h=buttmag(13,300,1:1000); mag=20*log(h)'/log(10); plot2d((1:1000)',mag,[2],"011"," ",[0,-180,1000,20]) After entering the above code and pressing return, the following response was achieved; Butterworth Low Pass Filter Response Graph As we can see from the graph above what the correct response for a Butterworth low pass filter should look like as there is a flat passband with no ripple and an adequate roll off.
  • 28. 27 Chebyshev Filters Chebyshev filters are filters that have a steeper roll off and more of a passband or stopband ripple than Butterworth filters. They minimize the error between the idealised and the actual filter characteristic over a range of the filter but with ripples in the passband. There are two types of Chebyshev low pass filters. Type 1 has an all pole transfer function, where it has an equi-ripple passband and a monotonically decreasing stopband. A type 2 has both poles and zeros. Its band is monotonically decreasing and it has an equi-ripple stopband. By allowing some ripple in the passband or stopband magnitude response, a Chebyshev filter can achieve a steeper roll off than the same order Butterworth filter. This is the reason this type of filter is not used within audio circuits. The gain for both filters can be calculated with the following formulas; Type 1 ๐‘ฎ๐’( ๐Ž) = ๐Ÿ โˆš๐Ÿ + ๐“”ยฒ๐‘ป๐’ยฒ( ๐Ž ๐Ž๐ŸŽ ) Type 2 ๐‘ฎ๐’( ๐Ž, ๐Ž๐ŸŽ) = ๐Ÿ โˆš ๐Ÿ + ๐Ÿ ๐“”ยฒ๐‘ป๐’ยฒ( ๐Ž๐ŸŽ ๐Ž ) I then built a second order low pass Chebyshev filter in XCOS and this can be seen in the picture below. 2nd Order Chebyshev Low Pass Filter As we can see from the model, the configuration of the 1Kโ„ฆ resistors and 10nf capacitor is for a second order low pass filter and once the signal has travelled through the filter it is then fed into a non-inverting amplifier. I then ran the simulation and on the next page are the scope results.
  • 29. 28 Chebyshev Low Pass Filter Scope Results The information from the scope results could be analysed further by using the FFT program to process the matrix A in the workspace. I then executed the program FFTProg.sce in the Scilab console window. This program then printed the matrix, plotted it and showed the FFT. The FFT scope results can be seen below. Chebyshev Low Pass Filter FFT Scope Results(a) Chebyshev Low Pass Filter FFT Scope Results(b) As we can see from the results on the previous page the output response had a ripple on the passband and a very steep roll off which are characteristics of a Chebyshev response.
  • 30. 29 As I mentioned earlier about generating code for circuits with the Butterworth low pass filter for a frequency response graph, we can do the same for a Chebyshev low pass filter by entering the following code into the console window in Scilab; Type 1 //Chebyshev; ripple in the passband n=13;epsilon=0.2;omegac=3;samples=0:0.05:10; h=cheb1mag(n,omegac,epsilon,samples); plot2d(samples,h) xtitle('','frequencies','magnitude') Type 2 //Chebyshev; ripple in the stopband n=10; omegar=6; A=1/0.2; Samples=0.0001:0.05:10; h2=cheb2mag(n,omegar,A,Samples); plot(Samples,log(h2)/log(10)) xtitle("", "frequencies", "magnitude in dB"); //Plotting of frequency edges minval=(-max(-log(h2)))/log(10); plot2d([omegar;omegar],[minval;0],[2],"000"); //Computation of the attenuation in dB at the stopband edge attenuation=-log(A*A)/log(10); plot2d(Samples',attenuation*ones(Samples)',[5],"000") Both these pieces of code produce the following frequency response graphs as seen below and on the next page. Type 1 Chebyshev Low Pass Filter Response Graph
  • 31. 30 Type 2 Chebyshev Low Pass Filter Response Graph As we can see from the graph above and on the previous page what the correct responses for a Chebyshev low pass filter should look like. In type 1 there is a ripple present on the passband and in type 2 the ripple is after the passband. Integrator Next I investigated integrator and differentiator op amp circuits. An integrator is an op amp circuit that performs the mathematical operation of integration with respect to time, where we can cause the output to respond to changes in the input voltage over time as the op amp integrator produces an output voltage which is proportional to the integral of the input voltage. It integrates and inverts the input voltage Vin(t) over a time period t, t0, <t, <t1, producing an output voltage at time t = t1 of; ๐‘ฝ๐’๐’–๐’•( ๐’•๐Ÿ) = ๐‘ฝ๐’๐’–๐’•( ๐’•๐ŸŽ)โˆ’ ๐Ÿ ๐‘น๐‘ช โˆซ ๐‘ฝ๐’Š๐’( ๐’•) ๐’…๐’• ๐’•๐Ÿ ๐’•๐ŸŽ ๐‘ฝ๐’๐’–๐’• = โˆ’ ๐Ÿ ๐‘น๐‘ช โˆซ ๐‘ฝ๐’Š๐’( ๐’•) ๐’…๐’• ๐’•๐Ÿ ๐’•๐ŸŽ ๐‘ฝ๐’๐’–๐’• = โˆ’ ๐Ÿ ๐’‹๐Ž๐‘น๐‘ช ๐‘ฝ๐’Š๐’ First I built the Integrator circuit in XCOS with a sinusoidal input and below is picture of that model. Integrator Sine-wave XCOS Model
  • 32. 31 I then ran the simulation and below are the scope results. Integrator Sign-wave Scope Results As we can see from the scope results above the output signal from the integrator is out of phase by 90 degrees with the input signal and proved the circuit was working correctly. I then changed the input signal within the model from a sinusoidal to a square wave and below is a picture of my XCOS model. Integrator Square-wave XCOS Model I then ran the simulation and the scope results can be seen on the next page.
  • 33. 32 Integrator Square-wave Scope Results As we can see from the scope results above that the output of the integrator, when the input signal is from a square-wave generator responds in a saw-tooth manner. This proved the circuit was working correctly, as this was the output response I was expecting. Differentiator A Differentiator is an op amp circuit that performs the mathematical operation of differentiation, where it produces a voltage output which is directly proportional to the input voltages rate of change with respect to time. Therefore, the faster or larger the change to the input voltage signal, the greater the current and then greater the output voltage change in response, becoming more of a spike in response. It differentiates the inverted signal over time and the output signal can be calculated with the following formula; ๐‘ฝ๐’๐’–๐’• = โˆ’ ๐‘น๐‘ช ๐’…๐‘ฝ๐’Š๐’ ๐’…๐’• First I built the Integrator circuit in XCOS with a sinusoidal input and below is picture of that model. Differentiator Sine-wave XCOS Model
  • 34. 33 I then ran the simulation and below are the scope results. Differentiator Sine-wave Scope Results(a) As we can see from the graph results above the output signal from the differentiator has changed from a sine wave to a cosine wave and the output is just a fraction of the input signal. I then changed the input signal within the model from a sinusoidal to a square wave and below is a picture of my XCOS model. Differentiator Square-wave XCOS Model I then ran the simulation and the scope results can be seen on the next page.
  • 35. 34 Differentiator Square-wave Scope Results As we can see from the results above that when a square wave is inputted into a differentiator the output now has a spike on it and this is dependant, by the RC time constant. This proved the circuit was working correctly, as this was the output response I was expecting. Differential Balanced Line Driver A balanced line driver uses two wires for the signal, with the signal equal in amplitude in each wire and is opposite in phase. Only the out of phase signal is detected by the remote balanced receiver, and any in phase signal is rejected. Interference such as RF as well as other noise will be picked up equally by both wires in the cable and so will be in phase. It will therefore be rejected by the receiver. In this way, it is possible to have long interconnects, with a shield connected at one end only. By configuring the circuit like this it cuts the earth loop, and the balanced connection ensures that only the wanted signal is passed through to the amplifier. Therefore, a balanced line driver takes an unbalanced signal and converts it to a balanced signal. The balanced signal makes it easier to cancel out the noise, therefore leaving a clean signal. The main advantage of the balanced line format is it has good rejection of any external noise when fed to a differential amplifier. The system usually uses twisted pair conductors to connect a transmitter with a receiver. A balanced line transmitter splits the signal and is usually fed into buffers, one to buffer the signal while the other is to buffer and invert the signal. This creates a balanced signal with the signal on both conductors where when the signal swings positive on one conductor it swings exactly the same amount negative on the other. The balanced line receiver is a differential amplifier which amplifies the difference between the two input signals. By connecting one signal onto the inverting input and one signal to the non-inverting input the resultant output voltage will be proportional to the difference between the two input signals. The Vout of the differential amplifier can be calculated with the following formula; ๐‘ฝ๐’๐’–๐’• = ๐‘น๐Ÿ‘ ๐‘น๐Ÿ (๐‘ฝ๐Ÿ โˆ’ ๐‘ฝ๐Ÿ)
  • 36. 35 In a balanced system the noise would be induced into the centre conductors and the shields signal equally but the noise is cancelled out because the noise is on both of the signal lines and the signal used by the amplifier in the receiver is the difference between the two signal lines. If the noise has a magnitude of 1.5V, the differential amplifier sees 1.5V minus 1.5V equals 0V. Balanced lines work because the noise from surrounding environment is induced into both wires equally and by measuring the difference between the two wires at the receiving end, the original signal can be recovered while the noise is cancelled. I then built the model for a differential balanced line driver in XCOS and this can be seen below. Differential Balanced Line Driver XCOS Model As we can see from the model above, the signal is split with one line inverted before being fed into a receiver which is a differential amplifier. Also within the model is a sinewave generator that simulates noise on in the circuit. I then opened the control parameters block for the sine-wave input signal and set the frequency of the noise to 314 rad/s which is 50Hz. Square-wave Parameters Block 50Hz I then ran the simulation and the scope results can be seen on the next page.
  • 37. 36 Differential Balanced Line Driver 2V 50Hz Noise Signal Scope Results As we can see from the above results the two lines have the signal on them however they are in anti-phase and are beginning to show some effects of noise with the slight curve of the signal. The output signal that was achieved was smooth with no signs of noise and was amplified up from 5V to 10V. This proved the circuit was working correctly and below is a picture of those results. Differential Balanced Line Driver Input & Output Signal Scope Results I then opened the control parameters block for the sine-wave input signal and set the frequency of the noise to 15000 rad/s which is 2387Hz. This can be seen on the next page.
  • 38. 37 Square-wave Parameters Block 2387Hz I then ran the simulation and the scope results can be seen below. Differential Balanced Line Driver 2V 2387Hz Noise Signal Scope Results As we can see from the above results, now that the frequency has been increased the two lines clearly have noise on them and equal amounts of noise is seen on both However, the output signal that was achieved was smooth with no signs of noise and was amplified up from 5V to 10V. This proved the circuit was working and below is a picture of those results. Differential Balanced Line Driver 2V 2387Hz Input & Output Signal Scope Results
  • 39. 38 I then opened the control parameters block for the sine-wave input signal and set the frequency of the noise to 30000 rad/s which is 4775Hz. This can be seen below. Square-wave Parameters Block 4775Hz I then ran the simulation and the scope results can be seen below. Differential Balanced Line Driver 2V 4775Hz Trace Scope B As we can see from the above results, now the frequency of the noise has been increased even more, the signals are showing more distortion and equal amounts of noise on both. However, the output signal that was achieved was smooth with no signs of noise and was amplified up from 5V to 10V. This proved the circuit was working and on the next page is a picture of those results.
  • 40. 39 Differential Balanced Line Driver 2V 4775Hz Trace Scope A RS-485 RS-485 allows multiple devices to communicate at half-duplex on a single pair of wires plus a signal ground wire at distances up to 1200 meters. The function of the signal ground wire is to tie the signal ground of each of the nodes to one common ground. With RS-485, both the length of the network and the number of nodes can easily be extended using a variety of repeater products on the market. On this network data is transmitted differentially on two wires twisted together and this is referred to as a twisted pair. The properties of differential signals provide high noise immunity and long distance capabilities. Only one device at a time can drive the line so when the drivers are not in use they must be put into a high-impedance mode. Some RS-485 hardware handles this automatically and in other cases the RS-485 device software must use a control line to handle the driver. RS-485 software handles addressing, turn-around delay, and possibly the drivers tri-state features of RS-485. Throughout this part of my investigations I learned about various ways op amps can be configured to obtain a desired output response and was able to simulate all of the circuits successfully. Within XCOS, the Butterworth filter was tricky to tune so the output response was smooth and without ripples. However, I believe I built a model in Multisim that produces an output that is adequate.
  • 41. 40 Part 2 Blood Pressure Monitor A blood pressure monitor uses an inflatable air-bladder cuff and a listening device or pressure sensor to measure blood pressure in an artery. The cuff is worn on the upper arm or can nowadays be worn on the wrist. This monitoring can be performed by using either a manually inflated cuff with a stethoscope for listening to arterial wall sounds or a blood pressure monitor that contains a pressure sensor for sensing arterial wall vibrations. For this part of my investigations I built the blood monitor model in XCOS and this can be seen in the picture below; Blood Pressure Monitor XCOS Model(a) In the model as seen above there is a voltage source to simulate a heartbeat and another voltage source to simulate noise on the circuit. The two signals are then combined and after the microphone signal has been buffered, it is then passed through a low pass filter. Next is a ramp function that simulates the signal from the arm cuff. I then ran the simulation and the scope results can be seen below. Blood Pressure Monitor Trace
  • 42. 41 These results simulate a response from a blood pressure monitor and the teeth in the output represent heart beats. The plot shows the rise in pressure from the arm cuff accompanied by the heart beats monitored by a microphone. I then replaced the 15Kโ„ฆ resistor that is connected to the heartbeat mains voltage supply with a variable resistor and this can be seen in the picture below; Blood Pressure Monitor XCOS Model(b) As we can see from the model above that I replaced the resistor with a variable resistor and set the resistance to 50Kโ„ฆ. I then ran the simulation and below are the results. Blood Pressure Monitor Variable Resistor 50Kโ„ฆ Scope Results As we can see from the above results that by increasing the resistance of the variable resistor, then this reduces the heart beat signals. Next I increased the resistance to 100Kโ„ฆ and then 200Kโ„ฆ and the results can be seen on the next page.
  • 43. 42 Blood Pressure Monitor Variable Resistor 100Kโ„ฆ Scope Results Blood Pressure Monitor Variable Resistor 200Kโ„ฆ Scope Results As we can see from both sets of results, that when the resistance is increased this reduces the heartbeat signals. Also when I injected noise into the circuit and the higher the frequency that was inputted, then the simulation took longer to finish running. Throughout this part of my investigations I learned about a blood pressure monitor and how by simulating the pressure in the arm cuff with resistance on the circuit causes the output to become smoother. Also the simulation produced the correct response which proved I had simulated it correctly.
  • 44. 43 Part 3 Simple AM Receiver Amplitude modulation is used in a variety of applications. Although it is not as widely used as it was in previous years, it can still be found within broadcast transmissions or air band radio to name a couple. Amplitude modulation (AM) is a method of injecting data onto an alternating current (AC) carrier signal. The highest frequency of the modulating data is normally less than 10 percent of the carrier frequency. The instantaneous amplitude (overall signal power) varies depending on the instantaneous amplitude of the modulating data. This moves the information signal to a new location which is above and below the carrier frequency. These components are called the USB Upper Sideband and LSB Lower Sideband and they are a mirror image of each other. Below is an equation which shows how AM works; Vc(t) = Ac(1 + Am sinฯ‰mt) sinฯ‰ct This can be simplified to the equation below; Vc(t) = (1 + msinฯ‰mt) sinฯ‰ct Vc(t) is the term for the modulated carrier wave form and the part of the equation that is highlighted in red is the amplitude term with an average value of one and will increase +m or -m from that value. Also ฯ‰m is the modulated frequency and ฯ‰c is the carrier signal in rad/secs so the amplitude of the carrier wave is being modulated by the information wave. For this part of my investigations I built a simple AM receiver model in XCOS and this can be seen in the picture below; Simple AM Receiver XCOS Model
  • 45. 44 As we can see from the model on the previous page the simple AM receiver is made up of sub-systems. They are the information signal and carrier which produces the AM signal. Next is an envelope detector that is followed by a low pass filter. Then there are the bias resistors feeding the signal into a buffer and the last sub-system is an inverting amplifier. The analogue information signal is supplied by a sinusoidal generator and this generates a tone at the angular frequency of the information signal which was set to 5KHz. This is then added to a constant of 1 and is multiplied by a carrier signal that was set to 100KHz. This creates an AM signal that is fed into the envelope detector which is a diode and a low pass filter. This diode detects the signal by first rectifying the AM carrier so the AM signals value are no longer zero and because the received signals are weak, diodes with very low turn on voltages are used. Then the half wave rectified pulses are fed through a low pass filter and are therefore smoothed, so the carrier frequency is removed and the slowly changing envelope is obtained as an output. The biasing in this circuit is similar to voltage divider biasing, however this circuit uses an op amp to buffer the bias voltage and this can help cut down on consumption of power within the circuit. This will give a more accurate gain as well as offset values because the impedance produced from the biasing and the op amp, that is fed into the rest of the circuit will be negligible compared to another method. It also can produce to numerous circuits, a bias voltage that is very stable and removes any cross coupling between the circuits signals. Finally, the output from the buffer is fed into an inverting amplifier where the demodulated signal is amplified. I then ran the simulation and the results can be seen below as well as the next couple of pages. AM Receiver Information Signal Scope Results
  • 46. 45 AM Receiver Modulated Signal Scope Results As we can see from the scope results above and on the previous page that when an amplitude modulated signal is created, the amplitude of the signal is varied in line with the variations in intensity of the sound wave. In this way the overall amplitude or envelope of the carrier is modulated to carry the audio signal. From the results above we can clearly see 100% modulation on the carrier signal and the information signal can be seen to change in line with the carrier signal. When the information signal is maximum (1) the modulated signal is maximum (2V) and when it is minimum (-1) the modulated signal is minimum (0V). The next two sets of scope results show the demodulated and final output signals, which can be seen below as well as the on the next page. AM Receiver Demodulated Signal Scope Results
  • 47. 46 AM Receiver Output Signal Scope Results The demodulated signal scope results show the half wave rectified signal has been attempted to be reconstructed by the filter. However, the output signal is not smooth but contains fluctuations within it and this is caused by the values of the resistor as well as the capacitor. In the final graph the final output signal can be seen to have increased in output therefore it must have been amplified by the final inverting op amp within the circuit. Throughout this part of my investigations I learned about the different subsystems within an AM receiver and how it works. Also the simulation produced the correct response which proved I had simulated it correctly.
  • 48. 47 Part 4 Switch Mode Power Supply Flyback converters are used to convert AC to DC and DC to DC with galvanic isolation between the input and any outputs. It is derived from a buck-boost converter where the Inductor is split and acts like an isolation transformer. This means that the ratios of voltage are multiplied with the advantage of isolation. So because it is similar to a boost converter the principles of both converters are similar. When the switch is activated, an input voltage would be connected to the primary side of the transformer. Due to this the current and magnetic flux in the primary side increase storing energy in the transformer. Now because of this, a negative voltage is induced into the secondary side of the transformer making the diode reverse biased (due to the winding polarities) and output load receives energy from the output capacitor. If the switch is then deactivated, the magnetic flux and current in the Primary side of the transformer will drop. Then the voltage on the Secondary side of the transformer is turned to positive and therefore forward biasing the diode and allowing current to flow. Any energy stored in the core of the transformer then recharges the capacitor which supplies the load. So a Flyback converter is an isolated converter and will also need isolation of the control circuit. The control circuit is made up of the voltage and current mode control and both need a signal related to the output voltage. For this part of my investigations I built a Flyback converter model in XCOS and this can be seen in the picture below Flyback Converter XCOS Model I set the input voltage to 240V, then ran the simulation and the scope results are on the next page.
  • 49. 48 Flyback Converter Scope Results As we can see from the above results the output voltage is just below 100V compared to the 240V inputted into the circuit. Also the output current is spiking up to around 30A at every step of the switch, switching on. One advantage of the Flyback converter circuit over the other switched mode power supplies is that many of them need a separate inductor for storage. Therefore, since the transformer in a Flyback converter is the storage inductor, there is no need for a separate one. This along with the fact that the rest of the Flyback converters circuitry is simple makes the Flyback converter a cost effective and extremely popular within industry. Another advantage is it has greater efficiency as the transistor or mosfet loses little power when switching. There are also other advantages such as they are smaller as well as lighter in weight and produce lower heat due to their higher efficiency. I tried to apply feedback to the system to control the level of output, however I could not get the simulation to work and below is a picture of the model. Flyback Converter feedback XCOS Model Throughout this part of my investigations I learned about a Flyback converter and the advantages of isolated power supplies. I could not get the feedback model to work and will revisit this at a later date.
  • 50. 49 Part 5 PID Controller A Proportional Integral Derivative (PID) controller is a control loop used throughout industrial control systems and is the most commonly used as a feedback controller. It calculates the value of error by comparing the output with the input. The calculation involves three separate constant parameters and they are known as a three term control. They are the proportional, the integral and the derivative values. These values can be interpreted in terms of time. Proportional (P) depends on the present error, integral (I) depends on the accumulation of past errors, derivative (D) is the prediction of future errors, based the rate of change of the current. The sum of these actions is applied to alter the process via a control element like say a valve of a heating element. The three terms can be calculated wit following formulas; ๐‘ท๐’“๐’๐’‘๐’๐’“๐’•๐’Š๐’๐’๐’‚๐’ ๐‘ถ๐’–๐’•๐’‘๐’–๐’• = Kp e(t) ๐‘ฐ๐’๐’•๐’†๐’ˆ๐’“๐’‚๐’•๐’Š๐’๐’ ๐‘ถ๐’–๐’•๐’‘๐’–๐’• = ๐‘ฒ๐’Šโˆซ ๐’†( ๐’•) ๐’…๐’• ๐’• ๐ŸŽ ๐‘ซ๐’†๐’“๐’Š๐’—๐’‚๐’•๐’Š๐’—๐’† ๐‘ถ๐’–๐’•๐’‘๐’–๐’• = ๐‘ฒ๐’… ๐’… ๐’…๐’• ๐’†(๐’•) When adding these three formulas together you can calculate the output of the PID controller as seen below; ๐‘ท๐‘ฐ๐‘ซ ๐‘ช๐’๐’๐’•๐’“๐’๐’๐’๐’†๐’“ ๐‘ถ๐’–๐’•๐’‘๐’–๐’• = ๐Š๐ฉ ๐ž(๐ญ)+ ๐‘ฒ๐’Šโˆซ ๐’†( ๐’•) ๐’…๐’• ๐’• ๐ŸŽ + ๐‘ฒ๐’… ๐’… ๐’…๐’• ๐’†(๐’•) I then built the model for a PID controller in XCOS and this model can be seen in the picture below. PID Controller XCOS Model(a)
  • 51. 50 I then ran the simulation but it would not complete indicating an error in the circuit. Therefore, I built an alternative model and this can be seen below. PID Controller XCOS Model(c) As we can see in the model, the three sub-systems of a PID controller with a step input. I then ran the simulation and below are the results. Proportional, Integral and Derivative Scope Results(a) As we can see from the results above, they are the outputs of the individual sub-systems and the top results are for the proportional amplifier which shows an output of 1 when the step activates at 0.1 seconds. This is correct as the gain was set to 1. The middle results are for the integration amplifier and these results show an output of 10 when the step activates. The bottom results are for the derivative amplifier and these results show the output rising from 0 in a linear fashion after the step is activated at 0.1 seconds. All three results are added together to give the final PID output signal these results can be seen on the next page.
  • 52. 51 Final PID Output Signal Scope Results(a) As we can see from the above results that the final output signal is the sum of all three signals from the earlier results. Here the output is around 11 and rising in a linear fashion over time. This is the 1 output from the proportional amplifier, 10 output from the integration amplifier and the linear characteristic rise in output from the derivative amplifier added together. In the model I then changed the values for the proportional to 0.4, integral to 4 and derivative to 0.5 and this can be seen in the picture below. PID Controller XCOS Model(c) I then ran the simulation and on the next page are the results.
  • 53. 52 Proportional, Integral and Derivative Scope Results(b) As we can see from the results on the previous page, the different signals from the sub- systems and below are the results of the final output from the PID controller. Final PID Output Signal Scope Results(b) The results above show us the sum of the three sub-systems which is around 5 and rising in a linear fashion. I then built a model for a PID controller, however I used the individual op amp circuits that make up the three sub-systems. By connecting an inverting amplifier with an integrator amplifier and differentiator amplifier. This is then connected to a summer amplifier to add the three signals together and a picture of that model can be seen on the next page.
  • 54. 53 Analogue PID Controller XCOS Model I then ran the simulation and below as well as on the next page are the results Proportional Output Signal Scope Results Integral Output Signal Scope Results
  • 55. 54 Derivative Output Signal Scope Results As we can see from the results on the previous page the results for the proportional, integral as well as derivative outputs and below is the final PID results. Final PID Output Signal Scope Results The above results show the sum of the three sub-systems that are within the PID controllers output. As we can see it has a steep ramp when the step is activated at 0.1 seconds and is also showing signs of an overshoot with a peak before levelling out with an output of around a value of 4. Throughout this part of my investigations I learned about the different subsystems within a PID controller with regards to the proportional, integration and differentiator amplifiers. I also learned how to calculate the output responses of each amplifier. Also the simulations produced the correct response which proved I had simulated it correctly.
  • 56. 55 Part 6 Music Circuit For this part of my investigations I was tasked to research a music amplifier or fuzzbox and build a simulation model from the circuit diagram as seen below. Music Circuit Diagram (Whitbread 2016, accessed 2016) From the circuit diagram we can see what a basic system looks like. In this system the signal is fed into non-inverting amplifier that is AC coupled with split resistors and below is a picture of its circuit diagram. AC Coupled Non-Inverting Amplifier with Split Resistors (Poole, 2016, accessed 2016) An AC coupled amplifier has the bias voltage connected to the non-inverting input and the bias is simply the voltage we would expect to see at the output when no signal is applied. Within this configuration it is important that the values of the resistors and capacitors are applicable for the frequencies required. The gain, cut off frequency and output of this op amp can be calculated with the following formulas on the next page;
  • 57. 56 ๐‘ฝ๐’ƒ = ๐‘๐Ÿ’ ๐‘๐Ÿ‘ + ๐‘๐Ÿ’ ๐‘ฝ๐’” ๐‘ฉ๐’Š๐’‚๐’” ๐‘น๐’†๐’”๐’Š๐’”๐’•๐’‚๐’๐’„๐’†(๐‘น๐Ÿ“) = ๐‘๐Ÿ‘ ๐ฑ ๐‘๐Ÿ’ ๐‘๐Ÿ‘ + ๐‘๐Ÿ’ ๐‘ฎ๐’‚๐’Š๐’ = ๐Ÿ + ( ๐‘๐Ÿ ๐‘๐Ÿ ) ๐’‡๐’„ = ๐Ÿ (๐Ÿ๐›‘)(๐‘๐Ÿ“ ๐ฑ ๐‚๐Ÿ) ๐‘ฝ๐’ = ๐‘ฎ๐‘ฝ๐’Š + ๐‘ฝ๐’ƒ The transistors in the music circuit operate such that one conducts for the positive half cycle and the other conducts for the negative half cycle, thus producing a full cycle of output signal. This high power output signal from the transistors is then used to drive a speaker or subwoofer of low impedance. Therefore, when a small input current is fed between the base and emitter, you get a much larger output current flowing between the emitter and the collector. So the weak signal is fed into the base and you use the output from the collector to drive a speaker. The biasing for the transistors is provided by the diodes as well as the 1Kโ„ฆ resistors. This arrangement biases the transistors just above cut off and reduces the crossover distortion. I then built the model in XCOS and below is a picture of that model. Music Circuit XCOS Model
  • 58. 57 I then ran the simulation however the simulation did not produce the desired output and I received an error message which are shown below; Scilab Error Message Music Circuit Scope Results Clearly there is a problem which I think is a timing problem within the simulation and whatever I try, the problem could not be rectified. Therefore, I built the same circuit within Multisim and below is a picture of that model. Music Circuit Multisim Model
  • 59. 58 I then set the frequency to 6kHz which can be seen in the picture below; Function Generator Parameters Block Next I ran the simulation and below are the results I achieved. Music Circuit Output Scope Results As we can see from the above results the smaller trace is the input signal and the bigger one is the output signal. It is clear that the input signal has been amplified as it is now around twice as big as the input signal. Throughout this part of my investigations I learned about the different sections within a music amplifier. I learned about an AC coupled non inverting amplifier with split resistors and how to calculate the output response. Even though I could not achieve an adequate response in XCOX, I believe I built a model in Multisim that produces an output that is adequate.
  • 60. 59 Part 7 Code Generation As I mentioned earlier, C code can be generated by building and simulating models. Where the code for a specific function can be inputted into Scilab such as a filter, like for the response of the Butterworth filter at the end of part 1 and even the FFT program used in the filter investigations is generated from code. The FFT file can be opened in SciNotes and this can be seen below. FFT Code To generate code for a specific model I first needed to download some software call X2C which is an open source code generator for Scilab/XCOS and then I followed the installation instructions to pair X2C with Scilab. This loaded the X2C libraries into the Scilab console window and within the file explorer I loaded a demo model for an LED that was to be switched on and off with a square-wave input. The path of the location for the demo is in the picture below and a picture of the demo model is on the next page. Scilab File Browser(a)
  • 61. 60 X2C Demo Model Generated in XCOS I then double clicked on the start communicator box which opened the controller and then I double clicked on the other orange box which loads it into the controller. Next I clicked the create code tab on the controller and this created the files, X2C.c and X2C.h. This can be seen in the picture below; Scilab File Browser(b) Next I right clicked on both files, then opened both files in SciNote and the X2C.c files code can be seen on the next few pages.
  • 64. 63 X2C.c Code (continued) As we can see from the previous couple of pages the code that has been generated and this along with the X2C.h file can be uploaded into software like MPLabX for example, where it can be uploaded into a microcontroller via a programmer or development board. With some changes to the code the model could be altered to react differently and this is handy when time is limited to build a new circuit. Throughout this part of my investigations I learned about how C code can be generated from different models with XCOS and X2C. This extremely handy as you can simulate numerous models, then convert the model to code and upload the code to a microcontroller.
  • 65. 64 Conclusion To conclude these investigations went well and I learned a lot. Electronic systems are all around us and an important part of the modern world. This report introduced me to ways, to control the output of circuits such as how the various ways an op amp can be configured to produce a desired response. I also learned that simulation software was excellent for the purpose of my investigations and I believe I was successful acquiring the correct output responses. As mentioned, I learned about the various ways to control the output of op amps and the different configurations the op amps can be connected in. I simulated various filters, learned how to calculate the cut off frequencies and about how balanced line drivers remove noise from the system. I also covered a blood pressure monitor learning how it works and the effect of noise on the system. With the AM receiver simulation, the outputs showed me the information signal being fed into the circuit and when combined with a carrier signal the output is a modulated signal. It is then demodulated and this signal is amplified ready to be received. I also learned about the various parts of the AM receiver circuit and what their operation was. The Flyback converter simulation taught me about switched mode power supplies and the advantages that comes with the circuit. I also learned about PID controllers, with their individual sub-systems that combine to create the PID output that was expected and how it can be constructed using op amps with proportional, integration and differentiator amplifiers. My investigations of the music circuit, was difficult as I could not get the simulation to run in XCOS, however I did manage to simulate the circuit in Multisim where I learned about an AC coupled inverting amplifier with split resistors and what the function of the transistors within the circuit was. Finally, with regards to code generation I learned that with the assistance of X2C software, which is a code generator for Scilab/XCOS, I can build a model and then convert it into some C code. This code can then be opened in some software like MPLabX and then be uploaded into a microcontroller via a programmer or development board. All together I have learned a lot this semester and although XCOS was tricky to use, I still simulated almost all circuits in XCOS. If I could not, I used Multisim to complete my investigations and it should hold me in good stead throughout what I hope to be a long career, because electronic systems are embedded throughout industry.
  • 66. 65 References Ece.rice.edu. (2016) Experiment 5.2 Voltage Amplifiers. [Internet], Available from: <http://www.ece.rice.edu/~jdw/243_lab/exp5.2.html> [Accessed 28th April 2016]. Electronicshub.org. (2015) Active Low Pass Filter. [Internet], Available from: <http://www.electronicshub.org/active-low-pass-filter/> [Accessed 30th April 2016]. Electronics Tutorials. (2016) Passive Band Pass Filter. [Internet], Available from: <http://www.electronics-tutorials.ws/filter/filter_4.html> [Accessed 30th April 2016]. Open Music Labs. (2016) Op-Amps: Part ii. [Internet], Available from: <http://www.openmusiclabs.com/learning/analog/op-amps-part-ii/> [Accessed 28th April 2016]. Poole, I. (2016) Non-inverting amplifier circuit using an op-amp. [Internet], Available from; <http://www.radio-electronics.com/info/circuits/opamp_non_inverting/op_amp_non- inverting.php> [Accessed 28th April 2016]. Stack Exchange Inc. (2016) Inverting buffer with op-amps. [Internet], Available from: <http://electronics.stackexchange.com/questions/148356/inverting-buffer-with-op-amps> [Accessed 28th April 2016]. Whitbread, M, (2016) Electronic Systems: Module Handbook. [Internet], Available from: <Moodle> [Accessed 28th April 2016].