Вы находитесь на странице: 1из 15





Done by:

1. Waleed Tuffaha (Team Leader).

2. Mohamad Eyad Qasem

3. Ramy Eid Rfou

4. Sinan Taifour

Supervision by:

Doctor Mohammed Hawa

Done on: 20/4/2008

Table of contents:

Topic PAGE

List of figures and tables 3

1. Introduction, Rationale and Goal 4

2. Approach 5

2.1 Component Selection 7

3. The Acquisition Circuit 8

3.1 Signal conditioning 8

3.2 Sampling and Digitization 9

4. The User Interface 11

5. The Assembled System and Performance 12

6. Future Work 14

7. References 15

List of figures and tables
Page Figure/Table

0 5 Program flow chart

1 6 The dsPIC installed in the bread board

2 7 Part of the signal conditioning circuit

3 8 Op-amp frequency response

4 9 Analog to digital converter schematic diagram

5 9 The ADC on board

6 10 The LCD internal components

7 11 The full picture

8 12 The oscilloscope in action, the text information.

1. Introduction, Rationale and Goal

An oscilloscope is a type of electronic test equipment that allows

signal voltages to be viewed, usually as a two-dimensional graph of one or
more electrical potential differences (vertical axis) plotted as a function of time
or of some other voltage (horizontal axis).[1]

Oscilloscopes present valuable test devices for the engineering

students in their projects; engineering students in the electrical, mechatronics
and computer departments often find themselves facing a hardware problem
that cannot be easily solved without an oscilloscope. The oscilloscope is
unfortunately a rather expensive device and therefore cannot be purchased
by students. Additionally, the bulky nature of a typical oscilloscope makes it
hard for the students to get access to them outside a laboratory, and have
them around when needed.

Students who face a hardware problem in their projects often end up

in frustration. The innovative of them resort to using their computer sound
card along with special software to make it act as an oscilloscope. Although a
useful hack sometimes, most of the times it is limited by the sampling rate of
the sound card, which is designed to acquire sound signals with frequencies
below 20 KHz. This approach also suffers from other problems, such as a
limited input voltage range (somewhere around 400 mV) which is too small for
large signals such as the TTL logic levels. Fear of causing damage to the
computer is yet another problem. Another option is to use a Data Acquisition
unit connected to a PC, which start at around USD 100 for student editions,
with sampling frequencies of 10 KSps and also require the availability of a PC
or a laptop.

Our goal is to build a low-cost portable digital oscilloscope. Our

device is targeted to the engineering student working on projects in fields
other than communication. This limitation (the exception of the field of
communications) is imposed to lower the cost and complexity of the device,
as communications signals tend to have higher frequencies, which
necessitates higher sampling rates, in turn requiring more expensive chips
and complex consideration in the design.

During design, the goal we have defined directed us towards particular

design decisions. We aimed at lowering the cost and power consumption
according to what is available in the local market, and keeping the size and
complexity reasonable, without impeding the performance.

The project inspires students to utilize the knowledge they already

have, such as programming and using microcontrollers or LCDs, in building
their own tools to serve them in their subsequent projects. Furthermore,
interested students can use our own design, which will be publicly available in
details, to build their own oscilloscope.

2. Approach

Figure 0. Program flow chart

The digital oscilloscope process is quite complicated; a general data-
flow would consist of a number of sequential processes. The signal has to be
sampled, digitized, processed and displayed to the user. Also, the user has to
be able to interact with the device to access different modes and options.

Due to cost restrictions and our acquaintance with microcontrollers, we

decided to use a microcontroller as our main processing unit.
Our microcontroller had an internal Analog to Digital model that provided us
with 1.1 MSps, which is quite convenient, but using an external ADC allowed
us to increase the sampling rate to 2.0 MSps with a low cost of 10$ which is
more user satisfying and provides higher frequency measures with lower extra
work on the design.

Thus, the system contains only one controlling and processing unit, to
drive the ADC external unit and process its data to provide the enough
information to start the LCD and control the inside controller it has, this
allowed us to save space and lower the power consumption to a great rate,
that allowed more portability in our design.

For the triggering system, the user defines the triggering level and
triggering edge. Before reading the signal, a sample is taken and compared to
the previous sample. First we check if the triggering level is located between
the values of the two samples. Then, we check for the desired edge by
observing whether the samples are increasing or decreasing.

The code for trigger detection has to be optimized. The dsPIC

microcontroller used is running at 30 MIPS, thus, each instruction requires
33ns to execute. And since we are converting at 2MSPS, each sample
requires 500ns. This gives us only 500/33 = 15 instruction between sampling.
Using these 15 instructions, the microcontroller has to be able to successfully
detect the triggering and initiate a new conversion.

Upon successful triggering, a buffer is filled with consecutive samples.

Afterwards, the samples in the buffer are processed to obtain the required
measurements (maximum, minimum and RMS values, for example). The final
data with the measurements are then displayed on the LCD.

This approach allows for large amounts of processing to be done, since

the microcontroller is not busy taking samples once the buffer is filled.
Although it seems like samples are being lost at first, we found out that this
approach is practical since a continuous stream of samples cannot be
comprehended by the user, as the user cannot be presented with more than
24 screen updates per seconds. Also, most signals displayed on
oscilloscopes are periodic, thus this approach will not cause loss of
information. Other triggering (such as single trigger) and plotting (such as roll)
modes will be provided in the future, allowing better control for non-periodic
and slow signals.

2.1 Component Selection
Selecting the components took a major time of this project. We tried to
find the most suitable components to meet the goal of our project. We did not
limit ourselves to the components available in the local market, but rather
looked into online catalogs of electronic components providers. We tried to
contact surplus components providers in an effort to get better prices.

Our calculations showed that it is cheaper to buy a component online

from US or Europe providers and have it shipped to Jordan, than to buy it
from the local market. This applies to the more valuable components such as
the Microcontroller, ADC and the LCD. Prices in this section will include the

The Microcontroller was selected from a set of choices including

dsPIC, PIC, and Atmel families. The overhead of learning the details of a new
manufacturer ruled out the usage of Atmel microcontrollers early on. In the
remaining Microchip microcontrollers, our criteria was to maximize the
processing speed, since our application is processing-hungry and the
microcontroller should be able to deal with the ADC at high speed. We first
tried using dsPIC 33FJ12MC201 which performs at 40 MIPS. This choice was
unlucky as we faced trouble finding a programmer for it. We eventually settled
with a dsPIC30f4011 [2] at a price of 7$, which has 40 pins, performs at 30
MIPS and contains a wide range of computation features implemented by

Figure 1. The dsPIC installed in the breadboard

Our criteria for choosing the ADC was to maximize the sampling rate
while keeping the price reasonable. We also limited ourselves to chips in DIP
packages only, as dealing with surface mounted devices has proved to be
troublesome to be done by ourselves after some testing, and expensive to be
done by a professional. We eventually determined to use the AD7822/25/27
family from Analog Devices. This family comes in DIP, provides up to 2 MSps,
allows for external power down and offers 1, 4 or 8 channels In the current
model the AD7822 that costs 10$ is used, which contains 1 channel, as

The LCD we initially ordered was from a surplus provider, it was an

EPSON P300013100 with a very attractive price of USD 7, it contained a
640pxx200px monochromatic viewing area. Unfortunately it was a very old
LCD built by EPSON for IBM, and no documentation was present.
Furthermore, the LCD contained no controller. We invested tens of hours
trying to figure out how to run it and build our own controller for it with no luck.

After searching in the local market, we settled on a graphical LCD that

provides us with the required functionality, costing 35JDs with an internal
controller and 3 line drivers (2 vertical, 1 horizontal), we could have bought
this LCD online for 20$ but according to time constrains, we had to get it from
the local market.

3. The Acquisition Circuit

The acquisition circuit consists of two parts, the signal conditioning,

and the sampling and digitization

3.1 Signal conditioning:

Figure 2. Part of the signal conditioning circuit

The analog voltage input to the ADC has to be in the range 0v-2.5v
when the chip is operated using a 5v power source. Thus, any signal has to
be adjusted before passing it to the ADC. Signals with small amplitude ( less
than 1.25v ) have to be properly amplified and large signals ( larger than
1.25v ) have to be properly attenuated to match the swing of 2.5v from -1.25v
to +1.25v.

The amplification or attenuation is done according to the voltage

divisions selected by the user. For this purpose, an Op-Amp amplifier circuit is
used where the gain of the amplifier is adjusted according to voltage divisions
setting. The gain of the amplifier is adjusted by varying the value of the
feedback resistor using a network of resistors and transistors, figure [3]. By
switching the transistors in this network on and off, the resistance between the
two terminals of the network is changed to the desired value. When the
number of levels is increased, a decoder can be used to reduce the number of
output pins used from the microcontroller.

After adjusting the amplitude of the signal to be limited between -

1.25v and +1.25v, a DC-shift of 1.25v is added so as to make the zero-level at
the middle of the range and the AC swing between the range limits ( 0v-2.5v ).
This DC shift is also connected to the Vmid pin on the ADC chip. The ADC
automatically adjusts the output to make this value the mid point.The added
DC shift is not fixed but is made variable to allow the reference level of the
signal to be adjusted.

A point to consider here is the frequency range of the amplifier used.

The voltage gain generally decreases with frequency as can be see in the
following graph [4] :

Figure 3.Op-amp frequency response

As we can see, the loss in the open-loop gain as frequency increase

has to be taken into account.

3.2 Sampling and Digitization:

Figure 4. Analog to digital converter schematic diagram

Figure 5. The ADC on board.

The AD7829 used is a high speed, 8-bit analog-to-digital converter with

a maximum throughput of 2 M-Sample/s. It can operate on a 3v or 5v power
source, but in our case it is operated on 5v to eliminate the need for two
power sources in the circuit. the chip has an on-chip Track-and-Hold circuit
and an internal voltage reference of 2.5v when operated on a supply voltage
of 5v. The ADC converter outputs the data in parallel mode.

The operation of the ADC is controlled by the microcontroller. A

conversion start signal is sent to ADC to initiate a conversion, afterwards, the
microcontroller waits for about 420ns before reading the sample from the bus.

At the end of conversion the ADC sends the End-Of-Conversion (EOF) signal
to the microcontroller.

The data acquisition process can be summarized in two steps:

1- Check for triggering: read a new value and compare to the previous
value to check if the triggering value and direction have been satisfied. keep
in mind that with a 2 MSPS conversion rate each sample takes 500ns to
complete, so the microcontroller has to be able, within 500ns, to perform the
intructions required to check for triggering and signal the ADC to start
converting the next sample.

2- If the triggering conditions are satisfied read 128 consecutive samples

and save them to a 128-byte array in the memory.

4. The User Interface

The WG12864A [3] LCD we choose is a 128x64 pixels LCD that is

convenient in size and in DPI for our project, it is 88mmX65mm size is a
pocket size, with a good viewing angel

Figure 6. The LCD internal components.

The interface focused on the simplicity, we tried to make the interface as

same as the interface used in the usual lab oscilloscopes. so it will be easy to
the new user to rely on our device in his daily basis work. The interface
composed of the following input and output devices:

1. Output Devices:
o Graphical LCD: the output device for the oscilloscope which
present the signals and the values measured by the controller
and the analog to digital converter.
2. Input Devices:
o Knobs: to change the voltage, time divisions.
o Switches:
o probes: are the input for the signal we measure.

Mode of operation:

User in the default mode has main axes on the LCD; the axes are
divided so it will be easy to the user to measure the (time, voltage) values. To
display any specific values like the voltage and time divisions user has to
press a switch key so they will be displayed temporarily,, to save the space on
the LCD, as he is pressing that switch. Time and voltages needed to be
modified to get best view for the signal measured. Text displayed while
pressing the switch will overwrite the displayed signal or the main axes only
the areas occupied by the characters, which optimizes the space.

5. The Assembled System and Performance

An initial prototype of the whole system is shown in the following

image. The signal source used is a sound card of laptop, and the signal is a
sinusoidal signal with frequency about 15Khz.

Figure 7. The full picture

More photographs of the LCD display showing different sinusoidal
signals with division size are shown below. The position of the information text
is flexible and can be easy moved to different parts of the display..

Figure 8.The oscilloscope in action, the text information.

In its current state the device can display signals up to 200 KHz (that
is, 5 samples per cycle at 1 MSps). The device can be upgraded to display
signals up to 400 KHz by merely changing a single resonator on-circuit (thus,
increasing the sampling rate to 2 MSps).

This frequency limit was imposed (as mentioned above) by the inability
and inefficiency of using surface mount devices, which limited us to DIP
analog to digital chips, with a maximum rate of 2MSps.

Triggering is currently only a simple level-triggering on a falling edge,

other forms of triggering are to be added.

Although the device doesn't currently contain a lot of features, our
design approach leaves a lot of processing time to add features in the future
in a very flexible manner.

6. Future Work
Enhancing Portability:

We intend to do power measurements to approximate the battery

lifetime. We are also working on creating a PCB to reduce the size of the
device thus increasing its portability. Editing the software for lower power
consumption is also being considered, this can include decreasing the dsPIC
clock speed when computation is not intensive, and powering down the ADC
in periods of no sampling activity.

More Triggering options:

Adding more triggering to our oscilloscope will be one of our main

future milestones, types of trigger include:

• external trigger, a pulse from an external source connected to a

dedicated input on the scope.
• edge trigger, an edge-detector that generates a pulse when the input
signal crosses a specified threshold voltage in a specified direction.
• video trigger, a circuit that extracts synchronizing pulses from video
formats such as PAL and NTSC and triggers the time base on every
line, a specified line, every field, or every frame. This circuit is typically
found in a waveform monitor device.
• delayed trigger, which waits a specified time after an edge trigger
before starting the sweep. No trigger circuit acts instantaneously, so
there is always a certain delay, but a trigger delay circuit extends this
delay to a known and adjustable interval. In this way, the operator can
examine a particular pulse in a long train of pulses[1]

Signal Parameters Measurement:

The device should be able to do some measurements such as the minimum

and the maximum values, peak-to-peak values, frequency, period and rising

Adding another channel and an X-Y mode:

Adding another channel to the device will allow the user to monitor 2
signals at the same time on the LCD. Furthermore, a plot of the varying
voltage on one channel versus the other can be generated, in what is known
as the X-Y mode. This is especially useful for graphing I-V curves (current
versus voltage characteristics) for components such as diodes, as well as
Lissajous patterns. Lissajous figures are an example of how an oscilloscope

can be used to track phase and frequency differences between multiple input
signals. This is very frequently used in broadcast engineering, to plot the left
and right stereophonic channels, to ensure that the stereo generator is
calibrated properly. [1]

Plug in Ad-ons:

This will allow the user to attach external devices and sensors to the
Oscilloscope and will allow him to gather data from those devices, which will
give him some great options and extra functionality to the system.

Adding a 'save' feature:

This will allow the user to save screen shots inside the internal memory
(or by adding an extra memory if required), and view them later on the LCD or
download them to the PC for further analysis.

7. References

1. Oscilloscopes , wikipedia:
2. The dsPIC 30f4011 data sheet:
3. The LCD (WG12864A) data sheet:
4. The LM358 Low Power Dual Operational Amplifier datasheet:
5. The AD7822/25/29 Data sheet: