Glory Digital Oscilloscope User Manual

Digital Oscilloscope

Digital Oscilloscope
Project started on 2005-12-21
Current status: Alpha
First of all, many thanks to Professor Iravani for teaching us the analysis of linear systems, Professor Wang for her patient tour of digital logic and Verilog. To all the lab TA's for tips on debugging circuits and practical insights. To Mr. Rundle for introducing me to C/C++ and of course, Mr. van Bemmel for showing me the door.
Motivation
Not everyday does one feel the urge to build an oscilloscope. There were many motivating factors. My experience with oscilloscopes began with an old analog machine in the "bowling alley" of my high school, Marc Garneau CI. I just remember how tedious it was to get the thing to show a trace. And then to trigger properly. Upon comparing the results with known values, I realised that the oscilloscope was off vertically and horizontally, ie not calibrated. And the probes were so oxidized. One couldn't quite understand why it wouldn't work. So many pains. But there was excitement when the darn thing finally worked and you could see the Lissajous curves or the capacitor charging and discharging. And then, there was these awesome shiny new digital oscilloscopes in the electrical engineering and physics labs at University of Toronto. They even had an auto set function. I mean, how cool is that? You didn't have to fiddle with the knobs anymore, it just worked. I immediately knew what I wanted for Christmas or my birthday. Looking in the Allied Electronics and Newark in One catalogues, I found out that that was out of question.
The Agilent 54622D
100MHz mixed signal
scope. Such a beauty,
no? Starting from $5995USD.
So my natural instinct is to build one if I can't afford one. And thats what I spent my Winter holidays doing.
Requirement Specs
http://glory.honour.ca/projects/Oscilloscope/Oscilloscope.html (1 of 23) [04.2.2007 г. 02:41:45]
Digital Oscilloscope
These were the preliminary requirements that I set out to fulfill:
1 channel (or 2 channels with common ground) ❍ It seemed hard to have 2 channels working in electrical isolation
Digital ❍ I don't have a CRT or know how to control one
Communicate to a computer / Palm Pilot via RS232
❍ For easy debugging and display, a computer is fast and easy to program ❍ Also allows for future interface with Palm Pilots and easy porting to other systems
Accuracy of 1mV
+5V to -5V input range
8ksps
❍ Restricted by ADC0804
Ampilifcation circuit have relatively high cut off frequency (40KHz suggested)
❍ Relatively high compared to the 4kHz (nyquist frequency of 8ksps)
Explanation
For those of you who are new to this stuff:
The number of channels which an oscilloscope has is the number of signals which it can be viewed at the same time.
I hope you know what digital and analog means. For the purpose of this project, digital signals can be communicated with computers while analog signals can't.
RS232 is the name given to your serial port. At the back of your computer, there's many ports where you can plug things into. The RS232 port has 9 pins and looks like:
RS232 serial port
At the heart of most digital oscilloscopes is a device (usually a chip of some sort) which converts analog voltage levels to digital signals. This chip is called an analog to digital converter (ADC). If this happens very quickly and the computer keeps track of voltage over time, a plot can be drawn, hence the principal of a digtal oscilloscope. How quickly the chip is able to make these conversions is called the sampling frequency. It is given in units of ksps (kilo-samples per second) or Msps (mega-samples per second). And if you know the sampling frequency to be f, the highest frequency sine wave it can detect is f/2. This is known as the nyquist frequency. Any higher than that and all you'll get erroneous results and an effect known as aliasing (click
here for details). For my case, I chose ADC0804 because they are readily availible at Supremetroncis.
This chip is guarenteed to work at 8ksps. And hence, the nyquist frequency is 4kHz. That means, the fastest sine wave I can see with chip is 4kHz before bad things start happening.
Most oscilloscopes have some analog circuit which will amplify and shift the trace before it is sampled by the ADC. By shifting the signal before amplifying it gives better accuracy in many cases (avoid saturation with amplifiers). As with all analog circuits, they will work only within a range of frequencies. After a specific frequency, the cut off frequency, the output voltage level is less than 70.7% of the original voltage level and is considered unsuitable for measurement. It would be preferrable for this frequency to be much higher than the nyquist frequency of the ADC.
http://glory.honour.ca/projects/Oscilloscope/Oscilloscope.html (2 of 23) [04.2.2007 г. 02:41:45]
Digital Oscilloscope
So, now that we know what we're looking for, here's the design.
Design
While I had some knowledge of electronics hardware, I still do not understand all components fully. It is very different to sketch an opamp circuit on paper than it is to choose the correct components and lay it out to minimize noise. So, there's bound to be oversights where a resistor value was too low or the components were not well chosen, etc. Hence the difference between physics where it supposed to work and engineering were good approximations and correct components are key. I'm still learning so please
email me with
comments and suggestions.
The design of this oscilloscope was simple. It is summarized with the following diagram.
Flow diagram for the
digital oscilloscope
Vertical Shift and Amplifier
The purpose of these modules is to condition the signal appropriately for the ADC to read. The ADC can convert voltages within the range of 0 to 5V. By setting the vertical offset and amplification, one can "zoom" into a portion of the signal one is interested in. A suitable equation relating the input voltage (
Vin
),
vertical offset (
Vs
), amplification (A) and the output voltage to the ADC (
Vadc
) can be:
which would allow for the maximum of 10V input range (A=1,
Vs
=0,
Vin
=-5V to +5V). Also, this scope must have accuracy of 1mV. The typical screen size on a Palm Pilot is 160X160 pixels. Hence a 100X100 pixel window with 10X10 grid would be suitable for showing the trace which leaves enough space to display system information. This means, the smallest range this oscilloscope should be able to capture is within a 0.1V (=100px X 1mV/px) range. It would also be nice to have variable gain inbetween these two ranges as well. The following table lists the magnifications posible.
http://glory.honour.ca/projects/Oscilloscope/Oscilloscope.html (3 of 23) [04.2.2007 г. 02:41:45]
Digital Oscilloscope
Volts per
Div
(mV)
Measurable
Window
(V)
Amplification
Needed
(X)
Feedback Resistor (see circuit,
Rf)
(kOhm)
Multiplexer Index
0.01 0.1 100 1000 (1MOhm) 0x6
0.02 0.2 50 500 0x5
0.05 0.5 20 200 0x4
0.1 1 10 100 0x3
0.2 2 5 50 0x2
0.5 5 2 20 0x1 1 10 1 10 0x0
With the design equation in mind, an opamp circuit was created to perform the desired amplification. This was done by cascading a series of buffers, differential amplifiers and summing amplifiers. The result was:
Click on image for
high resolution schematic
for print
Originally, 10k resistors were chosen for most of the circuit since resistors with values in multiples of 10k were most common. This would be useful for the variable gain circuit. However, Supremetronics ran out of them and I was out of luck. So 20k were used instead. I salvaged a few 10k resistors from old projects and used those. Due to the sensitive nature of this project, all resistors had 1% tolerance.
The opamp chosen was the LF347. It has high bandwidth of 4MHz, input impedance of 10e12Ohms. Each package contained 4 opamps which saved space and came at an economic price. I'm sure that was not the best reason to pick this opamp, but it still worked.
The variable gain amplifier must be able to accomodate 7 distinct amplification levels. This meant, Rf could be 7 independant values. This was accomplished by using a 4067 which was a 16 to 1 analog multiplexer IC which was not shown on the schematic. Based on the input to the IC, Rf could be configured to choose any of the 16 channels. Since 7 resistors were used, only 7 channels were used and 3 of the 4 lines were needed to address each channel.
http://glory.honour.ca/projects/Oscilloscope/Oscilloscope.html (4 of 23) [04.2.2007 г. 02:41:45]
Digital Oscilloscope
Wiring diagram to create
Rf from a 4067
Looking at the circuit, you may notice that there is a physical input signal called
Vso
which was not mentioned in the design equaiton. This voltage is generated by an R-2R resistor network driven by a CMOS buffer. Hence its voltage range is between 0 and 5V. The logical vertical offset (
Vs
) can be
calculated using
Vs
=5-2
Vso
. However, doing a full circuit analysis will reveal that the the
design equation still holds.
R-2R networks are constructed using resistors. They are a type of DAC (digital to analog converter). They can convert a digital signal into an analog voltage level. Say an
n
bit unsigned integer was to represent a
voltage level, Vout, between 0 and Vcc. An R-2R resistor network could be constructed to do this as the following:
General R-2R network
http://glory.honour.ca/projects/Oscilloscope/Oscilloscope.html (5 of 23) [04.2.2007 г. 02:41:45]
Digital Oscilloscope
Every resistor labeled R must all have the same arbitrary resistance. Every resistor labeled 2R must have twice that resistance. For a CMOS circuit, a logical high is Vcc, usually 5V and a logical low is 0V. Doing a circuit analysis, one will find that
Vout
can be described as:
Equation to calculate
output voltage of an R-
2R network
where
Di
is 1 or 0 and Vcc is the supply voltage to the CMOS driver.
Most CMOS buffers are capable of outputing a maximum of 20mA. So, resistor value for R must be chosen in the kOhm's. This circuit fails miserably if one were to use TTL gates as the voltage levels for high and low have too wide a range. I once read a 2.2V for a logical low out of a 74LS04 (NOT gate). So, you must use CMOS outputs to drive this circuit. The most precise resistors have tolerance of 1%, so excessive number of bits may not guarentee such precision, but the voltage levels will always be ascending if the input values are consecutively ascending.
The requirements demand 1mV accuracy over a 10V range. Doing the calculations, it was found that the size of the output integer needs to be 14 bits. This seems some what inconvenient, so it was rounded up to 16 bits for ease of computation on the computer side at the expense of 4 more resistors.
Power Supply
Like all electrical circuits, this one needs electricity to work. The opamps need a positive and negative voltage source to work. The precision of these two voltages must be very precise and symetric otherwise, the virtual ground would be off (different from the real ground) and this would introduce significant amount of error in the final signal.
For this project, I used a modified ATX power supply. The one in my computer was getting noisy so I replaced it with a new one although the old one was still functional. ATX power supplies can output +12V, +5V, +3.3V, ­5V, -12V relative to common ground. So, instead of spending a lot of money on a lab power supply, I used an ATX power supply instead.
http://glory.honour.ca/projects/Oscilloscope/Oscilloscope.html (6 of 23) [04.2.2007 г. 02:41:45]
Digital Oscilloscope
Modified ATX power supply
But measuring the +12V and -12V, I found out that the power supply was not so precise. To make matters more complicated, the voltage level changed when one loaded the power supply which was due to do with the switching nature of computer power supplies. To make a more precise power supply, the following circuit was made (design taken from a voltage regulator datasheet):
More precise power
supply (click for
larger image)
This power supply was loaded and the adjustable resistors were trimmed until the desired voltages were obtained.
http://glory.honour.ca/projects/Oscilloscope/Oscilloscope.html (7 of 23) [04.2.2007 г. 02:41:45]
Loading...
+ 16 hidden pages