Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 65

Course Code: EEE 402; Project-II

Microcontroller Based Portable Digital Oscilloscope

23 August, 2013

DEPARTMENT OF ELECTRICAL & ELECTRONIC ENGINEERING


PREMIER UNIVERSITY
Chittagong-4203, Bangladesh

1
PREMIER UNIVERSITY
DEPARTMENT OF ELECTRICAL & ELECTRONIC
ENGINEERING

Microcontroller Based Portable Digital Oscilloscope

Supervised By:

Tuton Chandra Mallick

Assistant Professor
Dept. of EEE Premier University

………………………………
Signature of Supervisor

Project Submitted By:

………………………. ………………………….. ……………………….


Sunny Das Afsana Parvin Nusrat Rahim
ID: 0951120107 ID: 0951120118 ID: 0951120123

2
Department of Electrical and Electronic Engineering
Premier University, Chittagong
Chittagong-4203, Bangladesh

The project titled “Microcontroller Based Portable Digital Oscilloscope” submitted by Sunny
Das; Roll No: 0951120107, Afsana Parvin; Roll No: 0951120118, Nusrat Rahim; Roll No:
0951120123 session April-09 for partial fulfillment of the requirement for the degree of Bachelor
of Science in Electrical and Electronic Engineering.

3
Declaration
This is to certify that the work presented in this project entitled “Microcontroller Based
Portable Digital Oscilloscope” is the outcome of the investigation carried out by me under the
supervision of Mr.Tuton Chandra Mallick, Assistant Professor, Department of Electrical and
Electronic Engineering (EEE), Premier University Chittagong. It is also declared that neither this
project nor any part there of it has been submitted elsewhere for the award of any degree or
diploma.

Supervised By:

……………………………
Tuton Chandra Mallick
Assistant Professor
Department of Electrical & Electronic Engineering
Premier University Chittagong.

Author

………………………. ………………………….. ……………………….


Sunny Das Afsana Parvin Nusrat Rahim
ID: 0951120107 ID: 0951120118 ID: 0951120123

4
Dedication

To Beloved Parents

5
Acknowledgements

With the grace of Almighty, we have completely finished our project work. Our heartfelt thanks
to our Supervisor, Mr.Tuton Chandra Mallick, Assistant Professor, Department of Electrical &
Electronic Engineering (EEE), Premier University, Chittagong. Without his support and courage
we won’t be able to finish our project work. It is really a pleasure & honor to work with him. We
would like to thank to our lab assistants Gaji Jiaur Rahman & Md. Shahjahan and also to our
friend Shuvadip Bhowmik. We would like to thank to our honorable Chairman, Department of
Electrical & Electronic Engineering (EEE), Premier University, Chittagong, for his support to
our project.

6
Abstract

The following report details the development & implementation of a low-cost Microcontroller
based one channel oscilloscope.

This project attempts to achieve the same functionality as a traditional oscilloscope, using a PIC
Microcontroller for data acquisition (Including appropriate analogue circuitry) by converting
analog input values into digital values & stores them into Microcontroller memory. The
Microcontroller processes this value & then displays the waveform as it would appear on a
traditional CRT Oscilloscope. Our oscilloscope has additional features not present on a
traditional oscilloscope (e.g. peak to peak value & frequency) with greater flexibility as
additional features can be added as their developed without the need for new hardware.

The digital based oscilloscope should display low frequency waveforms in a real time, but for
higher frequency waveforms it is not able to understand this waveform in real time as missing of
many data between two adjacent samples.

7
Contents
CHAPTER-1

Introduction

Pages
1.1 Introduction………………………………………………….. 12

1.2 Motivation of Our Work …………………………………… 12

1.3 Structure of the Report ………………………………………… 12

CHAPTER-2

Concept of Oscilloscope
2.1Definition of Oscilloscope ………………………………………… 14

2.2Working Process …………………………………………………… 15

2.3 Definition of Digital Oscilloscope ………………………………… 15

2.4 What Can You Do With It? ……………………………………… 15

2.5 Factors of an Oscilloscope ……………………………………….. 16

2.6 Types of Oscilloscope ………………………………………………. 24

2.7 Analog Oscilloscope ………………………………………………………….. 26

2.8 Digital Oscilloscope ………………………………………………………….. 27

2.9 Sampling Methods ……………………………………………………………. 28

CHAPTER-3
8
Design Procedure

3.1 What is Microcontroller…………………………………………………………. 31

3.2 What is Microcontroller based Oscilloscope? ……………………………….. 31

3.3 Block Diagram of Our Design……………………………………………….. 32

3.4 Working Procedure of Our Project …………………………………….......... 32

3.5 Advantage of Microcontroller Based Oscilloscope…………………………….. 33

CHAPTER-4

Hardware Design
4.1 Introduction …………………………………………………………………… 35

4.2 Schematic Diagram …………………………………………………………… 36

4.3 List of Used components ……………………………………………………… 37

4.4 An Image of Real Hardware …………………………………………………… 39

CHAPTER-5

Software Part
5.1 Introduction …………………………………………………………………… 41

5.2 Flow Chart …………………………………………………………………….. 41

5.3 Code of Our Project…………………………………………………………….. 43

9
CHAPTER-6

Performance Analysis

6.1 Result from Proteus ……………………………………………………………..


53

6.2 Result from Hardware ………………………………………………………….


53

6.3 Comparison of the Result from


Proteus & Hardware. ……………………………………………
54

6.4 Comparison of a Real Result with Our Oscilloscope and


a Standard Oscilloscope ……………………………………………..

6.5 Cost Estimation ………………………………………………………………


54

6.6 Rating of Our Oscilloscope ………………………………………………

CHAPTER-7

Conclusion

7.1 Advantages of Our Oscilloscope………………………………….


56

7.2 Limitation of Our Project ……………………………………………..

7.3 Future Advancement (Project II) ……………………………………………………………….

REFERENCES.........................................................................................
APPENDIX…..........................................................................................

10
CHAPTER-1

Introduction
1.1 Introduction

1.2 Motivation of Our Work

1.3 Structure of the Report

11
CHAPTER-1
Introduction

1.1 Introduction
Oscilloscope has become a vital element in our day to day life. From a Physician to a
Mechanic, everyone needs it. As a student of Electrical Engineering, we felt its necessity very
badly. But, it is a matter of sorrow, that this useful equipment is not cheap at all. From that
thought, we made a Digital Oscilloscope which is Microcontroller based. Our only goal is to
make Oscilloscope more Available, Portable, Cheaper and also easy to operate

1.2 Motivation of Our Work


Oscilloscope is a very important device for all sectors, especially in engineering sectors. But
the market price of an oscilloscope is too high & portable oscilloscope is not available in the
market. So we have motivated to design & develop a system, which works as a mini
oscilloscope, for displaying signals of interest & make the unit portable. This mini oscilloscope
has built using the microcontroller & a GLCD. This is much cheaper than market oscilloscope.

1.3 Structure of Our Project


The first chapter of our project report is named as introduction. It introduces us about the
motivation & introduction of the oscilloscope. Chapter two is about the concept of oscilloscope.
It describes the definition, working procedure, factors, types, sampling methods. The next
chapter is design procedure which describes about microcontroller, block diagram & advantages.
Chapter four is hardware design. Here we found the schematic diagram, list of components &
image of our hardware. The next portion is software part which contains program code & flow
chart. Then we describe performance analysis. The description of result from proteus &
hardware, cost estimation & rating of oscilloscope we get from here. At last we have discussed
about the advantages, limitations of our project in conclusion.

12
CHAPTER-2

Concept of Oscilloscope

2.1 Definition of Oscilloscope

2.2 Working Process

2.3 Definition of Digital Oscilloscope

2.4 What Can You Do With It?

2.5 Factors of an Oscilloscope

2.6 Types of Oscilloscope

2.7 Analog Oscilloscope

2.8 Digital Oscilloscope

2.9 Sampling Methods

CHAPTER-2

13
Concept of Oscilloscope

2.1 Definition of Oscilloscope


An oscilloscope is a measurement apparatus able to visually depicting regular changes in
electrical activity, such as an electrical current or signal.

The oscilloscope is a graph-displaying device .it draws a graph of an electrical signal. In most
applications the graph shows how signals change over time. The vertical (Y) axis represents
voltage and the horizontal (X) axis represents time. Sometimes the intensity or brightness of the
display is called the Z axis (See Figure 2.1). This simple graph can tell us many things about a
signal. Here are a few:

1. We can determine the time and voltage values of a signal.

2. We can calculate the frequency of an oscillating signal.

3. We can see the "moving parts" of a circuit represented by the signal.

4. We can tell if a malfunctioning component is distorting the signal.

5. We can find out how much of a signal direct current (DC) or alternating current (AC) is.

6. We can tell how much of the signal is noise and whether the noise is changing with time.

Figure 2.1: X, Y, and Z Components of a Displayed Waveform.

2.2 Working Process

14
The waveform that appears on the display of an oscilloscope results from the interaction between
an introduced electrical signal and a cathode ray tube (CRT) inside the apparatus. The CRT
contains phosphor that becomes an illuminated dot when an electron beam touches it. As the
input signal strikes the deflection plates attached to the CRT, the dot moves upward if the
voltage is positive and downward if it is negative anywhere.

2.3 Definition of Digital Oscilloscope


A digital oscilloscope is a complex electronic device composed of various software and
electronic hardware modules that work together to capture, process, display and store data that
represents the signals of interest of an operator.

2.4 What Can You Do With It?

Oscilloscopes can be used by everyone from television repair technicians to physicists. Those
users are able to designing or repairing electronic equipment.

The usefulness of an oscilloscope is not only limited in the world of electronics. With the use of
proper transducer, an oscilloscope can measure all kinds of occurrences. A transducer is a device
that creates an electrical signal, such as sound, mechanical stress, pressure, light, or heat. For
example, a microphone is a transducer.

An automotive engineer generally uses an oscilloscope to measure engine vibrations. A medical


researcher uses an oscilloscope to measure brain waves.

Figure 2.2: Scientific Data Gathered by an Oscilloscope.

2.5 Factors of an Oscilloscope

15
The factors involved in one oscilloscope is better than other because of some factors like:
bandwidth, number of channels, sampling rates, memory depth, resolution and accuracy (display
capacity), triggering capability, probe requirement, connectivity and analysis capability.

2.5.1 Bandwidth:

We know that the bandwidth is the difference in frequency between the highest and lowest
frequency roll-offs where response has fallen by – 3dB. However, modern oscilloscopes respond
to DC (which is 0 Hz), then they are said to be DC coupled and the bandwidth is simply the
highest frequency of operation (roll-off).

Now a days a 20MHz oscilloscope is the slowest oscilloscope (1/20MHz=50ns) that you could
buy. A 40 MHz handheld digital oscilloscope will display 40 MHz waveforms and a 100 MHz
Analog oscilloscope will display 100 MHz waveforms, are not at its correct amplitude (29%
error), but attenuated by 71% of its true amplitude (- 3 dB point).

Distortion of 29%, because as the frequency increases, the gain (output/input) decreases and
making the display less accurate. For example, a Saw tooth wave has components at 2, 4, 6, 8,
and 10 … times the fundamental frequency. As the frequency increases these components
become smaller, a 2 KHz Saw tooth wave will contain components at 2 KHz, 4 KHz, 6 KHz, 8
KHz, and 10 KHz… Hence, a sufficient number of these harmonics must be present to
accurately represent this sawtooth wave.

Therefore, 100 MHz Analog oscilloscope has a larger bandwidth then 40 MHz handheld digital
oscilloscope and it will display more accurate. A useful rule of thumb is that you should
purchase an oscilloscope with a bandwidth 5 times higher than the maximum frequency signal
you will require (Oscilloscope Bandwidth Required = Frequency Component of Measured Signal
* 5). However, high bandwidth oscilloscopes are expensive because higher bandwidth will likely
provide more accurate reproduction of your signal.

2.5.2 Number of Channels:

Most oscilloscopes in use today are dual-channel models. Before you purchase an oscilloscope
make sure if it is a 2 or 4 channels. Single-channel oscilloscopes can display one waveform at
once, dual-channel oscilloscopes can display two waveforms at once and 4-channels
oscilloscopes can display four waveforms at once.

The 4-channel oscilloscopes are use to view the relationship of several signal and it allow to
make precision measurements fast and efficiently. The 100 MHz Analog and Handheld Digital
oscilloscope are both dual-channel. For Handheld Digital oscilloscope, when use two channels at
maximum sampling rate, the DAC converts the signal in each channel in turn and resulting in a
half of the digitizing rate per channel compared with that available when using one channel.

For a 4-channel Digital oscilloscope, when use four channels at maximum sampling rate, the
16
DAC converts the signal in each channel in turn and resulting in a quarter of the digitizing rate
per channel.

2.5.3 Sample Rate:

The sample rate is the rate at which the input signal is converted to a digital signal and sampling
rate is the inverse of the resolution. For example, if you are interested in 20ns resolution between
point A and B, then the sampling rate that can provide this resolution is 1/20ns = 50*10^6
sample/sec.

The faster the oscilloscope can sample, the more accurately (greater the resolution) it can
represent fine details in a fast signal and less likely that critical information or event will be lost.
The minimum sample rate may also be important if you need to look at slowly changing signals
over longer periods of time. Remember that the Nyquist theorem says that the signal must be
sampled at least twice as fast as its highest frequency. If waveforms are periodic then you can
save money by selecting an oscilloscope that provides equivalent time or random periodic
sampling.

The main advantage of Handheld Digital Oscilloscope over 100MHz Analog Oscilloscope are
the memory depth, 200*10^6 sample/sec (5ns resolution), and you can use Dual Waveform Math
(DWM) and Fast Fourier Transform (FFT) function to perform quick waveform analyses in both
time and frequency domains.

DWM function to perform math functions for signal addition and subtraction from multiple
channels and FFT function allows you to view the waveform in a frequency domain using four
windowing techniques (Rectangular, Henning, Hamming and Black-Harris).

2.5.4 Memory Depth:

The Handheld Digital Oscilloscope is up to 250 times the memory depth with 125 kilobytes of
memory depth per channel and you can capture long time spans and non-repeating signals while
maintaining a maximum sampling rate of 200 MS/s.

The memory depth is the number of samples which can be stored in memory, memory depth and
sampling are related.

Memory depth required depends on the time selected need to measure and the time resolution
require.

The digital storage oscilloscopes (DSOs) store captured samples in a buffer memory and for a
given sampling rate; the size of the buffer memory determines how long it can capture a signal
for before the memory is full. The memory depth benefits are fast sampling at long time bases,
time base zoom, and memory segmentation to let you capture a sequence of events.

17
However, high-speed waveform memory is expensive because it takes time to process a longer
memory.

2.5.5 Display Capability:

Figure 2.3: Various Display Capability.

Both Analog and Digital Oscilloscopes allow you to display phase shift, rise time, fall time,
delay, pulse width, duty cycle, frequency and period.

The Handheld Digital Oscilloscope comes with a color display to allow you to quickly and
clearly identify your signal.

The 100 MHz Analog Oscilloscope provides a high intensity 6-inch rectangular type cathode-ray
tube with red internal gratitude. It displays clear readable traces even at high sweep speeds.
Internal gratitude lines eliminate parallax-viewing error between the trace and the gratitude line.
It has two-channel, dual-sweep and each channel has 11 basic deflection factors from 2mV to 5V
per division. The horizontal defection system provides single, dual or delayed sweeps from 0.5s
to 50ns per division (delayed sweep, 50ms to 50ns per division).

2.5.6 Triggering Capability:

18
Both Analog and Digital oscilloscope allow you to trigger and display non-periodic signals such
as single pulses, as well as periodic signals such as sine waves and square waves. The types of
trigger include: Trigger Modes (AUTO, NORM, TV), trigger Source (CH1, CH2, LINE, EXT),
Trigger Coupling (AC, DC, HFR, LFR), Trigger ("+" or "-" polarity or TV sync polarity) and
Trigger Sensitivity. The trigger can also be delayed by the predefined time interval. Analog
Oscilloscopes only display the signal after receiving the trigger and Digital Oscilloscopes, the
trigger tells the oscilloscope to save the present data in memory.

The Handheld digital Oscilloscope comes with flexible triggering capabilities that allow you to
isolate and capture the condition you want to characterize. The advanced triggering includes
edge, pulse width, pattern, and video functionality to help you isolate the signal you want to see.
The Auto scale enables the instruments to quickly display any active signals, and automatically
adjust the vertical and horizontal settings with trigger control for best-possible signal display.

2.5.7 Probe Requirement:

Figure 2.4: Probe requirement of an oscilloscope.

To make measurements with an oscilloscope, you can use oscilloscope probe to connect the
circuit to be tested to the channel 1 or 2 input of your oscilloscope, and you will get more precise
measurements.

19
There are three types of oscilloscope probes, first is 1X probe and it supplies an input signal that
is of the same amplitude as the signal being measured. The second is 10X probe and it provides
and input signal that is attenuated by a factor of ten. The third types of oscilloscope combines the
first two types and it has a small switch that allows you to switch between the 1X setting and the
10X setting.

The U1604A comes with a blue (not red) and a black oscilloscope probe, the unit’s BNC
connectors are blue and red. The color difference is the safety ratings.

2.5.8 Connectivity:
Blue represents 600 V CAT. III while black is 300 V CAT.III. DMM Probes include insulated
alligator clip attachments, because the BNC connectors are recessed.

The 40MHz Handheld Digital Oscilloscope comes with USB 2.0 full-speed interface and the
waveform can be saved (as a data file for further analysis or as an image file for documentation),
printed, annotate, manipulated and displayed as a computer file.

2.5.9 Analysis Capability:

Analog and Handheld Digital oscilloscopes have similar triggering capabilities and to store
analog oscilloscope waveform you have to photograph it.

On the other hand, the handheld oscilloscope's capability with the PC Link application software
and you can control the instrument remotely from PC, retrieve your waveform and print it using
a connected printer.

2.6 Types of Oscilloscope


Electronic equipment can be divided into two types: analog and digital. Analog equipment works
with continuously variable voltages, while digital equipment works with discrete binary numbers
that may represent voltage samples. For example, a conventional phonograph turntable is an
analog device; a compact disc player is a digital device.

Oscilloscopes also come in analog and digital types. An analog oscilloscope works by directly
applying a voltage being measured to an electron beam moving across the oscilloscope screen.
The voltage deflects the beam up and down proportionally, tracing the waveform on the screen.
This gives an immediate picture of the waveform.

In contrast, a digital oscilloscope samples the waveform and uses an analog-to-digital converter
(or ADC) to convert the voltage being measured into digital information. It then uses this digital
information to reconstruct the waveform on the screen.

20
Figure 2.5: Digital and Analog Oscilloscopes Display Waveforms

For many applications either an analog or digital oscilloscope will do. However, each type does
possess some unique characteristics making it more or less suitable for specific tasks.

People often prefer analog oscilloscopes when it is important to display rapidly varying signals
in "real time" (or as they occur).

Digital oscilloscopes allow you to capture and view events that may happen only once. They can
process the digital waveform data or send the data to a computer for processing. Also, they can
store the digital waveform data for later viewing and printing. Analog Oscilloscopes display
signals as they happen.

2.7 Analog Oscilloscope

Although there are various types of oscilloscopes, the two main kinds are analog and digital,
which corresponds to the primary classes of electronic devices. Analog oscilloscopes are less
complex, and they provide a more immediate measurement of signals in terms of their property
of being continually variable. The probe inputs the voltage to be measured, and the electron
beam inside the oscilloscope's CRT creates the waveform on the grid display as the electrical
signal deflects it in the relevant direction.

21
Fig 2.6: Block Diagram of an Analog Oscilloscope.

2.8 Digital Oscilloscope

Digital oscilloscopes, on the other hand, incorporate an analog-to-digital converter (ADC) to


sample the invisible waveform that represents the voltage being measured. After the information
is transformed to a sequence of 0s and 1s, the oscilloscope uses the binary data to reproduce the
waveform on the machine's display screen. While digital oscilloscopes don't function in real time
like the analog variety, they can allow users to store the waveform information in a format
suitable for printing, saving and further processing or manipulation.

Some of the systems that make up digital oscilloscopes are the same as those in analog
oscilloscopes; however, digital oscilloscopes contain additional data processing systems. With
the added systems, the digital oscilloscope collects data for the entire waveform and then
displays it.

When you attach a digital oscilloscope probe to a circuit, the vertical system adjusts the
amplitude of the signal, just as in the analog oscilloscope.

Next, the analog-to-digital converter (ADC) in the acquisition system samples the signal at
discrete points in time and converts the signal's voltage at these points to digital values called
sample points. The horizontal system's sample clock determines how often the ADC takes a
22
sample. The rate at which the clock "ticks" is called the sample rate and is measured in samples
per second.

The sample points from the ADC are stored in memory as waveform points. More than one
sample point may make up one waveform point.

Together, the waveform points make up one waveform record. The number of waveform points
used to make a waveform record is called the record length. The trigger system determines the
start and stop points of the record. The display receives these record points after being stored in
memory.

Depending on the capabilities of your oscilloscope, additional processing of the sample points
may take place, enhancing the display. Pretrigger may be available, allowing you to see events
before the trigger point.

Fig 2.7: Block Diagram of a digital Oscilloscope.

2.9 Sampling Methods


The sampling method tells the digital oscilloscope how to collect sample points. For slowly
changing signals, a digital oscilloscope easily collects more than enough sample points to
23
construct an accurate picture. However, for faster signals, (how fast depends on the
oscilloscope's maximum sample rate) the oscilloscope cannot collect enough samples. The digital
oscilloscope can do two things:

It can collect a few sample points of the signal in a single pass (in real-time sampling mode) and
then use interpolation. Interpolation is a processing technique to estimate what the waveform
looks like based on a few points. It can build a picture of the waveform over time, as long as the
signal repeats itself (equivalent-time sampling mode).

2.9.1 Real-Time Sampling with Interpolation:

Digital oscilloscopes use real-time sampling as the standard sampling method. In real-time
sampling, the oscilloscope collects as many samples as it can as the signal occurs (See Figure
2.8). For single-shot or transient signals you must use real time sampling.

Fig 2.8: Real Time Sampling.

2.9.2 Equivalent-Time Sampling:

Some digital oscilloscopes can use equivalent-time sampling to capture very fast repeating
signals. Equivalent-time sampling constructs a picture of a repetitive signal by capturing a little
bit of information from each repetition (See Figure 2.9). You see the waveform slowly build up
like a string of lights going on one-by-one. With sequential sampling the points appear from left
to right in sequence; with random sampling the points appear randomly along the waveform.

Fig 2.9: Equivalent-Time Sampling


24
CHAPTER-3

Design Procedure

3.1 What is Microcontroller

3.2 What is Microcontroller based Oscilloscope?

3.3 Block Diagram

3.4 Working Procedure

3.5 Advantage of Microcontroller Based Oscilloscope

25
CHAPTER-3

Design Procedure
3.1 What is Microcontroller?
Microcontroller brought out a revolution in our daily life. In these days microcontroller s are like
silent worker ranging from the washing machines to the video recorder. These microcontrollers
are programmed controlled. All microcontrollers operate on a set of instructions (or the user
program) stored in their memory. A microcontroller fetches the instructions from its program
memory one by one, decodes these instructions, and then carries out the required operations.

Traditionally microcontroller has been programmed by using the assembly language. Having the
fast response, it has several disadvantages. Learning and the writing process of this language is
more difficult.

3.2 What is Microcontroller based Oscilloscope?


In a microcontroller based oscilloscope, data acquisition & manipulation is done by the microcontroller.
All processes for displaying wave into the monitor is done by one or more microcontrollers.

26
3.3 Block Diagram of Our Design

Figure 3.1: Block Diagram of Digital Oscilloscope.

3.4 Working Procedure

At first, we give an input signal. The ADC module of Microcontroller takes sample of the given
signal and converted it in 10 bit binary number at a time. This 10 bit binary number stores in a
memory location of RAM. This process repeats after a moment again & again. Here, the
Microcontroller uses 128 memory locations of RAM. At the same time, the input signal is
applied to the zero level crossing detector which creates a pulse signal having frequencies same
as input signal. These pulses are counted by the Timer/Counter module of Microcontroller for a
second. This counted pulse for a second is equal to the frequency of input signal. The
Microcontroller also measure peak to peak value from input signal by determine the difference
between highest and lowest peak value. After acquiring & storing 128 data from ADC module
and measuring frequency & peak to peak value, the next process is to show the output in GLCD
& ASCII LCD. The data stored in the RAM which is an integer number divided by 16 to form a
range of data from 0 to 64.The GLCD has (128*64) pixel. The x-axis has 128 pixels and y-axis
has 64 pixels. To show the 128 values acquired from ADC module which are from 0-64, the
27
Microcontroller sends the data to the GLCD. Thus GLCD shows this data in its display, as a
form of point. So, we will see a continuous point distribution & understands as a shape of wave,
which is equivalent to input. The measured peak to peak value and frequency is displayed in
ASCII LCD by the Microcontroller.

There is an option to scaling the waveform that shows in the GLCD in horizontal axis and
another option to scaling in the vertical axis.

3.5 Advantage of Microcontroller Based Oscilloscope

1. Some microcontrollers have built-in ADC module. So, it is not need to use a separate analog
to digital converter circuit.

2. All processes can be easily controlled by the microcontroller.

3. It is easy to displaying a wave into the graphical LCD display and need not to use another
separate circuitry.

28
CHAPTER-4

Hardware Design
4.1 Introduction

4.2 Schematic Diagram

4.3 List of Used components

4.4 An Image of Real Hardware

29
CHAPTER-4
Hardware Design

4.1 Introduction
To build our oscilloscope we use microcontroller for data acquisition & manipulate, & a GLCD
for displaying waveform in our design. We also used LCD & another additional circuitry to get
extra opportunity. The schematic diagram of the project has given in the next page of this
chapter.

30
4.2 Schematic Diagram

Figure 4.1: Schematic diagram of our project.

31
4.3 List of Used components
1. Microcontroller; model-PIC 18F452

2. Graphical LCD Display; model-LGM 12641BS1R

3. LCD

4. Zener diode

5. Resistors

6. Power supply

7. Connecting wires

8. Switches

9. Capacitors

10. Voltage Regulator

11. LM 324

4.3.1 Microcontroller; model-PIC 18F452:


A microcontroller is the type of small computer on single integrated circuit. Which contains a
processor core, programmable input/output & memory peripherals? Microcontrollers are
designed for enclosed applications, in contrast to the microprocessors which are used in personal
computers & other applications. For details see Appendix-A.

4.3.2 Graphical LCD Display; model-LGM 12641BS1R:


This component is specially manufactured to be used with microcontrollers. It is used for
displaying different points named pixel on a liquid crystal display. It can display 128 pixels in
‘X’ axis and 64 pixels in ‘Y’ axis. So, it has 128X64 pixels. It is also possible to display images,
letters, any line, dot or array of dots at any location of this display. Other useful features include
clear and invert dot, LED backlight etc.

4.3.3 LCD:

32
LCD (Liquid Crystal Display) screens are based on the principle of blocking light (rather than
emitting it). They use up much less power than standard CRT (Cathode Ray Tube) monitors. In
our project we use LCD to see the peak to peak value & frequency.

4.3.4 Zener diode:


A zener diode is a special kind of diode which permits current to flow in the forward direction
as normal, but will also allow it to flow in the reverse directions when the voltage is above
certain value- the breakdown voltage known as zener voltage.

4.3.5. Resistors:

A resistor is an electrical component that limits or regulates the flow of electrical current in an
electronic circuit. Resistor can also be used to provide a specific voltage for an active device
such as a transistor.

4.3.6. Power supply:


A power supply is a device that supplies electric power to an electric load. In our project we used
a 5 volt dc supply.

4.3.7. Connecting wires:


Connecting wires are used to connect the different component in our project.

4.4 An Image of Real Hardware

33
Figure 4.2: .An image of real Hardware.

34
CHAPTER-5

Software Part
5.1 Introduction

5.2 Flow Chart

5.3 Code of Our Project

35
CHAPTER-5

Software Part

5.1 Introduction
To build our oscilloscope we used simulation software named Proteus. By the help of this
software we found the error of our circuit & also can overcome it. Any circuit can be simulated
in virtual world by using this software.

5.2 Flow Chart

36
Clear GLCD

Program selects a channel by which microcontroller acquires data from an analog input signal.
Then it start A/D conversion, counting pulses & stores data in memory. It processes these data &
send signals to GLCD as it can display wave shape. If push switch is pressed, then it sets mode

37
of operation.Then it calculate peak to peak value, frequency & sends signal to LCD to display
peak to peak value & frequency. Then it clears GLCD. This process will done again & again.

The source code that represents this flow chart given in the APPENDIX-B.

38
CHAPTER-6

Performance Analysis

6.1 Result from Proteus

6.2 Result from Hardware

6.3 Comparison of the Result from Proteus &


Hardware

6.4 Comparison of a Real Result with Our Oscilloscope


and a Standard Oscilloscope

6.5 Cost Estimation

6.6 Rating of Oscilloscope

CHAPTER-6

Performance Analysis
39
6.1 Result from Proteus
At first we draw the circuit on the simulating software Proteus. Then we execute the circuit. We
get different output wave for different type of inputs. When we give an input of sine wave, we
can see the output on GLCD as a sine wave with peak to peak value & V/d on LCD.Same
phenomenon will occur for other input wave shapes such as triangular and rectangular wave.

Figure 6.1: Wave shape from Proteous.

6.2 Result from Hardware


Our result from hardware is same as result from Proteus. So; we can say that the result of
simulation and hardware is matched.

Figure 6.2: Wave shape from Hardware.

6.3 Comparison of the Result from Proteus & Hardware


For a sine wave, triangular wave & rectangular wave input there is no difference between the
results of Proteus & Hardware. But, there is little difference between peak to peak value of
Proteus & Hardware. For a 3V peak to peak sine wave input, Proteus shows 3V peak to peak
value, but hardware shows 3.08V peak to peak value.

6.4 Comparison of a Real Result with Our Oscilloscope and a Standard


Oscilloscope
40
In a standard oscilloscope they have high frequency rating i.e., 20 MHz or above. But our
oscilloscope has low frequency rating as 300 Hz. A general CRT oscilloscope have a line voltage
of 230Vac (50/60Hz) rating. On the contrary, we have 9Vdc.Maximum current rating of a
market oscilloscope is 250 mA, where we have 19mA.A market oscilloscope has maximum
power of 30W but we have 0.18W.

6.5: Cost Estimation


SL.NO. Name of the apparatus Rating Model Price

01. Microcontroller PIC18F452 500Tk

02. GLCD 128*64 dots LGM12641BS1R 1500Tk

03. LCD 2*16 characters HD44780 200Tk

04. Battery 9V, 1.5V 50Tk

05. Trainer Board 250Tk

06. Barrow Board 20Tk

07. Soldering Leads 25Tk

08. Quartz Crystal 8MHz 20Tk

09. Resistor 1K, 0.5K 5Tk

10. Capacitor 1000uF 20Tk

11. Voltage Regulator IC 5V LM7805 40Tk

12. Connecting Wires 60Tk

Total=2690Tk

6.6: Rating of Oscilloscope

SL. Characteristics Rating of Market Rating of Our


NO. Oscilloscope Oscilloscope

01. Frequency 20 MHz 300Hz


41
02. Supply Voltage 230 Vac 9 Vdc

03. Maximum Supply Current 250 mA 19mA

04. Maximum Power 30 W 0.18 W

42
CHAPTER-7

Conclusion
7.1 Advantages of Our Oscilloscope

7.2 Limitation of Our Project

CHAPTER-7

Conclusion

7.1 Advantages of Our Oscilloscope


1. Capturing and logging electronic events.
43
2. Needs only easily portable interface circuit.

3. High sampling speed.

4. Easy to Install.

5. Low cost.

7.2 Limitation of Our Project


1. The display of our oscilloscope has low resolution.

2. The frequency bandwidth of our oscilloscope is too low.

3. It can‟t show input signal frequency & time/division.

4. It is not able to store data on the portable memory chip.

5. It has only one input channel.

REFERENCES
1. PIC Microcontrollers programming in C -by Milan Verle.

2. Advanced PIC Microcontrollers projects in C-by Dogan Ibrahim.

3. Electra-ku.lt 4. PIC Microcontroller project book-by John Iovine

44
5. PIC Microcontroller and Embedded System-by Mazide , Rolin D.Mckinlay

6. www.8051projects.net

7. www.scribd.com

45
APPENDIX

APPENDIX –A

Description of PIC 18F452 Microcontroller

46
The elaborate functional description of PIC18F452 given at datasheet. Here, we only discussed
about some important terms & features of this Microcontroller which needs for our project
report.

Block diagram of PIC18F452:

47
Figure: Block diagram of the PIC18F452 microcontroller.

Pin description of PIC18F452:


48
MCLR/VPP:
Master Clear (Reset) input or programming voltage input. This pin is an active low RESET to
the device.

RA0 - RA5:
These are the bi-directional Input / output PORTA pins. RA1, RA2, are the analog inputs 1,
analog input2. RA3, RA4 can also be analog input3, analog input4 or analog reference voltage.
RA4 can also be the clock input to the Timer0 module. Output is open drain type. RA5 can also
be analog input4 or the slave select for the synchronous serial port.

VSS:
Ground reference for logic and I/O pins.

OSC1/CLK1:
Oscillator crystal input / External clock source input.

OSC2/CLKO:
Oscillator Crystal output. Connect to Crystal or resonator in Crystal Oscillator mode.

RC0 – RC7:
These are the bidirectional Input / Output PORTC pins.

RC0 can also be the Timer1 oscillator output or Timer1 Clock input. RC1/T1OSI is the Timer1
oscillator input. RC2/CCP is the Capture1 input/Compare1 output/ PWM1 output.
RC3/SCK/SCL, RC3 can also be the synchronous serial clock input/output for both SPI and IC
modes. RC4/SDI/SDA is the SPI Data In (SPI mode) or Data I/O (I2C mode). RC5/SDO is e the
SPI Data Out (SPI mode). RC6 RC7.

VDD:
Positive supply for logic and I/O pins.

RB0 – RB7:
These are the bi-directional I/O PORTB pins. PORTB can be software programmed for
Internal weak pull-up on all inputs. RB0/INT0 is the digital I/O, external interrupt 1. RB1/INT1
is the digital I/O, external interrupt 2. RB2/INT2 is the digital I/O, external interrupt 3.

49
RB3/CCP2 is the digital I/O, capture 2 input. RB04 is the digital I/O. RB5/PGM is the digital
I/O, low voltage ICSP programming pin.

RB6/PGC is the digital I/O, in circuit debugger and ICSP programming pin. RB6/PGC is the
digital I/O, in circuit debugger and ICSP programming pin. RB7/PGD is the digital I/O, in circuit
debugger and ICSP programming pin.

RD0 – RD7:
These are the bi-directional I/O PORTD pins. PORTD can be software Programmed for internal
weak pull-up on all inputs. RD0/PSP0 is the digital I/O, parallel slave port bit 0. RD1/PSP1 is the
digital I/O, parallel slave port bit 1. RD2/PSP2 is the digital I/O, parallel slave port bit 2.
RD3/PSP3 is the digital I/O, parallel slave port bit 3. RD4/PSP4 is the digital I/O, parallel slave
port bit 4. RD5/PSP5 is the digital I/O, parallel slave port bit 5. RD6/PSP6 is the digital I/O,
parallel slave port bit 6. RD7/PSP7 is the digital I/O, parallel slave port bit 7.

RE0 – RE3:
In the PIC18F452 microcontroller, PORTE is only 3 bits wide. RE0/RD/AN5 is the digital I/O,
parallel slave port read and control pin, Analog input 5. RE1/WR/AN5 is the digital I/O, parallel
slave port writes and control pin, Analog input 6. RE0/CS/AN7 is the digital I/O, parallel slave
port CS, Analog input 7.

PORTA and the TRISA Register:


PORTA is a 7-bit wide, bi-directional port. The corresponding data direction register is TRISA.
If TRISA = 1 then corresponding pin will configure as input. If TRISA = 0 then corresponding
pin will configure as output.

PORTB and the TRISB Register:


PORTB is a 8-bit wide, bi-directional port. The corresponding data direction register is
TRISB. If TRISB = 1 then corresponding pin will configure as input. If TRISB = 0 then
corresponding pin will configure as output.

PORTC and the TRISC Register:


PORTC is a 8-bit wide, bi-directional port. The corresponding data direction register is TRISC.
If TRISC = 1 then corresponding pin will configure as input. If TRISC = 0 then corresponding
pin will configure as output.

PORTD and the TRISD Register:

50
PORTD is a 8-bit wide, bi-directional port. The corresponding data direction register is TRISD.
If TRISD = 1 then corresponding pin will configure as input. If TRISD = 0 then corresponding
pin will configure as output.

51
52
53
54
APPENDIX-B

5.3 Source Code

// Glcd module connections

char GLCD_DataPort at PORTD;

unsigned short y[128],low,high;

unsigned temp_res;

int x,vd=3,xsistor=1,q;

unsigned int peak;

unsigned short m=1;

unsigned short d1;

unsigned short d2;

sbit GLCD_CS1 at RB0_bit;

sbit GLCD_CS2 at RB1_bit;

sbit GLCD_RS at RB2_bit;

sbit GLCD_RW at RB3_bit;

sbit GLCD_EN at RB4_bit;

sbit GLCD_RST at RB5_bit;

sbit GLCD_CS1_Direction at TRISB0_bit;

sbit GLCD_CS2_Direction at TRISB1_bit;

sbit GLCD_RS_Direction at TRISB2_bit;


55
sbit GLCD_RW_Direction at TRISB3_bit;

sbit GLCD_EN_Direction at TRISB4_bit;

sbit GLCD_RST_Direction at TRISB5_bit;

// End Glcd module connections

// LCD module connections

sbit LCD_RS at RC4_bit;

sbit LCD_EN at RC5_bit;

sbit LCD_D4 at RC0_bit;

sbit LCD_D5 at RC1_bit;

sbit LCD_D6 at RC2_bit;

sbit LCD_D7 at RC3_bit;

sbit LCD_RS_Direction at TRISC4_bit;

sbit LCD_EN_Direction at TRISC5_bit;

sbit LCD_D4_Direction at TRISC0_bit;

sbit LCD_D5_Direction at TRISC1_bit;

sbit LCD_D6_Direction at TRISC2_bit;

sbit LCD_D7_Direction at TRISC3_bit;

// End LCD module connections

//For display lcd

char line1[]="Voltage/Div 01.0";

char line2[]="peak2peak 00.00";

56
void Display_Lcd(int i, unsigned int j)

line1[15]=i%10+48;

line1[13]=(i/10)%10+48;

line1[12]=(i/100)%10+48;

line2[14]=j%10+48;

line2[13]=(j/10)%10+48;

line2[11]=(j/100)%10+48;

line2[10]=(j/1000)%10+48;

Lcd_Out(1, 1, line1);

Lcd_Out(2, 1, line2);

//User-defined function

void channel1()

x=0;

while (x<128) //loop for ADC data acquire

temp_res=0;

temp_res=Adc_Read(3);

d1=temp_res;

d2=temp_res>>8;

57
y[x]=63-((((d1+256*(d2))/17)-30)*m+30);

x++;

//User-defined function

//User-defined function

void channel2()

x=0;

while (x<128) //loop for ADC data acquire

temp_res=0;

temp_res=Adc_Read(2);

d1=temp_res;

d2=temp_res>>8;

y[x]=63-((d1+256*(d2))/17);

x++;

//User-defined function

void channel3()

58
x=0;

while (x<128) //loop for ADC data acquire

temp_res=0;

temp_res=Adc_Read(1);

d1=temp_res;

d2=temp_res>>8;

y[x]=63-((d1+256*(d2))/17);

x++;

//User-defined function

void channel4()

x=0;

while (x<128) //loop for ADC data acquire

temp_res=0;

temp_res=Adc_Read(0);

d1=temp_res;

d2=temp_res>>8;

y[x]=63-((d1+256*(d2))/17);

59
x++;

//User-defined function

void main() {

ADCON1=0x80;

ADCON0=0b00010001;

//PORTA=0x00;

TRISA=0b11111111;

TRISB.F6=TRISB.F7=1;

PORTC=0;

TRISC=0;

Lcd_Init(); // Initialize LCD

Lcd_Cmd(_LCD_CLEAR); // Clear display

Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off

Glcd_Init();

Glcd_Fill(0x00);

while (1) //main loop start

60
if(xsistor==1) //condition for which channel acquire data

channel1();

else if(xsistor==2)

channel2();

else if(xsistor==3)

channel3();

else

channel4();

x=0; //loop for display signal

while (x<128)

Glcd_dot(x, y[x], 1);

x++;

x=0; //loop for push button switch

while(x<=2500) //delay 2500 ms

if(Button(&PORTB, 6, 1, 0))

vd=(vd+7+1)%7;

//For increasing or decreasing

61
Delay_ms(200);

break; // voltage/division

if(Button(&PORTB, 7, 1, 0))

vd=(vd+7-1)%7;

Delay_ms(200);

break;

x++;

Delay_ms(1);

switch (vd) //switch case start

case 0:

m=10; xsistor=1; q=1;

break;

case 1:

m=5; xsistor=1; q=2;

62
break;

case 2:

m=2; xsistor=1; q=5;

break;

case 3:

m=1; xsistor=1; q=10;

break;

case 4:

m=1; xsistor=2; q=20;

break;

case 5:

m=1; xsistor=3; q=50;

break;

case 6:

m=1; xsistor=4; q=100;

break;

default:

break;

} //switch case end

x=0; low=high=y[0]; //for determine highest & lowest peak

while (x<128)

63
{

if (y[x]>high)

high=y[x];

if (y[x]<low)

low=y[x];

x++;

peak=(high-low)*10*q/12; //peak to peak

Display_Lcd(q,peak); //argument 1 for testing;i place "peak"


hare;which for "peak to peak" value

x=0; //loop for clear display

while (x<128)

Glcd_dot(x, y[x], 0);

x++;

64
65

You might also like