0% found this document useful (0 votes)
57 views18 pages

Digital Electronics

The document describes the design and implementation of an oscilloscope analog front end circuit built with simple components and a breadboard. Key aspects include: - An input signal was attenuated using a potential divider to reduce the voltage to 0-3.3V for the MSP432 analog input. An op amp circuit with gain was used to amplify the signal. - A PWM output and low-pass filter circuit were used to generate a trigger voltage for a comparator. An interrupt service routine in the MSP432 was triggered when the analog input exceeded this voltage. - The circuit solutions, schematics, and oscilloscope waveforms are described for the attenuation, amplification, low-pass filtering,

Uploaded by

Harry Beggy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views18 pages

Digital Electronics

The document describes the design and implementation of an oscilloscope analog front end circuit built with simple components and a breadboard. Key aspects include: - An input signal was attenuated using a potential divider to reduce the voltage to 0-3.3V for the MSP432 analog input. An op amp circuit with gain was used to amplify the signal. - A PWM output and low-pass filter circuit were used to generate a trigger voltage for a comparator. An interrupt service routine in the MSP432 was triggered when the analog input exceeded this voltage. - The circuit solutions, schematics, and oscilloscope waveforms are described for the attenuation, amplification, low-pass filtering,

Uploaded by

Harry Beggy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

EE319 Task #1 Report

Abstract
The amount of time put in to understanding and successfully achieving the aims of this task could not
be foreseen. The task was to build an oscilloscope analogue font end from simple circuit components
and a breadboard. It had to be a two-channel-with-trigger oscilloscope. The inputs of the analogue
front-end circuits needed to be digitized using the MSP432. The MSP432 had to be programmed to
capture samples of the analogue signal for a selected analogue input at a suitable sample rate and send
these over USB to a PC. The samples had to be displayed as a waveform on the PC. Then, a PMW
output and external low-pass filter had to be configured to give a programmable voltage value to a
comparator input on the MSP432. An interrupt service routine had to be written that was triggered
when a selected analogue exceeds the programmable trigger value set with the PWM output.
The solutions involved a potential divider for attenuation. A unity gain buffer and gain op
amp for amplification. These together resulted in a signal between 0-3.3V going into the analogue
input of the MS432. A PWM will be generated and be put through a low pass filter and comparator
to enable and interrupt service routine. The schematic can be seen in the appendix.

Table of contents
SECTION 1 – Input Stage……………………….……………………………………………. page 2
1.1 Attenuation …………………………………………………………………………………………………….. page 2
1.2 Amplifier …………………………………………………………………………………………………………. page 4
1.3 Low Pass Filter ……………………………………………………………………………………………….. page 9
1.4 Comparator ……………………………………………………………………………………………………. page 12
1.5 Interrupt …………………………………………………………………………………………………………. page 13

SECTION 2 – KNOWLEDGE GAINED …………………………………………………….. page 15


APENDIX …………………………………………………………………………………………….. page 16

1|Page
Section 1 – Input Stage

Section 1.1 Attenuation


The sinusoidal signal being inputted to the circuit was a sine wave with an amplitude of 10V. This
signal was generated using the ADALM2000 or M2K for short, through using the software SCOPY.
The input signal was monitored using channel one(orange) of the oscilloscope on SCOPY. The output
signal was measured using channel two(blue) of the oscilloscope This signal had to be attenuated
down by a factor of around 20. The reason for this is because the signal eventually being inputted to
the MSP432 must not exceed 0-3.3V. The MSP432 could be damaged if the voltage range exceeds 0-
3.3V. This is the schematic circuit and picture of the initial circuit.

2|Page
In order to attenuate the signal, a potential divider was constructed from two resistors. The values
chosen were one mega ohm and 45.3 kilo ohms. This gives approximately a division factor of 20 (See
appendix).
An offset voltage is used to deal with the negative part of the signal by shifting it up. The R3 and R4
resistors create a low impedance divider to create the offset voltage. The capacitor C1 is used to keep
the signal from varying or floating around. This divider creates a voltage of 1.062 volts to lift the
voltage out of the input divider (see appendix).
The total voltage out of the attenuator will be the voltage out of the input signal dividers added with
voltage out of the low impedance dividers which lifts the voltage. This would mean that a total
voltage of 1.4 volts should be leaving the attenuation stage. However, this was not the case as seen
from the oscilloscope reading below.

The signal is not in the right form. The problem was the 45.7 kilo ohm resistor was actually a 2.2 kilo
ohm resistor. This meant that there was a division factor of about 500. This meant the voltage sat on a
ripple at the capacitor instead of where it was supposed to be leaving the attenuator and was not
producing a large enough waveform. To solve this, four 10 kilo ohm resistors were put in series to
give a total resistance of 40 kilo ohms. The theoretical voltage should now be 1.44V total(See

3|Page
appendix). The actual voltage is approximately 1.44V coming out the attenuator. This should now
give a proper waveform as seen below.

This is the circuit with new resistors.

Section 1.2 Amplifier


The next stage is the amplifier stage. This is involves using op amps to create a gain. One of the op
amps will be used as a unity gain buffer (MCP60002 IC). A unity gain buffer has a gain of one and
ensures a steady voltage output. The other op amp will be a powering op amp (LM358AP IC). This
will be powered by the five-volt supply from the MSP432. The non-inverting input will be supplied
with a reference voltage of 3.3V from the MSP432. This will ensure that the voltage being outputted
can not go above 3.3V. As any voltage above that will potentially damage the MSP432, this is very
useful functionality.
Firstly, the buffer will be powered using the output of the op amp with the reference voltage. The
output of the buffer will be connected to a one kilo ohm resistor as extra protection for the MSP432.

4|Page
The waveform will be measured using the oscilloscope to ensure that the voltage is between 0-3.3V.
Below is the schematic and picture for this circuit along with the waveform.

5|Page
The voltage level is approximately 3.1V, which is in the ideal rangebut high. However, there is not a
proper waveform. There voltage signal appears to be on a ripple again. This becomes especially
problematic when using the MSP432 to take samples of the analogue input using the Energia
software. Below is the Energia sketch used to read 1000 samples from the analogue pin P5.2(A3) on
rail 20, that will print the samples on the Serial Monitor or plotter. The full code can be seen in the
appendix.

This code reads the analogue input A3 and measures the time it takes to get 1000 samples in
microseconds. It does this in a loop and repeats itself every time the values are printed on screen with
a delay of give seconds between loops.

6|Page
This problem was caused by a simple error in circuitry. Below is the Serial Monitor and Serial plotter.
The problem was with the op amps and they were increasing the voltage instead of having a
Gain of one. The voltage in the analogue input is now at 1.21V approximately.

The serial monitor is reading that 20527 microseconds passed too read 1000 samples from the
Analogue input. Below is the serial plotter.

The irregularities of the waveform is some noise being generated somewhere in the circuit. I believe
it is caused by the oscilloscope channel two wir

7|Page
Oscilloscope displaying input signal(otamge) versus the signal gain of one(blue).

8|Page
Section 1.3 Low Pass filter

The low pass filter was made from a 10-kilo ohm resister(R6) and a 4.7 micro farad capacitor(C2). R6
is connected to pin 40 of the msp. An Energia sketch was uploaded to the msp to give a PWM (pulse-
width modulation) output. The Energia sketch can be seen in the appendix. This is the part of the code
which sets the PWM signals.

The cut off frequency of the low pass filter is 3.39 hertz(see appendix for formula). This was
calculated using the cut-off frequency formula. The low pass filter attenuates the PWM signal
converting it nearly to a DC type signal. The output of the low pass filter is the average voltage of the
PWM signal. But the signal has a very tiny ripple. Below is the input PWN signal(orange) and the
output of the low pass filter(purple) displayed using the oscilloscope. This is with a PWM duty cycle
of 80.

9|Page
At a PWM of 0, both signals are low and overlapping.

AT a PWM of 180, the output rises with the rise in the input modulation.

A PWN of 200 shows the output signal rising again with a rise in modulation.

At PWM of 255 both signals are high and overlapping.

10 | P a g e
These results show that the PWM and the output of the low pass filter are directly proportional. As
PWM rises, so does the output and visa-versa. When the PWM is at zero it is always off, and at 255 it
is always on. The output matches the PWM signal.

11 | P a g e
Section 1.4 Comparator
This is made using the MCP6002 rail-to-rail op amp. This is important so the range of the output
square signal can reach the full range of voltages powering the op amp. The op amp is powered
using the 3.3V supply of the msp. The 3.3V is being used as the reference voltage. If the inverting
input is higher then the non-inverting input, the output will be LOW towards negative supply i.e zero
volts. When the non-inverting signal is higher then the inverting signal, the output will be HIGH
towards the reference voltage. For this to work, the non-inverting and inverting signasl must overlap
as seen below.

The inverting signal is the output of the low pass filter. The non-inverting signal is the signal from the
amplifier with a gain of one. The two input signals overlapped at a PWM of 80. If the PWM is higher
at a value of 120 for example, the comparator does not work properly.

The output of the op amp does not rise and fall with the variation of the inverting and non-inverting
signals. The same happens when the PWM is set below 80 but the output sits above the non-
inverting input. The reason they need to overlap is so the two inputs can be greater and less then
each other in order to get an output. At a PWM of 80, the out of the op amp comparator is this:

12 | P a g e
As the non-inverting input rises, the output signal goes HIGH i.e non-inverting signla greater the
inverting signal. When the input decreases, the output goes LOW i.e inverting signal greater then
non-inverting signal.

Section 1.5 Interrupt


The out put of the comparator can be uses as a trigger. This trigger can be used to generate an
interrupt service routine. The trigger is connected to the msp at pin 39 through a 220-ohm
resistor(R7). The interrupt will be enabled when the trigger is touched off pin 2.6.

This part of the code is the part that prints out the analogue data until the interrupt service routine is
activated and then exited by removing the pin contact.

Once the interrupt service routine is enabled the program will come here.
When the serial monitor is opened, a list of zeros are displayed. This is because the start of the code
sets all analogue outputs to zero as seen here:

13 | P a g e
When the trigger is touched to pin 2.6, the interrupt service is entered for as long as the pin is
touching the trigger. To show the interrupt service routine is entered, the message “In Interrupt” is
displayed on the serial monitor.

14 | P a g e
When the trigger is taken away from the pin, the samples are displayed.

Section 2 – Knowledge Gained


I have learned a lot about how the front-end of an oscilloscope works and why the various
stages are needed. I learned that it is important to have different op amp gains to deal with
high and low signals. Unfortunately, I was not able to successfully put together a working op
amp with a gain of ten.
The approach of using PWM to generate an analogue value over a fully digital to analogue
converter is that you can change the pulse width while keeping the time between the pulses
constant giving varying analogue values. The analogueWrite() has a scale of 0-255. 255 is
always on and 0 is always off.
If a second interrupt service routine is activated while the first one is running, the code would
have to decide whether the original routine running cans till operate or the new one will take
over. This would be decided by an interrupt controller which would decide with routine to
run.
The knowledge gained that could be useful when interfacing with a voltage-output sensor
would be manipulation of analogue signals. Also the attenuation of voltage signals along with
the applying the appropriate gain for any voltage range.

15 | P a g e
Appendix

𝑅2 45.3𝑥103 1
𝑅1+𝑅2
=1𝑥106 +45.3𝑥103 ≅ 20
𝑅4 270
𝑅3+𝑅4
𝑥5𝑉 = (1𝑥10^3+270)x5V = 1.06V

40𝑥103 270
10×( ) + 5×( ) = 1.44V
1𝑥106 +40𝑥103 1𝑥3+270

16 | P a g e
17 | P a g e
1 1
Cut off frequency of low-pass filter: = = 3.39 Hertz
2𝜋𝑅𝐶 2𝜋(10𝑥103 )(4.7𝑥10−6 )

18 | P a g e

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy