SlideShare a Scribd company logo
1 of 67
Download to read offline
KIGALI INSTITUTE OF SCIENCE AND TECHNOLOGY (KIST)




                                     Avenue de l’armée

                                    PO BOX 3900 Kigali – Rwanda

                                         www.kist.ac.rw

                                 FACULTY OF ENGINEERING

                   DEPARTMENT OF ELECTRICAL AND ELECTRONICS

                 PROGRAM OF ELECTRONICS AND TELECOMMUNICATION

                                PROJECT REPORT ON



             DESIGN OF A COMPUTER-BASED
            SYSTEM TO PROCESS AN ANALOG
                       SIGNAL

                                   Submitted by:

                               GASHEMA Gaspard (GS 20060092)

                                 IYAKAREMYE Dieudonné(GS 20060189)

                                          Under guidance of:

                   Supervisor: TWIRINGIYIMANA Remy

Submitted in partial fulfillment of the requirements for the award of

                          BACHELOR OF SCIENCE DEGREE IN

                   ELECTRICAL AND ELECTRONICS ENGINEERING (EEE)



                                                                        September, 2010


                                                 i
CERTIFICATION
This is to certify that the work presented in this report entitled: “DESIGN OF COMPUTER
BASED SYSTEM TO PROCESS AN ANALOG SIGNAL ” is an original work of
GASHEMA Gaspard and IYAKAREMYE Dieudonné and it has not been submitted to any
                                                           ;
university or elsewhere in any form for the award of any degree.




Supervisor                           Head Of Department of Electrical and Electronic
                                     Engineering:

TWIRINGIYIMANA Remy                  ZIMULINDA François




Signature: ………………………                 Signature:…………………………………………



Date…:…………………………                     Date        …..……………………………………..




                                            ii
DECLARATION
We, GASHEMA Gaspard and IYAKAREMYE Dieudonné hereby declare that, the work
                                                                ,
presented in this report is our own contribution. To the best of our knowledge, this same work
has never been presented or submitted to any other Universities or institutions of higher learning
for the award of any degree.

We therefore declare that, this work is our own contribution for the partial fulfillment of the
award of the degree of Electronics and Telecommunication Engineering in KIST.



GASHEMA Gaspard                      IYAKAREMYE Dieudonné

REG No.: GS20060092                                   REG No.: GS20060189



Signature: ………………                               Signature: ………………



Date: ……………………                                   Date: ……………………



This report has been submitted for examination with the approval of the following supervisor:

TWIRINGIYIMANA Remy

Department of Electrical and Electronics Engineering, KIST

Signature: ………………………………………..

Date: ……………………………………………..




                                                iii
DEDICATION
This project is dedicated:

To the Almighty God

To our families

To our friends




                             iv
ACKNOWLEDGEMENT

We are thankful to the Almighty God for the given gift of life and guidance, especially during
this project. Also we are grateful for members of our families and relatives. Our thanks go to
KIST and SFAR for their financial contribution for carrying out our studies. We sincerely thank
Mr. TWIRINGIYIMANA Remy, for his kind guidance and for his provision of necessary
facilities to carry out this project work. Thanks to several former lecturers and classmates who
broadened our knowledge and technical skills to fulfill the requirement to this project. We wish
to extend our deep sense of gratitude to our beloved parents for their encouragement throughout
our studies.

God bless you all.




                                               v
ABSTRACT
This project has the aim of designing a system that can make decision electronically thereby
speeding up the operations made and improving electronic system by using digital system. The
work to be done was concentrated on acquiring analog signal and processing of this acquired
signal using a personal computer. Digital filters were designed using Matlab programming to
process the acquired signals. This was achieved through the use of electronic equipments such as
signal generator, oscilloscope, computer and interfacing circuit. In fact, the main task to be
carried out in this project is to design a computer-based system to acquire and process an analog
signal generated by front end devices such as function generator. There were two ways to realize
the practice of this project. The first one consisted the use of zelscope software as oscilloscope
which analyzes signal originates from mobile phone. The mobile phone was used to play music
(audio signal) in order to be analyzed by zelscope on PC screen. On other hand, this audio signal
from mobile phone were acquired and analyzed with matlab programming Language. Finally,
the analyzed signal by matlab had to be compared with that obtained when using zelscope. The
second one concerned with acquiring real time signal generated from function generator and
compare the processed signal on PC with the signal displayed on oscilloscope. This work was
carried out in KIST laboratory building (KIST4) in electronics lab (Second Floor- room 33)




                                                vi
TABLE OF CONTENTS
CERTIFICATION ............................................................................................................................................... i
DECLARATION .............................................................................................................................................. iii
DEDICATION ................................................................................................................................................. iv
ACKNOWLEDGEMENT ................................................................................................................................... v
ABSTRACT..................................................................................................................................................... vi
TABLE OF CONTENTS................................................................................................................................... vii
LIST OF FIGURES AND TABLES ...................................................................................................................... ix
LIST OF TABLES .............................................................................................................................................. x
LIST OF ABBREVIATIONS AND SYMBOLES .................................................................................................... xi
CHAPTER 1: INTRODUCTION ......................................................................................................................... 1
   1.1. General introduction.......................................................................................................................... 1
   1.2. Structure of project report .................................................................................................................. 1
   1. 3. Statement of the problem .................................................................................................................. 1
   1.4. Significance and justification ............................................................................................................. 1
   1.5. Objectives .......................................................................................................................................... 2
       1.5.1. Main objective ............................................................................................................................ 2
       1.5.2. Specific objectives ....................................................................................................................... 2
   1.6. Scope and limitation of the project .................................................................................................... 2

                                                                              vii
1.7. Methodology ...................................................................................................................................... 2
CHAPTER 2: LITERATURE REVIEW ................................................................................................................. 4
   2.1. Electrical instrumentation signals ...................................................................................................... 4
      2.1.1. Analog and digital signals ............................................................................................................ 4
      2.1.2 Basic analog signal measurements .............................................................................................. 4
      2.2.1. DSP applications ....................................................................................................................... 11
      2.2.2. The Basic DSP Operations ......................................................................................................... 15
   2.3. Data Acquisition Toolbox ................................................................................................................ 15
      2.3.1. Basic Steps for Acquiring Data .................................................................................................. 15
      2.3.2. Acquiring Data with a Sound Card ............................................................................................ 15
   2.4. Computer sound cards...................................................................................................................... 19
      2.4.1. Introduction to computer sound cards ..................................................................................... 19
      2.4.2. Analog versus Digital object related to sound card .................................................................. 20
      2.4.3. Conditions required to interface any signal to computer sound card ...................................... 22
      2.4.4. Chip Chat Sound Card Technical Specifications ........................................................................ 22
CHAPTER 3: SYSTEM DESIGN ...................................................................................................................... 25
   3.1. Example of analyzing data by matlab .............................................................................................. 25
      3.1.1. Signal analysis ........................................................................................................................... 25
   3.2. Data Acquisition with MATLAB Programming ............................................................................. 27
   3.3. Digital Filter Design ........................................................................................................................ 29
      3.3.1. FIR digital filter .......................................................................................................................... 31
      3.3.2. Band Pass filter Design Specifications....................................................................................... 32
      3.3.3.Low pass filter Design Specifications ......................................................................................... 33
   3.4. The design using zelscope ............................................................................................................... 34
   3.5. Design using physical devices ......................................................................................................... 36
      3.5.1. Designing methodology and process ........................................................................................ 36
      3.5.2. Procedure of experiment .......................................................................................................... 39
CHAPTER4. ANALYSIS OF RESULTS AND DISCUSSION ................................................................................. 41
   4.1. Analysis of results ............................................................................................................................ 41
      4.1.1. Results about Zelscope ............................................................................................................. 41
      4.1.2. Description of interface circuit ................................................................................................. 44
   4.2. Discussion ........................................................................................................................................ 48
      4.2.1. Discussion about the use of Zelscope ....................................................................................... 48

                                                                            viii
4.2.2. Discussion about oscilloscope................................................................................................... 48
CHAPTER5. CONCLUSION AND RECOMMENDATIONS................................................................................ 50
   5.1. Conclusion ....................................................................................................................................... 50
   5.2. Recommendations ............................................................................................................................ 50
REFERENCES: ............................................................................................................................................... 52
APPENDICES ................................................................................................................................................ 53




LIST OF FIGURES AND TABLES
Figure2. 1: Analog Oscilloscope Block Diagram[9] ...................................................................................... 5
Figure2. 2: Triggering Stabilizes a Repeating Waveform[9] ......................................................................... 6
Figure 2.3: Digital Oscilloscope Block Diagram[9] ....................................................................................... 7
Figure 2.4: Real Time Sampling Diagram [9] ................................................................................................ 8
Figure 2.5: Linear and Sine Interpolation Diagram [9] .................................................................................. 8
Figure 2.6: Equivalent-time Sampling Diagram[9] ........................................................................................ 9
Figure2. 7: Zelscope with two analyzing signal [14] .................................................................................... 9
Figure 2.8: Normal mode, with both channels displayed[14] ....................................................................... 10
Figure 2.9: Broadcasting via satellite[11] ..................................................................................................... 12
Figure 2.10: Dish antenna used for helping in navigation [11]. .................................................................... 13
Figure 2.11: Processing of audio signal [11] ................................................................................................. 14
Figure 2.12: Acquisition of data with sound card[16] ................................................................................... 16
Figure 2.13: Frequency component of Tuning Fork[16] .............................................................................. 18
Figure 2.14: Computer sound card [13] ......................................................................................................... 19
Figure 2.15: Analog signal to be sampled by soundcard[12] ........................................................................ 20
Figure 2.16: An analog-to-digital converter measures sound waves at frequent intervals [12]. ................... 21
Figure 2.17: A PCI sound card[12] ............................................................................................................... 22
Figure 2.18: mono connector[13] .................................................................................................................. 23
Figure2. 19: Stereo connector[13] ................................................................................................................. 24
Figure 2.20: Jack[13]..................................................................................................................................... 24
Figure 3.21: Signal analyzed by matlab....................................................................................................... 26
Figure 3.22: Power Spectral density of data ............................................................................................... 27
                                                                             ix
Figure 3.23: Data Acquired using Matlab acquisition program .................................................................. 28
Figure 3.24: Power spectrum density of data acquired using Matlab acquisition program ........................ 29
Figure 2.25: A conceptual Representation of digital filter .......................................................................... 31
Figure 3.26: Band-pass filter design ........................................................................................................... 32
Figure 3.27: Low pass filter design............................................................................................................. 33
Figure 3.28: Filtrered Data Acquired using Matlab programming ............................................................. 34
Figure 3.29: Block diagram showing the design using Zelscope................................................................ 35
Figure 3.30: Photo of signal generator ........................................................................................................ 36
Figure 3.31: Photo of analog oscilloscope .................................................................................................. 37
Figure 3.32: Photo of PC ........................................................................................................................... 37
Figure 3.33: Photo of interface circuit ........................................................................................................ 38
Figure 3.34: Interfacing circuit between PC sound card and signal generator ........................................... 38
Figure 3.35: Block diagram of the design using oscilloscope .................................................................... 39
Figure 3.36: Photo of experiment for complete system .............................................................................. 39
Figure 4.37:Signal analyzed on Zelscope Display ...................................................................................... 41
Figure 4.38: Accquisition of signal “Data” ................................................................................................. 42
Figure 4.39: Power spectral density of data ................................................................................................ 43
Figure 4.40: Filtered signal “data” .............................................................................................................. 44
Figure 4.41: Acquired signal “data” .......................................................................................................... 46
Figure4. 42: Power spectral density of unfiltered signal “data” ................................................................. 47
Figure 4.43: Filtered signal “data”of figure 4.41 ........................................................................................ 48


LIST OF TABLES
Table.1: Results for interface circuit. .......................................................................................................... 45




                                                                          x
LIST OF ABBREVIATIONS AND SYMBOLES
: Ohm                                         DAC: Digital to Analog Converter

A: Ampere                                      DC: Direct Current

AC: Alternative Current                        DSP: Digital Signal Processing

ADC: Analog to Digital Converter               EEE: Electrical and Electronics engineering

ADPCM: Adaptive Differential Pulse Code        ETE: Electronics and Telecommunication
Modulation                                     Engineering

AI: Analog Input                               FFT: Fast Fourier Transform

Apass: Attenuation pass band                   Fig:Figure

Astop: attenuation stop band                   FIR: Finite Impulse Response

BPF: Bass Pass Filter                          Fpass: Pass band Frequency

CD: Compact Disc                               FS: Sampling Frequency

CH: Channel                                    Fstop: Stop band Frequency

CODEC: Coder/Decoder                           GS: Government Sponsor

CRT: Cathode Ray Tube                          Hz: Hertz

                                          xi
I/P: input

IBM: International Business Machines

IEEE: Institute of Electrical and Electronic
Engineers

IIF: Infinite Impulse response

ISA: Industry Standard Architecture

K: Kilo (103)

KIST: Kigali Institute of Science and
Technology

m: meter

m: milli (10-3)

O/P: Output

PC: Personal Computer

PCI: Peripheral Component Interconnect

RADAR: Radio Detection And Ranging

RMS: Root Mean Square

SFAR: Student Financing Agency for
Rwanda

SONAR: Sound Navigation And Ranging

V: Volt




                                               12
CHAPTER 1: INTRODUCTION

1.1. General introduction
An oscilloscope is one of the equipments needed to perform this research. Therefore, an
understanding of its working principle is required. To better understand the oscilloscope
controls, one need to know a little more about how oscilloscopes display a signal .Although there
are two types of oscilloscopes: analog and digital, in this work only the analog will be used.
Analog oscilloscopes work somewhat differently than digital oscilloscopes. However, several of
the internal systems are similar. Analog oscilloscopes are somewhat simpler in concept and are
described first, followed by a description of digital oscilloscopes. The working principle of these
two types of oscilloscope and the difference between them will be shown clearly in the following
chapters. Computers are used at the heat of almost every electronic system due to the fact that
their ability to quickly process and store large amount of data makes system more versatile and
perform many functions. The filters used here are digital because computers understand only
digital data. The design of these digital filters was done using Matlab software.

1.2. Structure of project report
This project report contains five chapters. The first chapter is introduction which discusses about
overview and motivation of this work .The second chapter is literature review which provides
details about what others have done concerning this research and set a benchmark for the current
as well as justifying the specific solution techniques. The third chapter deals with the system
design. The fourth chapter discusses the obtained result. Finally, the fifth chapter is all about the
conclusion and recommendations giving summary of the main findings statement of the
encountered problem as well as limitations.

1. 3. Statement of the problem
It has been observed that all over the world today’s electronics equipments are all almost of
digital in nature. Before the development of the digital equipments, the use of early devices in
some applications did not give the accurate output especially in Telecommunication due to many
factors including easy attraction of random disturbances or variations introduced in system
leading to the delay and losses for the signal. This problem will be recovered by the use of digital
equipments associated by some software. But nowadays; the arrival of digital equipments makes
the system very suitable and fast. Even due to the flexibility, digital system will lead the low cost
equipments. Due to these advantages of digital system, today and future’s life will become
digitalized.

1.4. Significance and justification
The work to be done helps in understanding and practices the concept of Digital Signal
Processing (DSP) techniques. These achieved by using computer to learn data acquisition

                                                 1
applications and Matlab software for designing Digital Filters which will be used to denoise the
acquired signal . Digital filtering is exceptionally flexible and can easily incorporate non-lineal
operations such as clipping or removal of data samples that appear to the incompatible with
neighboring samples, and therefore erroneous indicate the source. Moreover, it is much easier to
determine the response of a digital system than analog system. This is because the digital system
can be described by its difference equation and this is directly amenable to a solution using
computer.

1.5. Objectives

1.5.1. Main objective

     Designing a computer-based system to process an analog signal generated from front
      ended devices such as function generator.

1.5.2. Specific objectives
     Understanding how to install and use Zelscope application software.
     Acquiring analog signals using MATLAB Data acquisition toolbox.
     Designing digital filters using MATLAB Program.
     Denoising the acquired signals using digital filter.
     Displaying the processed signals on PC and appreciating the comparison with the signal
      displayed on oscilloscope.

1.6. Scope and limitation of the project
This study is about the design of a computer based system to process an analog signal. The study
is concentrated only the analysis of signals generated from end devices such as signal generator
and mobile phone with the frequencies which are audible (i.e. frequencies of the ranges from
20Hz to 20 kHz). The filters used to denoise the acquired signal are FIR low and band-pass filter
with equiripple methods.

1.7. Methodology
The methodologies used to achieve the objectives of this work are books bellowed in different
Libraries including KIST Library and internet documentations. Besides experiment, using
programming languages such as MATLAB carried out in KIST laboratory building (KIST4) in
electronics lab (Second Floor- room 33).

Equipments:

The following are electronic equipments that were used:
    Signal generator.
    Analog oscilloscope.
    Personal Computer.
                                                2
 Mobile phone
 Buffer circuit used as front end interfacing device(for signal generator).




                                             3
CHAPTER 2: LITERATURE REVIEW
In order to get a clear understanding on the work to be done, it is necessary to make a review on
what was done by other researchers on the same field. This includes a review on some
applications, programs; components used to this research. The review of them is described
below.



2.1. Electrical instrumentation signals

2.1.1. Analog and digital signals

2.1.1.1. Definitions

A signal is any kind of physical quantity that conveys information. Audible speech is certainly a
kind of signal, as it conveys the thoughts (information) of one person to another through the
physical medium of sound. Hand gestures are signals, too, conveying information by means of
light.

2.1.1.2. Types of signal

There are two kind of signal: analog and digital signal. The difference between these signals is
described below. An analog signal is a kind of signal that is continuously variable whereas a
digital signal is one having discrete set of values [9]. A well-known example of analog versus
digital is that of clocks: analog being the type with pointers that slowly rotate around a circular
scale, and digital being the type with decimal number displays or a "second-hand" that jerks
rather than smoothly rotates. The analog clock has no physical limit to how finely it can display
the time, as its "hands" move in a smooth, pauseless fashion. The digital clock, on the other
hand, cannot convey any unit of time smaller than what its display will allow for [9].

2.1.2 Basic analog signal measurements
To measure analog signal, it is better to know the instrumentation and instrument.
Instrumentation is a field of study and work centering on and control of physical processes.
These physical processes include pressure, temperature, flow rate, and chemical consistency. An
instrument is a device that measures and/or acts to control any kind of physical process. Due to
the fact that electrical quantities of voltage and current are easy to measure, manipulate, and
transmit over long distances, they are widely used to represent such physical variables and
transmit the information to remote locations [4][9].The most widely used instrument to measure
such electrical quantity is oscilloscope as it being described its working principle below in
fig.2.1.

                                                4
2.1.2.1. Oscilloscope.
How does an oscilloscope work?

To better understand the oscilloscope controls, you need to know a little more about how
oscilloscopes display a signal. Analog oscilloscopes work somewhat differently than digital
oscilloscopes. However, several of the internal systems are similar. Analog oscilloscopes are
somewhat simpler in concept and are described first, followed by a description of digital
oscilloscopes.

2.1.2.1.1. Analog Oscilloscopes
When you connect an oscilloscope probe to a circuit, the voltage signal travels through the probe
to the vertical system of the oscilloscope. Following Figure is a simple block diagram that shows
how an analog oscilloscope displays a measured signal.




Figure2. 1: Analog Oscilloscope Block Diagram[9]



Depending on how you set the vertical scale (volts/div control), an attenuator reduces the signal
voltage or an amplifier increases the signal voltage.

Next, the signal travels directly to the vertical deflection plates of the cathode ray tube (CRT).
Voltage applied to these deflection plates causes a glowing dot to move. (An electron beam
hitting phosphor inside the CRT creates the glowing dot). A positive voltage causes the dot to
move up while a negative voltage causes the dot to move down.
The signal also travels to the trigger system to start or trigger a "horizontal sweep." Horizontal
sweep is a term referring to the action of the horizontal system causing the glowing dot to move
across the screen. Triggering the horizontal system causes the horizontal time base to move the
glowing dot across the screen from left to right within a specific time interval. Many sweeps in
rapid sequence cause the movement of the glowing dot to blend into a solid line. At higher
speeds, the dot may sweep across the screen up to 500,000 times each second.
Together, the horizontal sweeping action and the vertical deflection action trace a graph of the
signal on the screen. The trigger is necessary to stabilize a repeating signal. It ensures that the
                                                5
sweep begins at the same point of a repeating signal, resulting in a clear picture as shown in
following figure [9].




Figure2. 2: Triggering Stabilizes a Repeating Waveform[9]

In conclusion, to use an analog oscilloscope, you need to adjust three basic settings to
accommodate an incoming signal:

       The attenuation or amplification of the signal. Use the volts/div control to adjust the
       amplitude of the signal before it is applied to the vertical deflection plates.
      The time base. Use the sec/div control to set the amount of time per division represented
       horizontally across the screen.
      The triggering of the oscilloscope. Use the trigger level to stabilize a repeating signal, as
       well as triggering on a single event.

Also, adjusting the focus and intensity controls enables you to create a sharp, visible display.


2.1.2.1.2. Digital Oscilloscopes


Based on [9], 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 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.
                                                 6
Pretrigger may be available, allowing you to see events before the trigger point as shown in
fig.2.3.




Figure 2.3: Digital Oscilloscope Block Diagram[9]

Fundamentally, with a digital oscilloscope as with an analog oscilloscope, you need to adjust the
vertical, horizontal, and trigger settings to take a measurement.

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
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).

  i.   Real-Time Sampling with Interpolation




                                               7
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 following
figure for single-shot or transient signals you must use real time sampling [9].




Figure 2.4: Real Time Sampling Diagram [9]
Digital oscilloscopes use interpolation to display signals that are so fast that the oscilloscope can
only collect a few sample points. Interpolation "connects the dots." Linear interpolation simply
connects sample points with straight lines. Sine interpolation (or sin x over x interpolation)
connects sample points with curves. (See Following Figure2.5) Sin x over x interpolation is a
mathematical process similar to the "oversampling" used in compact disc players. With sine
interpolation, points are calculated to fill in the time between the real samples. Using this
process, a signal that is sampled only a few times in each cycle can be accurately displayed or, in
the case of the compact disc player, accurately played back.




Figure 2.5: Linear and Sine Interpolation Diagram [9]


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 Following Figure2.6) 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 [9].




                                                  8
Figure 2.6: Equivalent-time Sampling Diagram[9]

2.1.2.2. Zelscope review

2.1.2.2.1 What is Zelscope?

Zelscope is Windows software that converts PC into a dual-trace storage oscilloscope and
spectrum analyzer. It uses computer's sound card as analog-to-digital converter, presenting a
real-time waveform or spectrum of the signal - which can be music, speech, or output from an
electronic circuit. Zelscope features the interface of a traditional oscilloscope, with conventional
gain, offset, time base, and trigger controls. As a real-time spectrum analyzer, Zelscope can
display the amplitude and phase components of the spectrum.




Figure2. 7: Zelscope with two analyzing signal [14]




                                                  9
Figure 2.8: Normal mode, with both channels displayed[14]

2.1.2.2.2. What can Zelscope use for?
Zelscope is low-frequency oscilloscope and spectrum analyzer software. It can be useful in
tuning music instruments, adjusting audio circuits, or doing physics experiments. Acoustics is
the most evident area; Zelscope also allows for an easy measurement of short time intervals in
mechanics experiments.Zelscope has proven useful in debugging music and sound processing
software [14].

Note: All known sound cards contain a capacitor which provides AC coupling and prevents DC
from reaching the card's analog to digital converter. Low-frequency oscillations (below 15-
20Hz) usually get through, but may be distorted.
According to Nigel P. Cook, Digital Signal Processor (DSP) is concerned with the digital
representation of signals and the use of signal processors to analyze, modify, or extract
information from signals. Similarly, From Wikipedia, the free encyclopedia, DSP is concerned
with the representation of signal by a sequence of numbers or symbols and the processing of
these signals. In addition, we conclude that: Digital signal processing is the technique used to
analyze various digital signals and obtain information from the same. It is also used for transfer
of information from one place to another and also involves conversion in between analogue and
digital signals. Although, DSP represents signal digitally, the signal used in most popular form of
DSP is delivered from analog signals which have been sampled at rectangular intervals and
converted into digital form. The specific reason for processing a digital signal may be, for
example to remove interference or noise from signal, to obtain the spectrum of data, or to
transform the signal into a more suitable form. DSP is now used in many areas where analog
methods were previously used and in entirely new applications which were difficult or
impossible with analog methods for example, linear phase response can be achieved, and
complex adaptative filtering algorithms can be implemented using DSP [2].

In addition the applications of DSP and its basic operations such as convolution correlation,
filtering, transformation and modulation in detail are also very important [1].


                                                10
2.2.1. DSP applications

Digital signal processing and analog signal processing are subfields of processing. But DSP
includes subfields like: audio and speech signal processing, sonar and radar signal processing,
sensor array processing, spectral estimation, statistical signal processing, digital image
processing, signal processing for communications, control of systems, biomedical signal
processing, seismic data processing, etc .The goal of DSP is usually to measure, filter and/or
compress continuous real-world analog signals. The first step is usually to convert the signal
from an analog to a digital form, by sampling it using an analog-to-digital converter (ADC),
which turns the analog signal into a stream of numbers as has seen in sampling method when the
working principle of digital oscilloscope was explained. However, often, the required output
signal is another analog output signal, which requires a digital-to-analog converter (DAC). Even
if this process is more complex than analog processing and has a discrete value range, the
application of computational power to digital signal processing allows for many advantages over
analog processing in many applications, such as error detection and correction in transmission as
well as data compression [6]. It finds its application in various areas ranging from broadcasting to
medicine. Let us have a look at some of the applications of the same.

    Biomedical Applications: DSP is used extensively in the field of biomedicine. In it, the
     various signals that are generated by the different organs in the human body are measured
     in order to find information regarding the health of the same. For example, in case of
     electrocardiograms, the electric signals generated by the heart are measured. Similarly, the
     activity of the brain is monitored by electroencephalograms.

    Automatic Control: These days, many gadgets are available that can perform their tasks
     automatically. These devices contain various components that can take inputs depending
     on the surrounding conditions. These are conveyed to the control unit of the device where
     they are processed and the necessary action is taken. For example, a device like the
     thermostat increases its resistance in proportion to temperature. This can be used to stem
     the current in a machine whenever the temperature rises.

       Broadcasting: DSP is used on a large scale for the broadcast of both television and radio
programs. In the process of recording the audio itself, a large amount of processing of the sound
waves takes place in order to enhance the same. Then, the signals are converted into digital format
and are broadcasted and are received at the respective receivers where they are again converted
into the analogous format and then, are filtered to remove the noise etc. Thus, the output of the
radio, TV etc. is generated.




                                                11
Figure 2.9: Broadcasting via satellite[11]

    Telecommunication: DSP is used to the greatest extent in this field. The various
     conversations that one carried out these days are through the means of DSP which is used
     in the transfer of the signals from one point to the other. Various methods are available to
     transfer these audio signals. For example, if satellites are used then, the audio waves are
     first converted into electromagnetic waves and then transferred over a wireless medium.
     On the other hand, in case of optical fibers, the waves are converted into light waves and
     are then transferred through these fibers [11].

        Navigation: DSP is used to a great extent in navigation. Devices or systems such as
         SONAR or Radar work primarily on the basis of DSP. For example, SONAR makes
         use of sound waves (signals) in order to calculate the depth. On the other hand, radars
         make use of radio waves in order to communicate the locations of various objects in a
         particular radius [11].




                                              12
Figure 2.10: Dish antenna used for helping in navigation [11].

Apart from those mentioned above, digital signal processing has various other applications.

For example, it is used in cars, remote controls, seismic analysis etc. Thus, DSP proves to be one
of the most useful techniques developed in the modern times [11]

Processing of audio signals is one of the most important and widely used applications of digital
signals processing. It is being used in many fields such as communication, broadcasting of audio
signals for radios, television etc. It primarily includes analysis of audio signals that fall in the
human hearing frequency by mathematical. The audio signals that fall in the human auditory
range depends both on physical and psychological factors. A separate branch has been
introduced to study the same and is called psychoacoustics. Wherever signals are concerned, one
has to deal with two different types viz. digital and analogue. The techniques that are used in
order to deal with these two types of audio signals are different. In case of analogue audio
signals, the pressure transformations are usually represented electrically in the form of voltage levels [11]




                                                      13
Figure 2.11: Processing of audio signal [11]

The digital representation of audio signals is usually in the form of binary digits that are used to
represent the pressure variations. One should note that the digital representation of the audio
signals is used only to facilitate the use of computers in the analysis of the same. In the real
world, these signals are continuous or analogous in nature. However, as the capacity of human
ears is limited, digital representation of the same is possible provided that the sampling rate of
the audio signals is high. Also, noise is always present with the audio signals that are required.
Thus, quantization of the audio signals does not result in the loss of large amount of actual
information. The generated audio is often converted into other forms in order to transfer it at
greater rates and with less amount of loss. For example, in case of optical fibers, the sound is
converted into light energy and is then transferred to the desired location. Such conversion of
audio into other forms is a part of audio processing as well. Other applications of audio
processing include broadcasting of sound, enhancement of audio etc.

 Before an audio signal is broadcasted, a large amount of processing is done on it. This includes
mixing, different steps in recording, noise reduction etc. From the processing that is carried out
later on, various audio formats are generated depending on the method that is used for audio
encoding, the amount of original audio that is retained. Then, when the audio signal is received
on devices at your homes or at other places, some amount of processing is done on it once again.
This may include amplification of the audio in order to increase its loudness, noise reduction
once again, and adding various effects to it such as surround sound. In order to obtain the
surround sound effect, two audio signals are generated from the original one and are made out of
phase with each other [11].

Apart from these, the other applications of audio processing are innumerable. Thus, it will
always be among the most popular fields in which signal processing is applied as it finds its use
in some of the most popular devices such as television, cell phones etc.



                                                14
2.2.2. The Basic DSP Operations

The basic DSP operations are:

-Filtering: Convolution of the signal x(n-k) and filter’s impulse response h(k) in time domain.

           i.e. y(n)=                     ………………….. (2.1)

The common filtering objective is to remove or reduce noise from a wanted signal. This
operation will be explained clearly when designing this project.

-Discrete transformations: allow transformation of discrete-time signals in the frequency
domain or the conversion between time and frequency domain representations .The spectrum of
signal is obtained by decomposing it its constituent frequency components using a discrete
transformation. Conversion between analog time and frequency domain is necessary in many
DSP applications. For example, it allows for more efficiency implementation of DSP algorithms
such as those for digital filtering, convolution and correlation [2].

-Modulation: As digital are rarely transmitted over long distance or stored in large quantities in
their raw form, therefore modulation is required in order to modulate signals for matching their
frequency characteristics to those of transmission /or stored media to minimize signal
distortions, to utilize signal bandwidth efficiently, or to ensure that the signals have some desired
properties. The two applications are where modulation is extensively used (employed) are
telecommunication and digital audio Engineering [2].

2.3. Data Acquisition Toolbox

2.3.1. Basic Steps for Acquiring Data

The matlab Tutorial version 7.0, 6.8 and 7.8 illustrates how to perform basic data acquisition
using analog input subsystems and the Data Acquisition Toolbox software. It tells that for most
data acquisition applications, the following basic steps are required:

Install and connect the components of your data acquisition hardware. At a minimum, this
involves connecting a sensor to a plug-in or external data acquisition device.

Configure your data acquisition session. This involves creating a device object, adding channels,
setting property values, and using specific functions to acquire data.

Analyze the acquired data using MATLAB.

In this experiment data acquisition applications can be explained using a sound card.

2.3.2. Acquiring Data with a Sound Card


                                                 15
Suppose you must verify that the fundamental (lowest) frequency of a tuning fork is 440 Hz. To
perform this task, you will use a microphone and a sound card to collect sound level data. You
will then perform a fast Fourier transform (FFT) on the acquired data to find the frequency
components of the tuning fork. The setup for this task is shown below.




Figure 2.12: Acquisition of data with sound card[16]

2.3.2.1. Configuring the Data Acquisition Session

For this, you will acquire 1 second of sound level data on one sound card channel. Because the
tuning fork vibrates at a nominal frequency of 440 Hz, you can configure the sound card to its
lowest sampling rate of 8000 Hz. Even at this lowest rate, you should not experience any aliasing
effects because the tuning fork will not have significant spectral content above 4000 Hz, which is
the Nyquist frequency. After you set the tuning fork vibrating and place it near the microphone,
you will trigger the acquisition one time using a manual trigger.

You can run the above by typing daqdoc4_1 at the MATLAB Command Window.

Create a device object — create the analog input object AI for a sound card. The installed
adaptors and hardware IDs are found with daqhwinfo.

AI = analoginput('winsound');

Add channels — Add one channel to AI.

Chan=addchannel(AI,1);

Configure property values — Assign values to the basic setup properties, and create the variables
blocksize and Fs, which are used for subsequent analysis. The actual sampling rate is retrieved
because it might be set by the engine to a value that differs from the specified value.

duration = 1; %1 second acquisition

set(AI,'SampleRate',8000)

ActualRate = get(AI,'SampleRate');

set(AI,'SamplesPerTrigger',duration*ActualRate)

set(AI,'TriggerType','Manual')
                                                       16
blocksize = get(AI,'SamplesPerTrigger');

Fs = ActualRate;

Acquire data — Start AI, issue a manual trigger, and extract all data from the engine. Before
trigger is issued, you should begin inputting data from the tuning fork to the sound card.

start(AI)

trigger(AI)

wait(AI,duration + 1)

The wait function pauses MATLAB until either the acquisition completes or the time-out elapses
(whichever comes first). If the time-out elapses, an error occurs. Adding 1 second to the duration
allows some margin for the time-out.

data = getdata(AI);

Clean up — When you no longer need AI, you should remove it from memory and from the
MATLAB workspace.

delete(AI)

clear AI

2.3.2.2.Analyzing the Data
For this, analysis consists of finding the frequency components of the tuning fork and plotting
the results. To do so, the function daqdocfft was created. This function calculates the FFT of
data, and requires the values of SampleRate and SamplesPerTrigger as well as data as inputs.

[f,mag] = daqdocfft(data,Fs,blocksize);

daqdocfft outputs the frequency and magnitude of data, which you can then plot. daqdocfft is
shown below.

function [f,mag] = daqdocfft(data,Fs,blocksize)

% [F,MAG]=DAQDOCFFT(X,FS,BLOCKSIZE) calculates the FFT of X

% using sampling frequency FS and the SamplesPerTrigger

% provided in BLOCKSIZE



xfft = abs(fft(data));



                                                  17
% Avoid taking the log of 0.

index = find(xfft == 0);

xfft(index) = 1e-17;



mag = 20*log10(xfft);

mag = mag(1:floor(blocksize/2));

f = (0:length(mag)-1)*Fs/blocksize;

f = f(:);

The results are given below.

plot(f,mag)

grid on

ylabel('Magnitude (dB)')

xlabel('Frequency (Hz)')

title('Frequency Components of Tuning Fork')




Figure 2.13: Frequency component of Tuning Fork[16]
The plot shows the fundamental frequency around 440 Hz and the first overtone around 880 Hz.
A simple way to find actual fundamental frequency is
                                               18
[ymax,maxindex]= max(mag);

maxfreq = f(maxindex)

maxfreq =441

The answer is 441 Hz.

2.3.2.3. Power spectral Density of data
Power spectral density (PSD) describes how the power (or variance) of time series is distributed
with frequency. Power spectral density function (PSD) shows the strength of the variations
(energy) as a function of frequency. In other words, it shows at which frequencies variations are
strong and at which frequencies variations are weak. Mathematically, it is defined as the Fourier
transform of autocorrelation sequence of time series. Being power per unit of frequency, the
dimension are those of power divided by Hertz[15] .

2.4. Computer sound cards
Before talking any word about sound card it is better to make a little summary for some
computer applications and its function. Larry Long and Nancy Long in their eight edition
computer book describe computer as an entertainment center with hundred of interactive games.
He adds that it is virtual university providing interactive instruction and testing, a painter’s
canvas, video telephone, a CD player, a home or office library, a television, the biggest
marketing place in the world, the family photo album, the print shop, a wind tunnel that can test
experimental airplane designs, a recorder, an alarm clock that can remind somebody to keep an
appointment, an encyclopedia, It can also perform thousands of specialty function that require
specialized skills such as preparing taxes drafting legal documents counseling suicidal patients
and much more[5][7].

2.4.1. Introduction to computer sound cards

The sound card (also called an audio card) is the part of a computer which manages its audio
input and output.




Figure 2.14: Computer sound card [13]



                                               19
Sound card is used to record data and then playing back the recorded data. The recorded data
uses the sound card’s analog input subsystem playing back data uses the card’s analog output
subsystem [14]. It is usually a controller which can be inserted into an ISA (Industry Standard
Architecture) slot or PCI (Peripheral Component Interconnect) for more recent ones, but more
and more motherboards include their own sound card [13]. Therefore sound card translates digital
sound into the electric current that is sent, to the speakers .As it have mentioned that Sounds are
defined as air pressure varying over time. To digitize sound, the waves are converted to an
electric current measured thousands of times per second and recorded as a number. When the
sound is played back, the sound card reverses this process, translating the series of numbers into
electric current that is sent to the speakers [3]. A sound card allows a computer to create and
record real, high-quality sound.

2.4.2. Analog versus Digital object related to sound card

Sounds and computer data are fundamentally different. Sounds are analog - they are made of
waves that travel through matter. People hear sounds when these waves physically vibrate their
eardrums. Computers, however, communicate digitally, using electrical impulses that represent
0s and 1s. Like a graphics card, a sound card translates between a computer's digital information
and the outside world's analog information. Sound is made of waves that travel through a
medium, such as air or water. The most basic sound card is a printed circuit board that uses four
components to translate analogue and digital information:

      An analog-to-digital converter (ADC)
      A digital-to-analog converter (DAC)
      An ISA or PCI interface to connect the card to the motherboard
      Input and output connections for a microphone and speakers

Instead of separate ADCs and DACs, some sound cards use a coder/decoder chip, also called
a CODEC, which performs both functions.




Figure 2.15: Analog signal to be sampled by soundcard[12]



ADCs and DACs
                                                20
Imagine using your computer to record yourself talking. First, you speak into a microphone that
you have plugged into your sound card. The ADC translates the analog waves of your voice into
digital data that the computer can understand. To do this, it samples, or digitizes, the sound by
taking precise measurements of the wave at frequent intervals [12].




                 Figure 2.16: An analog-to-digital converter measures sound
                 waves at frequent intervals [12].




The number of measurements per second, called the sampling rate, is measured in kHz. The
faster card's sampling rate the more accurate its reconstructed wave is. If you were to play your
recording back through the speakers, the DAC would perform the same basic steps in reverse.
With accurate measurements and a fast sampling rate, the restored analog signal can be nearly
identical to the original sound wave. Even high sampling rates, however, cause some reduction
in sound quality. The physical process of moving sound through wires can also cause distortion
[12]
    .




                                               21
Figure 2.17: A PCI sound card[12]




2.4.3. Conditions required to interface any signal to computer sound card

Before interfacing any signal to your computer sound card, many precautions are required in
order to prevent the damage of that sound card. According to theory written by Luis Guerra
edited by Christopher Lyons and Gino Sigismondi, many users of computer sound cards
purchase a professional microphone to improve upon the performance of the microphone
included with the sound card. But because interconnection procedures in the computer world
differ from those used in professional audio, it is not always easy to make a professional
microphone work with a computer. To be successful in connecting a microphone to your
computer, you must know some things about both your microphone and your sound card.

2.4.4. Chip Chat Sound Card Technical Specifications
Before connecting any signal to computer you have to pear attention with computer sound card
specifications in order to prevent that external signal to damage this sound card. Below there are
computer sound card specification for any kind of PC.

      Sound card Audio Characteristics:
      Sampling resolution: 8 and 16 bit (Stereo or monaural)
      Sample rate: 4.0 kHz - 44.1 kHz
      Dynamic range: 16 bits resolution (65535 discrete levels)
      Frequency response: 20 Hz - 20 kHz, 3dB
      Signal to Noise ratio: 80 dB
      Audio in Input Impedance: 30kΩ (30kilohms)
      Audio in Input Signal Level: 1.41Volts (RMS)

                                               22
 Microphone Input Impedance: 20kΩ (20kilohms)
    Audio Out Drive: 4Ω (4 ohms)

       Note: Most sound cards support sample frequencies approximately 5-10 kHz to 44.1 kHz.
       Sample frequency outside this rang can produce unexpected results.


    Sound card connectors characteristics:
    Audio In: Mini-phone jack (3.5 mm)
    Microphone input : Mini-phone jack (3.5 mm)
    Audio Out: Mini-phone jack (3.5 mm)
    CD-Audio: SoundBlaster and IBM (shrouded pin header, 1x4, 2 mm)
              Generic (shrouded pin header, 1x4 0.10 inch)
    IBM Front Panel: Pin header 2x8 0.10 inches
    Automatic gain for microphone
    ADPCM compression/decompression reduces audio file size on hard disk.




    Jack

The "jack" is without a doubt the most commonly used connector for small-scale audio
equipment. Jacks are normally divided into three different types, based on their diameter:

      2.5 mm jack: The smallest jack;
      3.5 mm jack: The traditional jack, which corresponds to a headphone jack;
      6.35 mm jack: The jack used for semi-professional sound systems, in order to connect
       speakers, amplifiers, or microphones.

There are two versions of each of these jacks:

      Mono jacks, for sending monophonic sound. This kind of jack has two contacts: a
       reference, found on the body of the cord, and the signal on the tip.
      Stereo jacks, for sending stereophonic sound. This kind of jack has three contacts: The
       same two as its mono counterpart, as well as an additional ring for sending another audio
       channel.




                                 Figure 2.18: mono connector[13]




                                                 23
Figure2. 19: Stereo connector[13]



In computer sound cards, the plugs for jacks are generally colour-coded so users can easily tell
which type of audio device each one connects to, and whether they are audio inputs or outputs.




                                       Figure 2.20: Jack[13]




                                                24
CHAPTER 3: SYSTEM DESIGN
This work consists of two experiments (Designs) as mentioned bellow:

   The first one consists in designing a system with Zelscope application software.
   The second design consists in developing a system whereby a signal generated by function
    generator is acquired, processed and displayed on PC screen. The same signal is displayed
    on the physical oscilloscope for comparison purpose.

3.1. Example of analyzing data by matlab
Before making the above designs it is better to lean how matlab software analyzes data
(signal).This is done with help of example. This example is obtained by recording the sound
using sound record of PC. After recording, recorded signal is saved on Desk top. The saved
signal is analyzed by Matlab.

The procedure to be discussed above is as follows:

               Click on Start bottom menu     All programs         Accessories
               Entertainments       Sound Recorder

After recording this signal, save it by using file button on sound recorder menu. This saved
signal has to be copied to workspace in Matlab software in order to analyze it with this software.

3.1.1. Signal analysis

This signal to be analyzed is obtained when it has been generated by clamping hands through
PC microphone. Next, it is saved into Matlab workspace by giving it any file name. The behavior
of this signal after to be analyzed by matlab is shown by the fig.3.21 and its Power spectral
Density(Fig.3.22) .




                                               25
Figure 3.21: Signal analyzed by matlab




                                         26
Power Spectral Density of the data
                                             -5

                                            -10

                                            -15
            Power Spectrum Magnitude (dB)



                                            -20

                                            -25

                                            -30

                                            -35

                                            -40

                                            -45

                                            -50

                                            -55
                                                  0   0.1   0.2    0.3    0.4       0.5   0.6   0.7    0.8   0.9   1
                                                                                Frequency


Figure 3.22: Power Spectral density of data



3.2. Data Acquisition with MATLAB Programming
This part of the design illustrates how to perform basic data acquisition tasks using analog input
subsystems and the Data Acquisition Toolbox software. For most data acquisition applications,
these basic steps should be followed:
   1. Create the analog input object AI for a sound card
   2. Configure your data acquisition session. This involves creating a device object, adding
      channels, setting property values, and using specific functions to acquire data.
   3. Analyze the acquired data using MATLAB.
   The experiment examines data acquisition applications using a sound card .Generally, this
   part consists of taking analog signal using matlab code and analyzing it with matlab. The
   result obtained of the signal after to be acquired by matlab codes is shown by two figures
   bellow.




                                                                                27
Figure 3.23: Data Acquired using Matlab acquisition program




                                             28
Power Spectral Density of the data
                                             -5

                                            -10

                                            -15
            Power Spectrum Magnitude (dB)



                                            -20

                                            -25

                                            -30

                                            -35

                                            -40

                                            -45

                                            -50

                                            -55
                                                  0   0.1   0.2    0.3    0.4       0.5   0.6   0.7    0.8   0.9   1
                                                                                Frequency


Figure 3.24: Power spectrum density of data acquired using Matlab acquisition program
The signals obtained above are created by clamping hands .Those three lines (on fig.
3.3.)Indicates the time intervals of the clamps . As it shows that they are number of three, means
that the times used to clamp hand is three.

Note: Although the above Figures (i.e. Fig 3.21&Fig 3.23) are analyzed by Matlab, they are not
exactly the desired signal because due the environment, this analog signal is mixed with random
noise which has to be eliminated. Therefore the design of digital filter is needed in order to
denoise this noisy signal.

3.3. Digital Filter Design
The Design process for this Filter begins with its characteristics .A digital filter is characterized
by its transfer function, or equivalently, its difference equation. Mathematical analysis of the
transfer function can describe how it will respond to any input. As such, designing a filter
consists of developing specifications appropriate to the problem (for example, a second-order
low pass filter with a specific cut-off frequency), and then producing a transfer function which
meets the specifications.The transfer function for a linear, time-invariant, digital filter can be
expressed as a transfer function in the Z-domain; if it is causal, then it has the form:



                                                                                                              …………3.2
                                                                                29
Where the order of the filter is the greater of N or M.
The above equation of transfer function originates from the solution of different equation of
digital filter:
          M                    N
y[n]   a k y[n  k ]   bl x[n  l ] …………………………………………………………………………………….3.3
          k 1                l 0



Where:

        x[n-k] is the input signal,
        y[n-l] is the output signal,
        ak and bl are the filter coefficients, also known as tap weights, and

Taking Z-transforms on both sides, applying the time shifting property, we get:


                                k  Y[z]z-k+            -k
                                                 kX[z]z ……………………………………………………….3.4


                               -k                   -k
                         kY[z]z =             kX[z]z …………………………………………………………….3.5


Y[z]                      k   z-k] = X[z]        k   z-k…………………………………………………………….3.6

H[z]=         =          k    z-k/                   k   z-k]………………………………………………………….3.7

Expanding the numerator and denominator of equation (3.7) ,we get


H[z]=             = b0+b1z-1+b2z-2+b3z-3+….+bNz-N/1+a1z-1+a2z-2+a3z-N+…+aMz-M…………3.8

By comparing equations (3.1) and (3.8), it is clear that these two equations are the same with
Y[z] =B[z] and X[z] =A[z]

This form is for a recursive filter, which typically leads to infinite impulse response behavior, but
if the denominator is unity, then this is the form for a finite impulse response filter. For FIR
digital Filter the equation (3.8) will be converted to:

H[z]= b0+b1z-1+b2z-2+b3z-3+….+bNz-N………………………………………………………………….3.9

it why the denominator of equation(3.8) is 1.

Although there are two type of Digital Filters: Finite Impulse Response(FIR) and Infinite
Impulse Response(IIR), only the FIR Filter has to be used due to its following advantages over
other kinds of filter:

        Are inherently stable. This is due to the fact that all the poles are located at the origin and
         thus are located within the unit circle.
                                                     30
   Require no feedback. This means that any rounding errors are not compounded by
       summed iterations. The same relative error occurs in each calculation. This also makes
       implementation simpler.
      They can easily be designed to be linear phase by making the coefficient sequence
       symmetric; linear phase, or phase change proportional to frequency, corresponds to equal
       delay at all frequencies.

3.3.1. FIR digital filter
Mathematically, it can be described as follows




                        H[k],k=0,1,……..
x[n](input sequence)                                 y[n](output sequence)
                        (Impulse response)



Figure 2.25: A conceptual Representation of digital filter
Where x[n] is the input signal
     h[n] is the filter which is going to filter that input signal
     y[n] is the output signal

       y[n]=                      ………..................................................................................(3.10)

Note: The above equation is the output signal from FIR filter. It is clear that for this kind of
filter, the impulse response is of finite duration since h(k) have only N values and the
denominator is unit which are among the characteristics of it(FIR filter) . Since some input
signal to the system is audio signal(signal obtained in case of playing music ) with the
bandwidth of 20 Hz-20 KHz and as has mentioned in the scope and limitation of this project, the
special kind of filters are required to denoise this signal .These kinds of filter are nothing but FIR
band-pass and low pass filter. And Linear-phase equiripple filters are desirable because they
have the smallest maximum deviation from the ideal filter when compared to all other linear-
phase FIR filters of the same order. Equiripple filters are ideally suited for applications in which
a specific tolerance must be met, such as when designing a filter with a given minimum stopband
attenuation or a given maximum passband ripple. For designing this kind of filter, it is not
necessary to go deeply into detail for the design of this filter. This kind of filter has introduced as
tool which helps to get the desired signal. The procedure of designing the intended filter starts by
typing the MATLAB command fdatool.




                                                        31
The specifications of Filters Designed are shown by Figures bellow

3.3.2. Band Pass filter Design Specifications




Figure 3.26: Band-pass filter design


From the above figure this band- pass filter (BPF) of finite impulse response (FIR) has two cutoff
frequencies: Fpass1 and Fpass2   .
      Regions between specification values like Fstop1 and Fpass1 are transition regions
       where the filter response is not explicitly defined.

      The region between Fpass1and Fpass2 the pass band zone where the desire frequencies
       have to pass.
      Fs specify the sampling frequency .Fs in Hz as a scalar trailing all other numeric input
       arguments. If you provide a sampling frequency, all frequencies in the specification are in
       Hz.
      dB specify the magnitude in dB (decibels)
      Ap — passband ripple in dB (the default units).
                                                 32
   Astop1 — attenuation in the first stopband in dB (the default units).

      Astop2— attenuation in the second stopband in dB (the default units).
      BWpass — bandwidth of the filter passband. Specified in normalized frequency units by
       default.
      BWstop — bandwidth of the filter stopband. Specified in normalized frequency units by
       default.

3.3.3.Low pass filter Design Specifications

To get the filtered data from unfiltered data of figure 3.3,we design FIR low-pass filter designed
is of equiripple methods with the following specifications:




Figure 3.27: Low pass filter design

      Region between specification values like Fpass and Fstop is transition regions where
       the filter response is not explicitly defined.


                                               33
   The region between 0 and Fpass is the pass band zone where the desire frequencies have
       to pass.
      Fs specify the sampling frequency Fs in Hz as a scalar trailing all other numeric input
       arguments. If you provide a sampling frequency, all frequencies in the specification are in
       Hz.
      dB specify the magnitude in dB (decibels)
      Apass — passband ripple in dB (the default units).
      Astop — attenuation in the stopband in dB (the default units).
      BWp — bandwidth of the filter passband. Specified in normalized frequency units by
       default.
      BWstop — bandwidth of the filter stopband. Specified in normalized frequency units by
       default.

Note:The filtered sound signal ‘data’ from figure 3.23 looks as follows:


               1.5



                1



               0.5



                0



              -0.5



                -1



              -1.5
                     0   0.5       1      1.5        2      2.5      3       3.5          4
                                                                                      4
                                                                                   x 10


Figure 3.28: Filtrered Data Acquired using Matlab programming

3.4. The design using zelscope
This design consists of using the different equipments such as Mobile phone, some wires which
interface two audio connectors: from phone’s headphone jack to computer sound card’s Audio In
for out putting signal (audio signal) to Zelescope inside PC through sound card.

                                                34
The signal is obtained when music is played using mobile phone. Then it passes to computer’s
Audio In through the wire connecting two Audio Connectors. These audio connectors are stereo.
The first one on mobile phone’s microphone line out, the second one on the sound card line in.
As the music played by mobile phone is an audio signal which is of an analog in nature, the
computer sound card is there to do the job of Analog to Digital Convertor in order to get the
output digital signal from sound card which can be understood by computer as digital equipment.
This out signal from sound card is being to be analyzed by zelscope.

When you want to analyze signal on zelscope pear attention with calibration as follows:

    1) make sure that the vertical offset for CH1 is zero (up-down slider in the middle
    position);
    2) apply a signal with a known amplitude;
    3) using V/DIV buttons and slider, adjust gain so the visible amplitude of CH1 is 2 divisions
    or higher;
    4) click CAL button, answer OK to the message box;
    5) click on the trace at the point of known voltage.
    6) type the reference voltage in the dialog box, click OK. The vertical scale may abruptly
    change, as the V/DIV setting will be now a real one.

    After analyzing the signal, you can save it using settings –save menu on Zelscope display as
    screenshot .Finally, this saved signal is being to be compared with that obtains using matlab
    programming language. Let see how this looks like using matlab programming language.

Blok diagram summarizing this first design is as follows:

      Audio connector on mobile            PC’s audio I     n
      Phone line in

                                                            Zelscope
 Mobile phone


                                           PC
                         Wire connecting two audio connectors


Figure 3.29: Block diagram showing the design using Zelscope
The following procedures used for achieving what have done using the above design:

    1) Playing music with mobile phone.
    2) Plug audio connector into mobile phone line out. This audio connector may be mono or
        stereo. But for this experiment only stereo audio connectors have used.
    3) Open zelscope software into PC
        Plug other audio connector on PC’s Audio In.
Note: audio connector on mobile phone line out and audio connector on PC’s Audio In are
linked together in other to transfer signal from mobile phone to PC.
                                               35
4) Calibrate zelscope diagram into your PC.
    5) Analyze the signal using zelscope software.
    6) Save the analyzed signal on Zelscope display.
     7)Acquire the sound signal played by mobile phone using matlab programming language

Acquisition, sampling, plotting, saving and loading this analogue signal "data" is manipulated
using the following matlab code shown in the appendices of this book.


3.5. Design using physical devices

3.5.1. Designing methodology and process

The design was verified based on the principle of operation of some analog components along
with their association with other components or circuits. After designing and collecting all the
required components, the design was carried out using different electronic equipments available
in electronic laboratory such as:

            Signal generator




                             Figure 3.30: Photo of signal generator




                                              36
 Analog oscilloscope




Figure 3.31: Photo of analog oscilloscope

            PC




Figure 3.32: Photo of PC

In addition the interface between PC and signal generator was also designed and implemented.




                                             37
Figure 3.33: Photo of interface circuit

3.5.2. Design process

3.5.2.1 Interface circuit design
As stated previously, it has found that it is dangerous to connect the sound card to anything other
than standard audio equipment. Therefore, a voltage divider or a buffer amplifier is highly
recommended for preventing the damage hardware and/or data that can potentially occur.

A schematic of this interface is available bellow:




Figure 3.34: Interfacing circuit between PC sound card and signal generator

This circuit design contains input resistance, variable resistance and diodes for protection issues.
From our design, we have been limiting only for audible signal which can contain a restricted
rang of frequency: from 20Hz to 20 KHz.

For simple electronic circuits, it may be sufficient to get a qualitative insight on dedicated
electrical signals. This interface circuitry allows using the line-in input of a standard PC
soundcard to be used as a 2-channel oscilloscope. In our circuit design, we have been selecting
only channel1.This setup does not allow for exact measurements, however for some applications,
a qualitative insight on dedicated timing or signal characteristics may be obtained. The interface
limits the signals from input channel 1 and 2 to maximum amplitude of 1.2 V (over-voltage
protection circuitry). At the left side of the schematic above, the two input channels for signal

                                                38
measurement and the common ground are shown. At the right side, next to the protection diodes,
the connections for the 3.5 mm stereo jack to the soundcard (line-in) are drawn.

Note: The results and data obtained from this above design realized in laboratory have been
analyzed experimentally.

Block diagram of the design is illustrated below




   Signal                              Interface                                      Oscilloscope
   generator



Figure 3.35: Block diagram of the design using oscilloscope


                                                                                      PC


General description

The signal generator in this block diagram is there to generate signal frequency. This signal
frequency is fed to oscilloscope through interfacing circuit. This interface between signal
generator and oscilloscope does a job as a buffer for attenuating the amplitude of voltage in order
to protect PC sound card which can be damaged by electrical signal from signal generator at the
same time the signal is fed to PC. The PC screen displays signal frequency analyzed by Matlab
software. The output to PC screen is one which has to be compared to oscilloscope’s output
display.




Figure 3.36: Photo of experiment for complete system

3.5.2. Procedure of experiment
As above figure shows, this experiment was designed by generating the frequency of 200 Hz.
This signal passes through interface circuit to oscilloscope. The amplitude (voltage) of this signal
reaches on oscilloscope display will have the value of 0.5volts due to resistors implement
interface circuit as described in interface design. This voltage of 0.5V has to be fed to PC sound
                                                   39
card as data which is being to be acquired with matlab code in order to be analyzed by matlab
software. As maximum amplitude to PC sound card is 1.2 V, we only choose 0.5V as amplitude
which is less than that maximum voltage in order to avoid the damage of sound card. But also,
any amplitude less than 1.2V can be used.




                                             40
CHAPTER4. ANALYSIS OF RESULTS AND DISCUSSION
This chapter describes and discusses the results obtained during the experiment of this project.

4.1. Analysis of results

4.1.1. Results about Zelscope

1. Signal obtained on Zescope Display
This signal is obtained by connecting the two stereo connectors one for Mobile phone line out
and PC sound card line In,and tnen the signal is analysed on Zelscope Display accordingly.




Figure 4.37:Signal analyzed on Zelscope Display

2.Signal obtained by acquisition using Matlab Programming language
The two Stereo connectors are plugged into the two Audio In. One for mobile phone line out and
other for PC sound card line In.After plugging these stereo connectors ,they have to connected
together in other to pass signal from mobile phone to PC. The result obtained after acquisition of
signal (signal played by mobile) is described by the figures below:




                                                41
Acquired signal "data"
                           1

                         0.8

                         0.6

                         0.4
    Magnitude in volts




                         0.2

                           0

                         -0.2

                         -0.4

                         -0.6

                         -0.8
                                0   50   100   150     200    250    300      350   400   450   500
                                                        Frequency in Hz


Figure 4.38: Accquisition of signal “Data”




                                                                  42
Power Spectral Density of the data
                                    10



                                     0
    Power Spectrum Magnitude (dB)




                                    -10



                                    -20



                                    -30



                                    -40



                                    -50
                                          0   0.1   0.2    0.3    0.4       0.5   0.6   0.7    0.8   0.9   1
                                                                        Frequency


Figure 4.39: Power spectral density of data




                                                                               43
Filtered Signal "Data"
                           1

                          0.8

                          0.6

                          0.4
    Magnitude in Volts




                          0.2

                           0

                         -0.2

                         -0.4

                         -0.6

                         -0.8
                                0   50      100        150        200    250    300               350      400   450   500
                                                                   Frequency in Hz


Figure 4.40: Filtered signal “data”

4.1.2. Description of interface circuit

By well done of amplitude adjustment, the experiment shows some calculated amplitudes that
our design interface circuit is allowed to pass. These are the current values obtained when doing
experiment in the laboratory using signal generator, oscilloscope display and calculations. From
mathematical formula (apply of ohm’s law), the interface output current from these values of
input voltage and resistors on the circuit are given in the table by:

          Io=                       ...........................................................   (4.11)

Where Io : output current

                         Vi: input voltage from signal generator

                         Ri: input resistance

                         Rv: variable resistance




                                                                                   44
Interface I/P voltage     Input Resistance in Ω    Variable Resistance in Interface O/P current
                                                   Ω
(amplitude) in mV                                                         (amplitude) in mA

20                        10000                    5000                   0.00133

50                        10000                    5000                   0.00333

100                       10000                    5000                   0.00667

200                       10000                    5000                   0.0133

500                       10000                    5000                   0.0333

1000                      10000                    5000                   0.0667



Table.1: Results for interface circuit.



4.1.3. Result of experiment about acquisition of signal

The input signal to be acquired must have the characteristics shown by the table 4.1 above. This
signal is a square as shown on oscilloscope display.

 1. Acquisition of signal

 Stereo is plugged into computer’s Audio In through sound card.


         a) Acquired signal “data”:unfiltered signal




                                                  45
Acquired signal "data"
                         1.2


                           1


                         0.8
    Magnitude in volts




                         0.6


                         0.4


                         0.2


                           0


                         -0.2
                                0   50   100   150     200    250    300      350   400   450   500
                                                        Frequency in Hz


Figure 4.41: Acquired signal “data”

                          b) Power spectral density:




                                                                  46
Power Spectral Density of the data
                                20


                                10
Power Spectrum Magnitude (dB)




                                 0


                                -10


                                -20


                                -30


                                -40


                                -50
                                      0       0.1   0.2     0.3    0.4       0.5   0.6   0.7    0.8   0.9   1
                                                                         Frequency


                                          Figure4. 42: Power spectral density of unfiltered signal “data”

                                 c) Filtered signal “data”:




                                                                                47
Filtered Signal"Data"
                        1.2


                          1


                        0.8
    Magnitude in Volt




                        0.6


                        0.4


                        0.2


                          0


                        -0.2
                               0   50   100   150    200    250    300      350   400   450   500
                                                      Frequency in Hz


Figure 4.43: Filtered signal “data”of figure 4.41

4.2. Discussion

4.2.1. Discussion about the use of Zelscope

In this part of experiment, the signal obtained from Zelscope display and that obtained using
matlab programming language are similar but not completely similar. The similarities come from
in sense that the original signal (song) used is the same for both cases. Dissimilarities found are
due to the fact that during acquiring of the signal using Matlab and analyzing with Zelscope
display, the song is not played simultaneously and yet the frequency is not for whole song (it is
harmonized).

4.2.2. Discussion about oscilloscope

4.2.2.1. Acquisition of signal
As shown by the fig4.41, this displayed signal is obtaining by generating a square wave of 0.5V
and a frequency of 200 Hz on oscilloscope display from signal generator. Thus, using matlab
software the distorted signal has been occurred .This distorted signal is due to the junction of
interface circuit with oscilloscope probes and the junction of interface circuit, oscilloscope
probes with the stereo connectors to the PC sound card line In, which generate the losses. In
addition, signal generator and PC sharing the same source of power supply may also cause the

                                                                 48
distortions on generated signal. Therefore that’s why the work of filtering is needed. Even the
filtering process has being done; the filtered signal is not exactly the same as that has displayed
on oscilloscope because of the problems mentioned early. But the similarity like 98% is obtained
as shown by fig. 4.43.

Notice: Although the experiments were well done, some measured values were not the same as
the intended values due to the challenges mentioned above.




                                                49
CHAPTER5. CONCLUSION AND RECOMMENDATIONS

5.1. Conclusion
To achieve and verify the hypothesis of design a computer based system to process an analog
signal, interfacing circuit between PC sound card and signal generator, different circuit sections
have been designed and their operating conditions have set out. This is illustrated by the
designed circuit with different sections. Zelscope software used as oscilloscope to display signal
from mobile phone. A signal generator plays role of setting a fixed frequency, voltage
(amplitude) required for the whole sound card by using interface circuit and oscilloscope for
displaying a signal. In this implementation 0.5v was used as input to the sound card jack.
According to the generated signal using signal generator, it has been found that the output
frequency and amplitude of generated signal increase or decrease by adjusting manually a
variable resistance in order to control the sound card input voltage (amplitude) .The 16KΩ input
resistor, 50KΩ variable resistor and 1N914 diodes also have been designed for protection issues
of the PC sound card to allow a small amplitude from signal generator to be used on PC sound
card Matlab software have played important role for data acquisition and filtering . For filtering
effect, the design of Digital filter have done using fdatool but noise in the signal did not
completely eliminated due to the unfixed frequency of original signal from harmonics of songs.

5.2. Recommendations
This project concerning the “DESIGN OF COMPUTER BASED SYSTEM TO PROCESS
ANALOG SIGNALS” is a low level method of interfacing exactly a signal generated from
signal generator and display it on oscilloscope, then analyze it on PC by using matlab
programming language. Therefore, it is recommended to those who need to improve this project,
to work on High level application with interface. We therefore recommend KIST to tell the
students to be efficiently and qualitatively familiarized to use software programming such as
Matlab programming language during preparing their final year projects. KIST is also
recommended to help final year students by allowing them to have access to computer,
electronics and electrical equipments. It is also recommended to improve the practical skills for
students especially in engineering faculty by modifying the program Curriculum and by adding
more laboratory courses as requested in the general extra academic life. Some important
implemented projects are being realized by the students during their final year projects, but after
that no follow up about them. Therefore, KIST is recommended to install a workshop rooms for
final year projects storage. This will help people who need to use or to improve them. In addition
as today’s world systems are digitalized, KIST as High institute of Technology is recommended



                                                50
to encourage students to do the final year project based on digitalization and implementations
using software programs.




                                             51
REFERENCES:

   1. Practical Digital Electronics by Nigal P. Cook,2004
   2. Digital Signal Processing . A Practical Approach . 2nd Ed. by Emmanuel C.
       Ifeachor & Barrie W. Jervis,2002
   3. Introduction to computers by Peter Norton’s 4th Ed.,2001
   4. Jason Starck (June 2000): HTML document formatting, which led to a much
       better-looking second edition
   5. Computer by Larry Long and Nancy Long in their 8th Ed.,1996
   6. James D. Broesch, Dag Stranneby and William Walker. Digital Signal Processing:
       Instant access. Butterworth-Heinemann. p. 3. )
   7. http: //www.Prenhall.com/long, www. Prenhall.com/demo)
   8. http: //www.allaboutcircuits.com/vol_1/chpt_9/1.html(on Monday 12 July 2010)
   9. http://www.hobbyprojects.com/oscilloscope_tutorial/oscilloscope_working.html(11
       June2010)
   10. books.google.com/books(Apr.2010)
   11. Wikipedia,free-encyclopedia:www.scienceprog.com/digital-signal-
       processing(k.kumaresan: October 3rd, 2009 at 4:28 pm).
   12. http://www.howstuffworks.com/sound-card.htm;
       http://computer.howstuffworks.com/sound-card.htm(Copyright© 1998-
       2010 HowStuffWorks, Inc)
   13. http://en.kioskea.net/contents/pc/carte-son.php3(24Apr.2009), en.kioskea.net/.../affich-
       209761-how-do-i-bypass-my-sound-jack (29 Nov 2009)
   14. http://www.zelscope.com Copyright © 2001-2006 K.Zeldovich, N.Shusharina
   15. http://www.cygres.com/OcnPageE/Glosry/Spec.html;
       http://www.cbi.dongnocchi.it/glossary/PowerSpectralDensity.html
   16. Matlab tutorial version 7.0




                                            52
APPENDICES




  53
Appendix1

MATHLAB CODE USED TO ACQUIRE, SAMPLE, PLOT, SAVE AND LOAD
ANALOGUE SIGNAL "DATA"

%CREATION OF THE OBJECT

clear   all;
close   all;
clc;
ai =    analoginput('winsound');%Create the analog input object AI
for a   soundcard

%ADDITION OF CHANNELS

Chan = addchannel(ai,1);%Add two hardware channels to ai

%CONFIGURATION OF PROPERTY VALUES

Duration = 5;%5 seconds acquisition

set(ai,'SampleRate',8000);%Specify the per-channel rate at which
analog data is converted to digital data

ActualRate = get(ai,'SampleRate');% define the device        sample
rate. This might be different from the specified value

set(ai, 'SamplesPerTrigger', duration*ActualRate);%Specify the
number of samples to acquire for each channel group member for
each trigger that occurs.
set(ai,'TriggerType','manual');%set the manual trigger function.
The trigger will occur immediatly after the trigger function is
manually issued
blocksize=get(ai,'SamplesPerTrigger');

Fs=ActualRate;% define the sampling frequency

%DATA ACQUISITION

start(ai);
trigger(ai);% apply a manual trigger
wait (ai, duration+1);%pause MATLAB until either    the acquisition
completes or the timeout elapses
%Adding 1 second to the duration allows some        margin for the
timeout
[data,time] = getdata(ai);% Extract all data from   the engine
size(data(1:500));%returns the number of rows       and columns   in
data as separate output variables with data scale   of 1:500


                                 54
Design of a computer based system to process an analog signal

More Related Content

Similar to Design of a computer based system to process an analog signal

Li-Fi Audio Transmission Project Documentation/Report
Li-Fi Audio Transmission Project Documentation/ReportLi-Fi Audio Transmission Project Documentation/Report
Li-Fi Audio Transmission Project Documentation/ReportTSriyaSharma
 
Real time conversion of sign language to text and speech
Real time conversion of sign language to text and speech Real time conversion of sign language to text and speech
Real time conversion of sign language to text and speech HarshKSatheesh
 
Augmented Reality SEMINAR REPORT Submitted By BIKKAVOLUANANTHABHAVANI SAI KRI...
Augmented Reality SEMINAR REPORT Submitted By BIKKAVOLUANANTHABHAVANI SAI KRI...Augmented Reality SEMINAR REPORT Submitted By BIKKAVOLUANANTHABHAVANI SAI KRI...
Augmented Reality SEMINAR REPORT Submitted By BIKKAVOLUANANTHABHAVANI SAI KRI...Cassie Romero
 
ELECTRONIC MANAGEMENT SYSTEM BASED ON RFID AND USSD
ELECTRONIC MANAGEMENT SYSTEM BASED ON RFID AND USSDELECTRONIC MANAGEMENT SYSTEM BASED ON RFID AND USSD
ELECTRONIC MANAGEMENT SYSTEM BASED ON RFID AND USSDMartin Wachiye Wafula
 
GSM BASED DEVICES CONTROL SYSTEM PROJECT REPORT
GSM BASED DEVICES CONTROL SYSTEM PROJECT REPORTGSM BASED DEVICES CONTROL SYSTEM PROJECT REPORT
GSM BASED DEVICES CONTROL SYSTEM PROJECT REPORTAvinash Kannojia
 
AC fan speed control using remote control power electronics term project report
 AC fan speed control using remote control power electronics term project report AC fan speed control using remote control power electronics term project report
AC fan speed control using remote control power electronics term project reportKramat ullah
 
The development of neural network based vision for an autonomous vehicle
The development of neural network based vision for an autonomous vehicleThe development of neural network based vision for an autonomous vehicle
The development of neural network based vision for an autonomous vehicleOtitoaleke Akinola
 
FINAL PROJECT REPORT
FINAL PROJECT REPORTFINAL PROJECT REPORT
FINAL PROJECT REPORTSoham Wadekar
 
RAMKESH MEENA TRAINING REPORT IHT.pdf
RAMKESH MEENA TRAINING REPORT IHT.pdfRAMKESH MEENA TRAINING REPORT IHT.pdf
RAMKESH MEENA TRAINING REPORT IHT.pdfYaarJani
 
Bidirectional Visitor Counter for efficient electricity usage.
Bidirectional Visitor Counter for efficient electricity usage.Bidirectional Visitor Counter for efficient electricity usage.
Bidirectional Visitor Counter for efficient electricity usage.NandaVardhanThupalli
 
"Black Box for a Car" report
"Black Box for a Car" report"Black Box for a Car" report
"Black Box for a Car" reportsubrat manna
 

Similar to Design of a computer based system to process an analog signal (20)

Sri
SriSri
Sri
 
Li-Fi Audio Transmission Project Documentation/Report
Li-Fi Audio Transmission Project Documentation/ReportLi-Fi Audio Transmission Project Documentation/Report
Li-Fi Audio Transmission Project Documentation/Report
 
Real time conversion of sign language to text and speech
Real time conversion of sign language to text and speech Real time conversion of sign language to text and speech
Real time conversion of sign language to text and speech
 
Augmented Reality SEMINAR REPORT Submitted By BIKKAVOLUANANTHABHAVANI SAI KRI...
Augmented Reality SEMINAR REPORT Submitted By BIKKAVOLUANANTHABHAVANI SAI KRI...Augmented Reality SEMINAR REPORT Submitted By BIKKAVOLUANANTHABHAVANI SAI KRI...
Augmented Reality SEMINAR REPORT Submitted By BIKKAVOLUANANTHABHAVANI SAI KRI...
 
ELECTRONIC MANAGEMENT SYSTEM BASED ON RFID AND USSD
ELECTRONIC MANAGEMENT SYSTEM BASED ON RFID AND USSDELECTRONIC MANAGEMENT SYSTEM BASED ON RFID AND USSD
ELECTRONIC MANAGEMENT SYSTEM BASED ON RFID AND USSD
 
Btech Thesis
Btech ThesisBtech Thesis
Btech Thesis
 
Stay away from me
Stay away from meStay away from me
Stay away from me
 
PROJECT REPORT(1)
PROJECT REPORT(1)PROJECT REPORT(1)
PROJECT REPORT(1)
 
GSM BASED DEVICES CONTROL SYSTEM PROJECT REPORT
GSM BASED DEVICES CONTROL SYSTEM PROJECT REPORTGSM BASED DEVICES CONTROL SYSTEM PROJECT REPORT
GSM BASED DEVICES CONTROL SYSTEM PROJECT REPORT
 
Final Report Content
Final Report ContentFinal Report Content
Final Report Content
 
AC fan speed control using remote control power electronics term project report
 AC fan speed control using remote control power electronics term project report AC fan speed control using remote control power electronics term project report
AC fan speed control using remote control power electronics term project report
 
Avinash thesis final
Avinash thesis finalAvinash thesis final
Avinash thesis final
 
Ibiang project
Ibiang projectIbiang project
Ibiang project
 
The development of neural network based vision for an autonomous vehicle
The development of neural network based vision for an autonomous vehicleThe development of neural network based vision for an autonomous vehicle
The development of neural network based vision for an autonomous vehicle
 
FINAL PROJECT REPORT
FINAL PROJECT REPORTFINAL PROJECT REPORT
FINAL PROJECT REPORT
 
RAMKESH MEENA TRAINING REPORT IHT.pdf
RAMKESH MEENA TRAINING REPORT IHT.pdfRAMKESH MEENA TRAINING REPORT IHT.pdf
RAMKESH MEENA TRAINING REPORT IHT.pdf
 
Loken
LokenLoken
Loken
 
Bidirectional Visitor Counter for efficient electricity usage.
Bidirectional Visitor Counter for efficient electricity usage.Bidirectional Visitor Counter for efficient electricity usage.
Bidirectional Visitor Counter for efficient electricity usage.
 
report
reportreport
report
 
"Black Box for a Car" report
"Black Box for a Car" report"Black Box for a Car" report
"Black Box for a Car" report
 

Design of a computer based system to process an analog signal

  • 1. KIGALI INSTITUTE OF SCIENCE AND TECHNOLOGY (KIST) Avenue de l’armée PO BOX 3900 Kigali – Rwanda www.kist.ac.rw FACULTY OF ENGINEERING DEPARTMENT OF ELECTRICAL AND ELECTRONICS PROGRAM OF ELECTRONICS AND TELECOMMUNICATION PROJECT REPORT ON DESIGN OF A COMPUTER-BASED SYSTEM TO PROCESS AN ANALOG SIGNAL Submitted by: GASHEMA Gaspard (GS 20060092) IYAKAREMYE Dieudonné(GS 20060189) Under guidance of: Supervisor: TWIRINGIYIMANA Remy Submitted in partial fulfillment of the requirements for the award of BACHELOR OF SCIENCE DEGREE IN ELECTRICAL AND ELECTRONICS ENGINEERING (EEE) September, 2010 i
  • 2. CERTIFICATION This is to certify that the work presented in this report entitled: “DESIGN OF COMPUTER BASED SYSTEM TO PROCESS AN ANALOG SIGNAL ” is an original work of GASHEMA Gaspard and IYAKAREMYE Dieudonné and it has not been submitted to any ; university or elsewhere in any form for the award of any degree. Supervisor Head Of Department of Electrical and Electronic Engineering: TWIRINGIYIMANA Remy ZIMULINDA François Signature: ……………………… Signature:………………………………………… Date…:………………………… Date …..…………………………………….. ii
  • 3. DECLARATION We, GASHEMA Gaspard and IYAKAREMYE Dieudonné hereby declare that, the work , presented in this report is our own contribution. To the best of our knowledge, this same work has never been presented or submitted to any other Universities or institutions of higher learning for the award of any degree. We therefore declare that, this work is our own contribution for the partial fulfillment of the award of the degree of Electronics and Telecommunication Engineering in KIST. GASHEMA Gaspard IYAKAREMYE Dieudonné REG No.: GS20060092 REG No.: GS20060189 Signature: ……………… Signature: ……………… Date: …………………… Date: …………………… This report has been submitted for examination with the approval of the following supervisor: TWIRINGIYIMANA Remy Department of Electrical and Electronics Engineering, KIST Signature: ……………………………………….. Date: …………………………………………….. iii
  • 4. DEDICATION This project is dedicated: To the Almighty God To our families To our friends iv
  • 5. ACKNOWLEDGEMENT We are thankful to the Almighty God for the given gift of life and guidance, especially during this project. Also we are grateful for members of our families and relatives. Our thanks go to KIST and SFAR for their financial contribution for carrying out our studies. We sincerely thank Mr. TWIRINGIYIMANA Remy, for his kind guidance and for his provision of necessary facilities to carry out this project work. Thanks to several former lecturers and classmates who broadened our knowledge and technical skills to fulfill the requirement to this project. We wish to extend our deep sense of gratitude to our beloved parents for their encouragement throughout our studies. God bless you all. v
  • 6. ABSTRACT This project has the aim of designing a system that can make decision electronically thereby speeding up the operations made and improving electronic system by using digital system. The work to be done was concentrated on acquiring analog signal and processing of this acquired signal using a personal computer. Digital filters were designed using Matlab programming to process the acquired signals. This was achieved through the use of electronic equipments such as signal generator, oscilloscope, computer and interfacing circuit. In fact, the main task to be carried out in this project is to design a computer-based system to acquire and process an analog signal generated by front end devices such as function generator. There were two ways to realize the practice of this project. The first one consisted the use of zelscope software as oscilloscope which analyzes signal originates from mobile phone. The mobile phone was used to play music (audio signal) in order to be analyzed by zelscope on PC screen. On other hand, this audio signal from mobile phone were acquired and analyzed with matlab programming Language. Finally, the analyzed signal by matlab had to be compared with that obtained when using zelscope. The second one concerned with acquiring real time signal generated from function generator and compare the processed signal on PC with the signal displayed on oscilloscope. This work was carried out in KIST laboratory building (KIST4) in electronics lab (Second Floor- room 33) vi
  • 7. TABLE OF CONTENTS CERTIFICATION ............................................................................................................................................... i DECLARATION .............................................................................................................................................. iii DEDICATION ................................................................................................................................................. iv ACKNOWLEDGEMENT ................................................................................................................................... v ABSTRACT..................................................................................................................................................... vi TABLE OF CONTENTS................................................................................................................................... vii LIST OF FIGURES AND TABLES ...................................................................................................................... ix LIST OF TABLES .............................................................................................................................................. x LIST OF ABBREVIATIONS AND SYMBOLES .................................................................................................... xi CHAPTER 1: INTRODUCTION ......................................................................................................................... 1 1.1. General introduction.......................................................................................................................... 1 1.2. Structure of project report .................................................................................................................. 1 1. 3. Statement of the problem .................................................................................................................. 1 1.4. Significance and justification ............................................................................................................. 1 1.5. Objectives .......................................................................................................................................... 2 1.5.1. Main objective ............................................................................................................................ 2 1.5.2. Specific objectives ....................................................................................................................... 2 1.6. Scope and limitation of the project .................................................................................................... 2 vii
  • 8. 1.7. Methodology ...................................................................................................................................... 2 CHAPTER 2: LITERATURE REVIEW ................................................................................................................. 4 2.1. Electrical instrumentation signals ...................................................................................................... 4 2.1.1. Analog and digital signals ............................................................................................................ 4 2.1.2 Basic analog signal measurements .............................................................................................. 4 2.2.1. DSP applications ....................................................................................................................... 11 2.2.2. The Basic DSP Operations ......................................................................................................... 15 2.3. Data Acquisition Toolbox ................................................................................................................ 15 2.3.1. Basic Steps for Acquiring Data .................................................................................................. 15 2.3.2. Acquiring Data with a Sound Card ............................................................................................ 15 2.4. Computer sound cards...................................................................................................................... 19 2.4.1. Introduction to computer sound cards ..................................................................................... 19 2.4.2. Analog versus Digital object related to sound card .................................................................. 20 2.4.3. Conditions required to interface any signal to computer sound card ...................................... 22 2.4.4. Chip Chat Sound Card Technical Specifications ........................................................................ 22 CHAPTER 3: SYSTEM DESIGN ...................................................................................................................... 25 3.1. Example of analyzing data by matlab .............................................................................................. 25 3.1.1. Signal analysis ........................................................................................................................... 25 3.2. Data Acquisition with MATLAB Programming ............................................................................. 27 3.3. Digital Filter Design ........................................................................................................................ 29 3.3.1. FIR digital filter .......................................................................................................................... 31 3.3.2. Band Pass filter Design Specifications....................................................................................... 32 3.3.3.Low pass filter Design Specifications ......................................................................................... 33 3.4. The design using zelscope ............................................................................................................... 34 3.5. Design using physical devices ......................................................................................................... 36 3.5.1. Designing methodology and process ........................................................................................ 36 3.5.2. Procedure of experiment .......................................................................................................... 39 CHAPTER4. ANALYSIS OF RESULTS AND DISCUSSION ................................................................................. 41 4.1. Analysis of results ............................................................................................................................ 41 4.1.1. Results about Zelscope ............................................................................................................. 41 4.1.2. Description of interface circuit ................................................................................................. 44 4.2. Discussion ........................................................................................................................................ 48 4.2.1. Discussion about the use of Zelscope ....................................................................................... 48 viii
  • 9. 4.2.2. Discussion about oscilloscope................................................................................................... 48 CHAPTER5. CONCLUSION AND RECOMMENDATIONS................................................................................ 50 5.1. Conclusion ....................................................................................................................................... 50 5.2. Recommendations ............................................................................................................................ 50 REFERENCES: ............................................................................................................................................... 52 APPENDICES ................................................................................................................................................ 53 LIST OF FIGURES AND TABLES Figure2. 1: Analog Oscilloscope Block Diagram[9] ...................................................................................... 5 Figure2. 2: Triggering Stabilizes a Repeating Waveform[9] ......................................................................... 6 Figure 2.3: Digital Oscilloscope Block Diagram[9] ....................................................................................... 7 Figure 2.4: Real Time Sampling Diagram [9] ................................................................................................ 8 Figure 2.5: Linear and Sine Interpolation Diagram [9] .................................................................................. 8 Figure 2.6: Equivalent-time Sampling Diagram[9] ........................................................................................ 9 Figure2. 7: Zelscope with two analyzing signal [14] .................................................................................... 9 Figure 2.8: Normal mode, with both channels displayed[14] ....................................................................... 10 Figure 2.9: Broadcasting via satellite[11] ..................................................................................................... 12 Figure 2.10: Dish antenna used for helping in navigation [11]. .................................................................... 13 Figure 2.11: Processing of audio signal [11] ................................................................................................. 14 Figure 2.12: Acquisition of data with sound card[16] ................................................................................... 16 Figure 2.13: Frequency component of Tuning Fork[16] .............................................................................. 18 Figure 2.14: Computer sound card [13] ......................................................................................................... 19 Figure 2.15: Analog signal to be sampled by soundcard[12] ........................................................................ 20 Figure 2.16: An analog-to-digital converter measures sound waves at frequent intervals [12]. ................... 21 Figure 2.17: A PCI sound card[12] ............................................................................................................... 22 Figure 2.18: mono connector[13] .................................................................................................................. 23 Figure2. 19: Stereo connector[13] ................................................................................................................. 24 Figure 2.20: Jack[13]..................................................................................................................................... 24 Figure 3.21: Signal analyzed by matlab....................................................................................................... 26 Figure 3.22: Power Spectral density of data ............................................................................................... 27 ix
  • 10. Figure 3.23: Data Acquired using Matlab acquisition program .................................................................. 28 Figure 3.24: Power spectrum density of data acquired using Matlab acquisition program ........................ 29 Figure 2.25: A conceptual Representation of digital filter .......................................................................... 31 Figure 3.26: Band-pass filter design ........................................................................................................... 32 Figure 3.27: Low pass filter design............................................................................................................. 33 Figure 3.28: Filtrered Data Acquired using Matlab programming ............................................................. 34 Figure 3.29: Block diagram showing the design using Zelscope................................................................ 35 Figure 3.30: Photo of signal generator ........................................................................................................ 36 Figure 3.31: Photo of analog oscilloscope .................................................................................................. 37 Figure 3.32: Photo of PC ........................................................................................................................... 37 Figure 3.33: Photo of interface circuit ........................................................................................................ 38 Figure 3.34: Interfacing circuit between PC sound card and signal generator ........................................... 38 Figure 3.35: Block diagram of the design using oscilloscope .................................................................... 39 Figure 3.36: Photo of experiment for complete system .............................................................................. 39 Figure 4.37:Signal analyzed on Zelscope Display ...................................................................................... 41 Figure 4.38: Accquisition of signal “Data” ................................................................................................. 42 Figure 4.39: Power spectral density of data ................................................................................................ 43 Figure 4.40: Filtered signal “data” .............................................................................................................. 44 Figure 4.41: Acquired signal “data” .......................................................................................................... 46 Figure4. 42: Power spectral density of unfiltered signal “data” ................................................................. 47 Figure 4.43: Filtered signal “data”of figure 4.41 ........................................................................................ 48 LIST OF TABLES Table.1: Results for interface circuit. .......................................................................................................... 45 x
  • 11. LIST OF ABBREVIATIONS AND SYMBOLES : Ohm DAC: Digital to Analog Converter A: Ampere DC: Direct Current AC: Alternative Current DSP: Digital Signal Processing ADC: Analog to Digital Converter EEE: Electrical and Electronics engineering ADPCM: Adaptive Differential Pulse Code ETE: Electronics and Telecommunication Modulation Engineering AI: Analog Input FFT: Fast Fourier Transform Apass: Attenuation pass band Fig:Figure Astop: attenuation stop band FIR: Finite Impulse Response BPF: Bass Pass Filter Fpass: Pass band Frequency CD: Compact Disc FS: Sampling Frequency CH: Channel Fstop: Stop band Frequency CODEC: Coder/Decoder GS: Government Sponsor CRT: Cathode Ray Tube Hz: Hertz xi
  • 12. I/P: input IBM: International Business Machines IEEE: Institute of Electrical and Electronic Engineers IIF: Infinite Impulse response ISA: Industry Standard Architecture K: Kilo (103) KIST: Kigali Institute of Science and Technology m: meter m: milli (10-3) O/P: Output PC: Personal Computer PCI: Peripheral Component Interconnect RADAR: Radio Detection And Ranging RMS: Root Mean Square SFAR: Student Financing Agency for Rwanda SONAR: Sound Navigation And Ranging V: Volt 12
  • 13. CHAPTER 1: INTRODUCTION 1.1. General introduction An oscilloscope is one of the equipments needed to perform this research. Therefore, an understanding of its working principle is required. To better understand the oscilloscope controls, one need to know a little more about how oscilloscopes display a signal .Although there are two types of oscilloscopes: analog and digital, in this work only the analog will be used. Analog oscilloscopes work somewhat differently than digital oscilloscopes. However, several of the internal systems are similar. Analog oscilloscopes are somewhat simpler in concept and are described first, followed by a description of digital oscilloscopes. The working principle of these two types of oscilloscope and the difference between them will be shown clearly in the following chapters. Computers are used at the heat of almost every electronic system due to the fact that their ability to quickly process and store large amount of data makes system more versatile and perform many functions. The filters used here are digital because computers understand only digital data. The design of these digital filters was done using Matlab software. 1.2. Structure of project report This project report contains five chapters. The first chapter is introduction which discusses about overview and motivation of this work .The second chapter is literature review which provides details about what others have done concerning this research and set a benchmark for the current as well as justifying the specific solution techniques. The third chapter deals with the system design. The fourth chapter discusses the obtained result. Finally, the fifth chapter is all about the conclusion and recommendations giving summary of the main findings statement of the encountered problem as well as limitations. 1. 3. Statement of the problem It has been observed that all over the world today’s electronics equipments are all almost of digital in nature. Before the development of the digital equipments, the use of early devices in some applications did not give the accurate output especially in Telecommunication due to many factors including easy attraction of random disturbances or variations introduced in system leading to the delay and losses for the signal. This problem will be recovered by the use of digital equipments associated by some software. But nowadays; the arrival of digital equipments makes the system very suitable and fast. Even due to the flexibility, digital system will lead the low cost equipments. Due to these advantages of digital system, today and future’s life will become digitalized. 1.4. Significance and justification The work to be done helps in understanding and practices the concept of Digital Signal Processing (DSP) techniques. These achieved by using computer to learn data acquisition 1
  • 14. applications and Matlab software for designing Digital Filters which will be used to denoise the acquired signal . Digital filtering is exceptionally flexible and can easily incorporate non-lineal operations such as clipping or removal of data samples that appear to the incompatible with neighboring samples, and therefore erroneous indicate the source. Moreover, it is much easier to determine the response of a digital system than analog system. This is because the digital system can be described by its difference equation and this is directly amenable to a solution using computer. 1.5. Objectives 1.5.1. Main objective  Designing a computer-based system to process an analog signal generated from front ended devices such as function generator. 1.5.2. Specific objectives  Understanding how to install and use Zelscope application software.  Acquiring analog signals using MATLAB Data acquisition toolbox.  Designing digital filters using MATLAB Program.  Denoising the acquired signals using digital filter.  Displaying the processed signals on PC and appreciating the comparison with the signal displayed on oscilloscope. 1.6. Scope and limitation of the project This study is about the design of a computer based system to process an analog signal. The study is concentrated only the analysis of signals generated from end devices such as signal generator and mobile phone with the frequencies which are audible (i.e. frequencies of the ranges from 20Hz to 20 kHz). The filters used to denoise the acquired signal are FIR low and band-pass filter with equiripple methods. 1.7. Methodology The methodologies used to achieve the objectives of this work are books bellowed in different Libraries including KIST Library and internet documentations. Besides experiment, using programming languages such as MATLAB carried out in KIST laboratory building (KIST4) in electronics lab (Second Floor- room 33). Equipments: The following are electronic equipments that were used:  Signal generator.  Analog oscilloscope.  Personal Computer. 2
  • 15.  Mobile phone  Buffer circuit used as front end interfacing device(for signal generator). 3
  • 16. CHAPTER 2: LITERATURE REVIEW In order to get a clear understanding on the work to be done, it is necessary to make a review on what was done by other researchers on the same field. This includes a review on some applications, programs; components used to this research. The review of them is described below. 2.1. Electrical instrumentation signals 2.1.1. Analog and digital signals 2.1.1.1. Definitions A signal is any kind of physical quantity that conveys information. Audible speech is certainly a kind of signal, as it conveys the thoughts (information) of one person to another through the physical medium of sound. Hand gestures are signals, too, conveying information by means of light. 2.1.1.2. Types of signal There are two kind of signal: analog and digital signal. The difference between these signals is described below. An analog signal is a kind of signal that is continuously variable whereas a digital signal is one having discrete set of values [9]. A well-known example of analog versus digital is that of clocks: analog being the type with pointers that slowly rotate around a circular scale, and digital being the type with decimal number displays or a "second-hand" that jerks rather than smoothly rotates. The analog clock has no physical limit to how finely it can display the time, as its "hands" move in a smooth, pauseless fashion. The digital clock, on the other hand, cannot convey any unit of time smaller than what its display will allow for [9]. 2.1.2 Basic analog signal measurements To measure analog signal, it is better to know the instrumentation and instrument. Instrumentation is a field of study and work centering on and control of physical processes. These physical processes include pressure, temperature, flow rate, and chemical consistency. An instrument is a device that measures and/or acts to control any kind of physical process. Due to the fact that electrical quantities of voltage and current are easy to measure, manipulate, and transmit over long distances, they are widely used to represent such physical variables and transmit the information to remote locations [4][9].The most widely used instrument to measure such electrical quantity is oscilloscope as it being described its working principle below in fig.2.1. 4
  • 17. 2.1.2.1. Oscilloscope. How does an oscilloscope work? To better understand the oscilloscope controls, you need to know a little more about how oscilloscopes display a signal. Analog oscilloscopes work somewhat differently than digital oscilloscopes. However, several of the internal systems are similar. Analog oscilloscopes are somewhat simpler in concept and are described first, followed by a description of digital oscilloscopes. 2.1.2.1.1. Analog Oscilloscopes When you connect an oscilloscope probe to a circuit, the voltage signal travels through the probe to the vertical system of the oscilloscope. Following Figure is a simple block diagram that shows how an analog oscilloscope displays a measured signal. Figure2. 1: Analog Oscilloscope Block Diagram[9] Depending on how you set the vertical scale (volts/div control), an attenuator reduces the signal voltage or an amplifier increases the signal voltage. Next, the signal travels directly to the vertical deflection plates of the cathode ray tube (CRT). Voltage applied to these deflection plates causes a glowing dot to move. (An electron beam hitting phosphor inside the CRT creates the glowing dot). A positive voltage causes the dot to move up while a negative voltage causes the dot to move down. The signal also travels to the trigger system to start or trigger a "horizontal sweep." Horizontal sweep is a term referring to the action of the horizontal system causing the glowing dot to move across the screen. Triggering the horizontal system causes the horizontal time base to move the glowing dot across the screen from left to right within a specific time interval. Many sweeps in rapid sequence cause the movement of the glowing dot to blend into a solid line. At higher speeds, the dot may sweep across the screen up to 500,000 times each second. Together, the horizontal sweeping action and the vertical deflection action trace a graph of the signal on the screen. The trigger is necessary to stabilize a repeating signal. It ensures that the 5
  • 18. sweep begins at the same point of a repeating signal, resulting in a clear picture as shown in following figure [9]. Figure2. 2: Triggering Stabilizes a Repeating Waveform[9] In conclusion, to use an analog oscilloscope, you need to adjust three basic settings to accommodate an incoming signal:  The attenuation or amplification of the signal. Use the volts/div control to adjust the amplitude of the signal before it is applied to the vertical deflection plates.  The time base. Use the sec/div control to set the amount of time per division represented horizontally across the screen.  The triggering of the oscilloscope. Use the trigger level to stabilize a repeating signal, as well as triggering on a single event. Also, adjusting the focus and intensity controls enables you to create a sharp, visible display. 2.1.2.1.2. Digital Oscilloscopes Based on [9], 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 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. 6
  • 19. Pretrigger may be available, allowing you to see events before the trigger point as shown in fig.2.3. Figure 2.3: Digital Oscilloscope Block Diagram[9] Fundamentally, with a digital oscilloscope as with an analog oscilloscope, you need to adjust the vertical, horizontal, and trigger settings to take a measurement. 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 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). i. Real-Time Sampling with Interpolation 7
  • 20. 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 following figure for single-shot or transient signals you must use real time sampling [9]. Figure 2.4: Real Time Sampling Diagram [9] Digital oscilloscopes use interpolation to display signals that are so fast that the oscilloscope can only collect a few sample points. Interpolation "connects the dots." Linear interpolation simply connects sample points with straight lines. Sine interpolation (or sin x over x interpolation) connects sample points with curves. (See Following Figure2.5) Sin x over x interpolation is a mathematical process similar to the "oversampling" used in compact disc players. With sine interpolation, points are calculated to fill in the time between the real samples. Using this process, a signal that is sampled only a few times in each cycle can be accurately displayed or, in the case of the compact disc player, accurately played back. Figure 2.5: Linear and Sine Interpolation Diagram [9] 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 Following Figure2.6) 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 [9]. 8
  • 21. Figure 2.6: Equivalent-time Sampling Diagram[9] 2.1.2.2. Zelscope review 2.1.2.2.1 What is Zelscope? Zelscope is Windows software that converts PC into a dual-trace storage oscilloscope and spectrum analyzer. It uses computer's sound card as analog-to-digital converter, presenting a real-time waveform or spectrum of the signal - which can be music, speech, or output from an electronic circuit. Zelscope features the interface of a traditional oscilloscope, with conventional gain, offset, time base, and trigger controls. As a real-time spectrum analyzer, Zelscope can display the amplitude and phase components of the spectrum. Figure2. 7: Zelscope with two analyzing signal [14] 9
  • 22. Figure 2.8: Normal mode, with both channels displayed[14] 2.1.2.2.2. What can Zelscope use for? Zelscope is low-frequency oscilloscope and spectrum analyzer software. It can be useful in tuning music instruments, adjusting audio circuits, or doing physics experiments. Acoustics is the most evident area; Zelscope also allows for an easy measurement of short time intervals in mechanics experiments.Zelscope has proven useful in debugging music and sound processing software [14]. Note: All known sound cards contain a capacitor which provides AC coupling and prevents DC from reaching the card's analog to digital converter. Low-frequency oscillations (below 15- 20Hz) usually get through, but may be distorted. According to Nigel P. Cook, Digital Signal Processor (DSP) is concerned with the digital representation of signals and the use of signal processors to analyze, modify, or extract information from signals. Similarly, From Wikipedia, the free encyclopedia, DSP is concerned with the representation of signal by a sequence of numbers or symbols and the processing of these signals. In addition, we conclude that: Digital signal processing is the technique used to analyze various digital signals and obtain information from the same. It is also used for transfer of information from one place to another and also involves conversion in between analogue and digital signals. Although, DSP represents signal digitally, the signal used in most popular form of DSP is delivered from analog signals which have been sampled at rectangular intervals and converted into digital form. The specific reason for processing a digital signal may be, for example to remove interference or noise from signal, to obtain the spectrum of data, or to transform the signal into a more suitable form. DSP is now used in many areas where analog methods were previously used and in entirely new applications which were difficult or impossible with analog methods for example, linear phase response can be achieved, and complex adaptative filtering algorithms can be implemented using DSP [2]. In addition the applications of DSP and its basic operations such as convolution correlation, filtering, transformation and modulation in detail are also very important [1]. 10
  • 23. 2.2.1. DSP applications Digital signal processing and analog signal processing are subfields of processing. But DSP includes subfields like: audio and speech signal processing, sonar and radar signal processing, sensor array processing, spectral estimation, statistical signal processing, digital image processing, signal processing for communications, control of systems, biomedical signal processing, seismic data processing, etc .The goal of DSP is usually to measure, filter and/or compress continuous real-world analog signals. The first step is usually to convert the signal from an analog to a digital form, by sampling it using an analog-to-digital converter (ADC), which turns the analog signal into a stream of numbers as has seen in sampling method when the working principle of digital oscilloscope was explained. However, often, the required output signal is another analog output signal, which requires a digital-to-analog converter (DAC). Even if this process is more complex than analog processing and has a discrete value range, the application of computational power to digital signal processing allows for many advantages over analog processing in many applications, such as error detection and correction in transmission as well as data compression [6]. It finds its application in various areas ranging from broadcasting to medicine. Let us have a look at some of the applications of the same.  Biomedical Applications: DSP is used extensively in the field of biomedicine. In it, the various signals that are generated by the different organs in the human body are measured in order to find information regarding the health of the same. For example, in case of electrocardiograms, the electric signals generated by the heart are measured. Similarly, the activity of the brain is monitored by electroencephalograms.  Automatic Control: These days, many gadgets are available that can perform their tasks automatically. These devices contain various components that can take inputs depending on the surrounding conditions. These are conveyed to the control unit of the device where they are processed and the necessary action is taken. For example, a device like the thermostat increases its resistance in proportion to temperature. This can be used to stem the current in a machine whenever the temperature rises.  Broadcasting: DSP is used on a large scale for the broadcast of both television and radio programs. In the process of recording the audio itself, a large amount of processing of the sound waves takes place in order to enhance the same. Then, the signals are converted into digital format and are broadcasted and are received at the respective receivers where they are again converted into the analogous format and then, are filtered to remove the noise etc. Thus, the output of the radio, TV etc. is generated. 11
  • 24. Figure 2.9: Broadcasting via satellite[11]  Telecommunication: DSP is used to the greatest extent in this field. The various conversations that one carried out these days are through the means of DSP which is used in the transfer of the signals from one point to the other. Various methods are available to transfer these audio signals. For example, if satellites are used then, the audio waves are first converted into electromagnetic waves and then transferred over a wireless medium. On the other hand, in case of optical fibers, the waves are converted into light waves and are then transferred through these fibers [11].  Navigation: DSP is used to a great extent in navigation. Devices or systems such as SONAR or Radar work primarily on the basis of DSP. For example, SONAR makes use of sound waves (signals) in order to calculate the depth. On the other hand, radars make use of radio waves in order to communicate the locations of various objects in a particular radius [11]. 12
  • 25. Figure 2.10: Dish antenna used for helping in navigation [11]. Apart from those mentioned above, digital signal processing has various other applications. For example, it is used in cars, remote controls, seismic analysis etc. Thus, DSP proves to be one of the most useful techniques developed in the modern times [11] Processing of audio signals is one of the most important and widely used applications of digital signals processing. It is being used in many fields such as communication, broadcasting of audio signals for radios, television etc. It primarily includes analysis of audio signals that fall in the human hearing frequency by mathematical. The audio signals that fall in the human auditory range depends both on physical and psychological factors. A separate branch has been introduced to study the same and is called psychoacoustics. Wherever signals are concerned, one has to deal with two different types viz. digital and analogue. The techniques that are used in order to deal with these two types of audio signals are different. In case of analogue audio signals, the pressure transformations are usually represented electrically in the form of voltage levels [11] 13
  • 26. Figure 2.11: Processing of audio signal [11] The digital representation of audio signals is usually in the form of binary digits that are used to represent the pressure variations. One should note that the digital representation of the audio signals is used only to facilitate the use of computers in the analysis of the same. In the real world, these signals are continuous or analogous in nature. However, as the capacity of human ears is limited, digital representation of the same is possible provided that the sampling rate of the audio signals is high. Also, noise is always present with the audio signals that are required. Thus, quantization of the audio signals does not result in the loss of large amount of actual information. The generated audio is often converted into other forms in order to transfer it at greater rates and with less amount of loss. For example, in case of optical fibers, the sound is converted into light energy and is then transferred to the desired location. Such conversion of audio into other forms is a part of audio processing as well. Other applications of audio processing include broadcasting of sound, enhancement of audio etc. Before an audio signal is broadcasted, a large amount of processing is done on it. This includes mixing, different steps in recording, noise reduction etc. From the processing that is carried out later on, various audio formats are generated depending on the method that is used for audio encoding, the amount of original audio that is retained. Then, when the audio signal is received on devices at your homes or at other places, some amount of processing is done on it once again. This may include amplification of the audio in order to increase its loudness, noise reduction once again, and adding various effects to it such as surround sound. In order to obtain the surround sound effect, two audio signals are generated from the original one and are made out of phase with each other [11]. Apart from these, the other applications of audio processing are innumerable. Thus, it will always be among the most popular fields in which signal processing is applied as it finds its use in some of the most popular devices such as television, cell phones etc. 14
  • 27. 2.2.2. The Basic DSP Operations The basic DSP operations are: -Filtering: Convolution of the signal x(n-k) and filter’s impulse response h(k) in time domain. i.e. y(n)= ………………….. (2.1) The common filtering objective is to remove or reduce noise from a wanted signal. This operation will be explained clearly when designing this project. -Discrete transformations: allow transformation of discrete-time signals in the frequency domain or the conversion between time and frequency domain representations .The spectrum of signal is obtained by decomposing it its constituent frequency components using a discrete transformation. Conversion between analog time and frequency domain is necessary in many DSP applications. For example, it allows for more efficiency implementation of DSP algorithms such as those for digital filtering, convolution and correlation [2]. -Modulation: As digital are rarely transmitted over long distance or stored in large quantities in their raw form, therefore modulation is required in order to modulate signals for matching their frequency characteristics to those of transmission /or stored media to minimize signal distortions, to utilize signal bandwidth efficiently, or to ensure that the signals have some desired properties. The two applications are where modulation is extensively used (employed) are telecommunication and digital audio Engineering [2]. 2.3. Data Acquisition Toolbox 2.3.1. Basic Steps for Acquiring Data The matlab Tutorial version 7.0, 6.8 and 7.8 illustrates how to perform basic data acquisition using analog input subsystems and the Data Acquisition Toolbox software. It tells that for most data acquisition applications, the following basic steps are required: Install and connect the components of your data acquisition hardware. At a minimum, this involves connecting a sensor to a plug-in or external data acquisition device. Configure your data acquisition session. This involves creating a device object, adding channels, setting property values, and using specific functions to acquire data. Analyze the acquired data using MATLAB. In this experiment data acquisition applications can be explained using a sound card. 2.3.2. Acquiring Data with a Sound Card 15
  • 28. Suppose you must verify that the fundamental (lowest) frequency of a tuning fork is 440 Hz. To perform this task, you will use a microphone and a sound card to collect sound level data. You will then perform a fast Fourier transform (FFT) on the acquired data to find the frequency components of the tuning fork. The setup for this task is shown below. Figure 2.12: Acquisition of data with sound card[16] 2.3.2.1. Configuring the Data Acquisition Session For this, you will acquire 1 second of sound level data on one sound card channel. Because the tuning fork vibrates at a nominal frequency of 440 Hz, you can configure the sound card to its lowest sampling rate of 8000 Hz. Even at this lowest rate, you should not experience any aliasing effects because the tuning fork will not have significant spectral content above 4000 Hz, which is the Nyquist frequency. After you set the tuning fork vibrating and place it near the microphone, you will trigger the acquisition one time using a manual trigger. You can run the above by typing daqdoc4_1 at the MATLAB Command Window. Create a device object — create the analog input object AI for a sound card. The installed adaptors and hardware IDs are found with daqhwinfo. AI = analoginput('winsound'); Add channels — Add one channel to AI. Chan=addchannel(AI,1); Configure property values — Assign values to the basic setup properties, and create the variables blocksize and Fs, which are used for subsequent analysis. The actual sampling rate is retrieved because it might be set by the engine to a value that differs from the specified value. duration = 1; %1 second acquisition set(AI,'SampleRate',8000) ActualRate = get(AI,'SampleRate'); set(AI,'SamplesPerTrigger',duration*ActualRate) set(AI,'TriggerType','Manual') 16
  • 29. blocksize = get(AI,'SamplesPerTrigger'); Fs = ActualRate; Acquire data — Start AI, issue a manual trigger, and extract all data from the engine. Before trigger is issued, you should begin inputting data from the tuning fork to the sound card. start(AI) trigger(AI) wait(AI,duration + 1) The wait function pauses MATLAB until either the acquisition completes or the time-out elapses (whichever comes first). If the time-out elapses, an error occurs. Adding 1 second to the duration allows some margin for the time-out. data = getdata(AI); Clean up — When you no longer need AI, you should remove it from memory and from the MATLAB workspace. delete(AI) clear AI 2.3.2.2.Analyzing the Data For this, analysis consists of finding the frequency components of the tuning fork and plotting the results. To do so, the function daqdocfft was created. This function calculates the FFT of data, and requires the values of SampleRate and SamplesPerTrigger as well as data as inputs. [f,mag] = daqdocfft(data,Fs,blocksize); daqdocfft outputs the frequency and magnitude of data, which you can then plot. daqdocfft is shown below. function [f,mag] = daqdocfft(data,Fs,blocksize) % [F,MAG]=DAQDOCFFT(X,FS,BLOCKSIZE) calculates the FFT of X % using sampling frequency FS and the SamplesPerTrigger % provided in BLOCKSIZE xfft = abs(fft(data)); 17
  • 30. % Avoid taking the log of 0. index = find(xfft == 0); xfft(index) = 1e-17; mag = 20*log10(xfft); mag = mag(1:floor(blocksize/2)); f = (0:length(mag)-1)*Fs/blocksize; f = f(:); The results are given below. plot(f,mag) grid on ylabel('Magnitude (dB)') xlabel('Frequency (Hz)') title('Frequency Components of Tuning Fork') Figure 2.13: Frequency component of Tuning Fork[16] The plot shows the fundamental frequency around 440 Hz and the first overtone around 880 Hz. A simple way to find actual fundamental frequency is 18
  • 31. [ymax,maxindex]= max(mag); maxfreq = f(maxindex) maxfreq =441 The answer is 441 Hz. 2.3.2.3. Power spectral Density of data Power spectral density (PSD) describes how the power (or variance) of time series is distributed with frequency. Power spectral density function (PSD) shows the strength of the variations (energy) as a function of frequency. In other words, it shows at which frequencies variations are strong and at which frequencies variations are weak. Mathematically, it is defined as the Fourier transform of autocorrelation sequence of time series. Being power per unit of frequency, the dimension are those of power divided by Hertz[15] . 2.4. Computer sound cards Before talking any word about sound card it is better to make a little summary for some computer applications and its function. Larry Long and Nancy Long in their eight edition computer book describe computer as an entertainment center with hundred of interactive games. He adds that it is virtual university providing interactive instruction and testing, a painter’s canvas, video telephone, a CD player, a home or office library, a television, the biggest marketing place in the world, the family photo album, the print shop, a wind tunnel that can test experimental airplane designs, a recorder, an alarm clock that can remind somebody to keep an appointment, an encyclopedia, It can also perform thousands of specialty function that require specialized skills such as preparing taxes drafting legal documents counseling suicidal patients and much more[5][7]. 2.4.1. Introduction to computer sound cards The sound card (also called an audio card) is the part of a computer which manages its audio input and output. Figure 2.14: Computer sound card [13] 19
  • 32. Sound card is used to record data and then playing back the recorded data. The recorded data uses the sound card’s analog input subsystem playing back data uses the card’s analog output subsystem [14]. It is usually a controller which can be inserted into an ISA (Industry Standard Architecture) slot or PCI (Peripheral Component Interconnect) for more recent ones, but more and more motherboards include their own sound card [13]. Therefore sound card translates digital sound into the electric current that is sent, to the speakers .As it have mentioned that Sounds are defined as air pressure varying over time. To digitize sound, the waves are converted to an electric current measured thousands of times per second and recorded as a number. When the sound is played back, the sound card reverses this process, translating the series of numbers into electric current that is sent to the speakers [3]. A sound card allows a computer to create and record real, high-quality sound. 2.4.2. Analog versus Digital object related to sound card Sounds and computer data are fundamentally different. Sounds are analog - they are made of waves that travel through matter. People hear sounds when these waves physically vibrate their eardrums. Computers, however, communicate digitally, using electrical impulses that represent 0s and 1s. Like a graphics card, a sound card translates between a computer's digital information and the outside world's analog information. Sound is made of waves that travel through a medium, such as air or water. The most basic sound card is a printed circuit board that uses four components to translate analogue and digital information:  An analog-to-digital converter (ADC)  A digital-to-analog converter (DAC)  An ISA or PCI interface to connect the card to the motherboard  Input and output connections for a microphone and speakers Instead of separate ADCs and DACs, some sound cards use a coder/decoder chip, also called a CODEC, which performs both functions. Figure 2.15: Analog signal to be sampled by soundcard[12] ADCs and DACs 20
  • 33. Imagine using your computer to record yourself talking. First, you speak into a microphone that you have plugged into your sound card. The ADC translates the analog waves of your voice into digital data that the computer can understand. To do this, it samples, or digitizes, the sound by taking precise measurements of the wave at frequent intervals [12]. Figure 2.16: An analog-to-digital converter measures sound waves at frequent intervals [12]. The number of measurements per second, called the sampling rate, is measured in kHz. The faster card's sampling rate the more accurate its reconstructed wave is. If you were to play your recording back through the speakers, the DAC would perform the same basic steps in reverse. With accurate measurements and a fast sampling rate, the restored analog signal can be nearly identical to the original sound wave. Even high sampling rates, however, cause some reduction in sound quality. The physical process of moving sound through wires can also cause distortion [12] . 21
  • 34. Figure 2.17: A PCI sound card[12] 2.4.3. Conditions required to interface any signal to computer sound card Before interfacing any signal to your computer sound card, many precautions are required in order to prevent the damage of that sound card. According to theory written by Luis Guerra edited by Christopher Lyons and Gino Sigismondi, many users of computer sound cards purchase a professional microphone to improve upon the performance of the microphone included with the sound card. But because interconnection procedures in the computer world differ from those used in professional audio, it is not always easy to make a professional microphone work with a computer. To be successful in connecting a microphone to your computer, you must know some things about both your microphone and your sound card. 2.4.4. Chip Chat Sound Card Technical Specifications Before connecting any signal to computer you have to pear attention with computer sound card specifications in order to prevent that external signal to damage this sound card. Below there are computer sound card specification for any kind of PC.  Sound card Audio Characteristics:  Sampling resolution: 8 and 16 bit (Stereo or monaural)  Sample rate: 4.0 kHz - 44.1 kHz  Dynamic range: 16 bits resolution (65535 discrete levels)  Frequency response: 20 Hz - 20 kHz, 3dB  Signal to Noise ratio: 80 dB  Audio in Input Impedance: 30kΩ (30kilohms)  Audio in Input Signal Level: 1.41Volts (RMS) 22
  • 35.  Microphone Input Impedance: 20kΩ (20kilohms)  Audio Out Drive: 4Ω (4 ohms) Note: Most sound cards support sample frequencies approximately 5-10 kHz to 44.1 kHz. Sample frequency outside this rang can produce unexpected results.  Sound card connectors characteristics:  Audio In: Mini-phone jack (3.5 mm)  Microphone input : Mini-phone jack (3.5 mm)  Audio Out: Mini-phone jack (3.5 mm)  CD-Audio: SoundBlaster and IBM (shrouded pin header, 1x4, 2 mm) Generic (shrouded pin header, 1x4 0.10 inch)  IBM Front Panel: Pin header 2x8 0.10 inches  Automatic gain for microphone  ADPCM compression/decompression reduces audio file size on hard disk.  Jack The "jack" is without a doubt the most commonly used connector for small-scale audio equipment. Jacks are normally divided into three different types, based on their diameter:  2.5 mm jack: The smallest jack;  3.5 mm jack: The traditional jack, which corresponds to a headphone jack;  6.35 mm jack: The jack used for semi-professional sound systems, in order to connect speakers, amplifiers, or microphones. There are two versions of each of these jacks:  Mono jacks, for sending monophonic sound. This kind of jack has two contacts: a reference, found on the body of the cord, and the signal on the tip.  Stereo jacks, for sending stereophonic sound. This kind of jack has three contacts: The same two as its mono counterpart, as well as an additional ring for sending another audio channel. Figure 2.18: mono connector[13] 23
  • 36. Figure2. 19: Stereo connector[13] In computer sound cards, the plugs for jacks are generally colour-coded so users can easily tell which type of audio device each one connects to, and whether they are audio inputs or outputs. Figure 2.20: Jack[13] 24
  • 37. CHAPTER 3: SYSTEM DESIGN This work consists of two experiments (Designs) as mentioned bellow:  The first one consists in designing a system with Zelscope application software.  The second design consists in developing a system whereby a signal generated by function generator is acquired, processed and displayed on PC screen. The same signal is displayed on the physical oscilloscope for comparison purpose. 3.1. Example of analyzing data by matlab Before making the above designs it is better to lean how matlab software analyzes data (signal).This is done with help of example. This example is obtained by recording the sound using sound record of PC. After recording, recorded signal is saved on Desk top. The saved signal is analyzed by Matlab. The procedure to be discussed above is as follows: Click on Start bottom menu All programs Accessories Entertainments Sound Recorder After recording this signal, save it by using file button on sound recorder menu. This saved signal has to be copied to workspace in Matlab software in order to analyze it with this software. 3.1.1. Signal analysis This signal to be analyzed is obtained when it has been generated by clamping hands through PC microphone. Next, it is saved into Matlab workspace by giving it any file name. The behavior of this signal after to be analyzed by matlab is shown by the fig.3.21 and its Power spectral Density(Fig.3.22) . 25
  • 38. Figure 3.21: Signal analyzed by matlab 26
  • 39. Power Spectral Density of the data -5 -10 -15 Power Spectrum Magnitude (dB) -20 -25 -30 -35 -40 -45 -50 -55 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Frequency Figure 3.22: Power Spectral density of data 3.2. Data Acquisition with MATLAB Programming This part of the design illustrates how to perform basic data acquisition tasks using analog input subsystems and the Data Acquisition Toolbox software. For most data acquisition applications, these basic steps should be followed: 1. Create the analog input object AI for a sound card 2. Configure your data acquisition session. This involves creating a device object, adding channels, setting property values, and using specific functions to acquire data. 3. Analyze the acquired data using MATLAB. The experiment examines data acquisition applications using a sound card .Generally, this part consists of taking analog signal using matlab code and analyzing it with matlab. The result obtained of the signal after to be acquired by matlab codes is shown by two figures bellow. 27
  • 40. Figure 3.23: Data Acquired using Matlab acquisition program 28
  • 41. Power Spectral Density of the data -5 -10 -15 Power Spectrum Magnitude (dB) -20 -25 -30 -35 -40 -45 -50 -55 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Frequency Figure 3.24: Power spectrum density of data acquired using Matlab acquisition program The signals obtained above are created by clamping hands .Those three lines (on fig. 3.3.)Indicates the time intervals of the clamps . As it shows that they are number of three, means that the times used to clamp hand is three. Note: Although the above Figures (i.e. Fig 3.21&Fig 3.23) are analyzed by Matlab, they are not exactly the desired signal because due the environment, this analog signal is mixed with random noise which has to be eliminated. Therefore the design of digital filter is needed in order to denoise this noisy signal. 3.3. Digital Filter Design The Design process for this Filter begins with its characteristics .A digital filter is characterized by its transfer function, or equivalently, its difference equation. Mathematical analysis of the transfer function can describe how it will respond to any input. As such, designing a filter consists of developing specifications appropriate to the problem (for example, a second-order low pass filter with a specific cut-off frequency), and then producing a transfer function which meets the specifications.The transfer function for a linear, time-invariant, digital filter can be expressed as a transfer function in the Z-domain; if it is causal, then it has the form: …………3.2 29
  • 42. Where the order of the filter is the greater of N or M. The above equation of transfer function originates from the solution of different equation of digital filter: M N y[n]   a k y[n  k ]   bl x[n  l ] …………………………………………………………………………………….3.3 k 1 l 0 Where:  x[n-k] is the input signal,  y[n-l] is the output signal,  ak and bl are the filter coefficients, also known as tap weights, and Taking Z-transforms on both sides, applying the time shifting property, we get: k Y[z]z-k+ -k kX[z]z ……………………………………………………….3.4 -k -k kY[z]z = kX[z]z …………………………………………………………….3.5 Y[z] k z-k] = X[z] k z-k…………………………………………………………….3.6 H[z]= = k z-k/ k z-k]………………………………………………………….3.7 Expanding the numerator and denominator of equation (3.7) ,we get H[z]= = b0+b1z-1+b2z-2+b3z-3+….+bNz-N/1+a1z-1+a2z-2+a3z-N+…+aMz-M…………3.8 By comparing equations (3.1) and (3.8), it is clear that these two equations are the same with Y[z] =B[z] and X[z] =A[z] This form is for a recursive filter, which typically leads to infinite impulse response behavior, but if the denominator is unity, then this is the form for a finite impulse response filter. For FIR digital Filter the equation (3.8) will be converted to: H[z]= b0+b1z-1+b2z-2+b3z-3+….+bNz-N………………………………………………………………….3.9 it why the denominator of equation(3.8) is 1. Although there are two type of Digital Filters: Finite Impulse Response(FIR) and Infinite Impulse Response(IIR), only the FIR Filter has to be used due to its following advantages over other kinds of filter:  Are inherently stable. This is due to the fact that all the poles are located at the origin and thus are located within the unit circle. 30
  • 43. Require no feedback. This means that any rounding errors are not compounded by summed iterations. The same relative error occurs in each calculation. This also makes implementation simpler.  They can easily be designed to be linear phase by making the coefficient sequence symmetric; linear phase, or phase change proportional to frequency, corresponds to equal delay at all frequencies. 3.3.1. FIR digital filter Mathematically, it can be described as follows H[k],k=0,1,…….. x[n](input sequence) y[n](output sequence) (Impulse response) Figure 2.25: A conceptual Representation of digital filter Where x[n] is the input signal h[n] is the filter which is going to filter that input signal y[n] is the output signal y[n]= ………..................................................................................(3.10) Note: The above equation is the output signal from FIR filter. It is clear that for this kind of filter, the impulse response is of finite duration since h(k) have only N values and the denominator is unit which are among the characteristics of it(FIR filter) . Since some input signal to the system is audio signal(signal obtained in case of playing music ) with the bandwidth of 20 Hz-20 KHz and as has mentioned in the scope and limitation of this project, the special kind of filters are required to denoise this signal .These kinds of filter are nothing but FIR band-pass and low pass filter. And Linear-phase equiripple filters are desirable because they have the smallest maximum deviation from the ideal filter when compared to all other linear- phase FIR filters of the same order. Equiripple filters are ideally suited for applications in which a specific tolerance must be met, such as when designing a filter with a given minimum stopband attenuation or a given maximum passband ripple. For designing this kind of filter, it is not necessary to go deeply into detail for the design of this filter. This kind of filter has introduced as tool which helps to get the desired signal. The procedure of designing the intended filter starts by typing the MATLAB command fdatool. 31
  • 44. The specifications of Filters Designed are shown by Figures bellow 3.3.2. Band Pass filter Design Specifications Figure 3.26: Band-pass filter design From the above figure this band- pass filter (BPF) of finite impulse response (FIR) has two cutoff frequencies: Fpass1 and Fpass2 .  Regions between specification values like Fstop1 and Fpass1 are transition regions where the filter response is not explicitly defined.  The region between Fpass1and Fpass2 the pass band zone where the desire frequencies have to pass.  Fs specify the sampling frequency .Fs in Hz as a scalar trailing all other numeric input arguments. If you provide a sampling frequency, all frequencies in the specification are in Hz.  dB specify the magnitude in dB (decibels)  Ap — passband ripple in dB (the default units). 32
  • 45. Astop1 — attenuation in the first stopband in dB (the default units).  Astop2— attenuation in the second stopband in dB (the default units).  BWpass — bandwidth of the filter passband. Specified in normalized frequency units by default.  BWstop — bandwidth of the filter stopband. Specified in normalized frequency units by default. 3.3.3.Low pass filter Design Specifications To get the filtered data from unfiltered data of figure 3.3,we design FIR low-pass filter designed is of equiripple methods with the following specifications: Figure 3.27: Low pass filter design  Region between specification values like Fpass and Fstop is transition regions where the filter response is not explicitly defined. 33
  • 46. The region between 0 and Fpass is the pass band zone where the desire frequencies have to pass.  Fs specify the sampling frequency Fs in Hz as a scalar trailing all other numeric input arguments. If you provide a sampling frequency, all frequencies in the specification are in Hz.  dB specify the magnitude in dB (decibels)  Apass — passband ripple in dB (the default units).  Astop — attenuation in the stopband in dB (the default units).  BWp — bandwidth of the filter passband. Specified in normalized frequency units by default.  BWstop — bandwidth of the filter stopband. Specified in normalized frequency units by default. Note:The filtered sound signal ‘data’ from figure 3.23 looks as follows: 1.5 1 0.5 0 -0.5 -1 -1.5 0 0.5 1 1.5 2 2.5 3 3.5 4 4 x 10 Figure 3.28: Filtrered Data Acquired using Matlab programming 3.4. The design using zelscope This design consists of using the different equipments such as Mobile phone, some wires which interface two audio connectors: from phone’s headphone jack to computer sound card’s Audio In for out putting signal (audio signal) to Zelescope inside PC through sound card. 34
  • 47. The signal is obtained when music is played using mobile phone. Then it passes to computer’s Audio In through the wire connecting two Audio Connectors. These audio connectors are stereo. The first one on mobile phone’s microphone line out, the second one on the sound card line in. As the music played by mobile phone is an audio signal which is of an analog in nature, the computer sound card is there to do the job of Analog to Digital Convertor in order to get the output digital signal from sound card which can be understood by computer as digital equipment. This out signal from sound card is being to be analyzed by zelscope. When you want to analyze signal on zelscope pear attention with calibration as follows: 1) make sure that the vertical offset for CH1 is zero (up-down slider in the middle position); 2) apply a signal with a known amplitude; 3) using V/DIV buttons and slider, adjust gain so the visible amplitude of CH1 is 2 divisions or higher; 4) click CAL button, answer OK to the message box; 5) click on the trace at the point of known voltage. 6) type the reference voltage in the dialog box, click OK. The vertical scale may abruptly change, as the V/DIV setting will be now a real one. After analyzing the signal, you can save it using settings –save menu on Zelscope display as screenshot .Finally, this saved signal is being to be compared with that obtains using matlab programming language. Let see how this looks like using matlab programming language. Blok diagram summarizing this first design is as follows: Audio connector on mobile PC’s audio I n Phone line in Zelscope Mobile phone PC Wire connecting two audio connectors Figure 3.29: Block diagram showing the design using Zelscope The following procedures used for achieving what have done using the above design: 1) Playing music with mobile phone. 2) Plug audio connector into mobile phone line out. This audio connector may be mono or stereo. But for this experiment only stereo audio connectors have used. 3) Open zelscope software into PC Plug other audio connector on PC’s Audio In. Note: audio connector on mobile phone line out and audio connector on PC’s Audio In are linked together in other to transfer signal from mobile phone to PC. 35
  • 48. 4) Calibrate zelscope diagram into your PC. 5) Analyze the signal using zelscope software. 6) Save the analyzed signal on Zelscope display. 7)Acquire the sound signal played by mobile phone using matlab programming language Acquisition, sampling, plotting, saving and loading this analogue signal "data" is manipulated using the following matlab code shown in the appendices of this book. 3.5. Design using physical devices 3.5.1. Designing methodology and process The design was verified based on the principle of operation of some analog components along with their association with other components or circuits. After designing and collecting all the required components, the design was carried out using different electronic equipments available in electronic laboratory such as:  Signal generator Figure 3.30: Photo of signal generator 36
  • 49.  Analog oscilloscope Figure 3.31: Photo of analog oscilloscope  PC Figure 3.32: Photo of PC In addition the interface between PC and signal generator was also designed and implemented. 37
  • 50. Figure 3.33: Photo of interface circuit 3.5.2. Design process 3.5.2.1 Interface circuit design As stated previously, it has found that it is dangerous to connect the sound card to anything other than standard audio equipment. Therefore, a voltage divider or a buffer amplifier is highly recommended for preventing the damage hardware and/or data that can potentially occur. A schematic of this interface is available bellow: Figure 3.34: Interfacing circuit between PC sound card and signal generator This circuit design contains input resistance, variable resistance and diodes for protection issues. From our design, we have been limiting only for audible signal which can contain a restricted rang of frequency: from 20Hz to 20 KHz. For simple electronic circuits, it may be sufficient to get a qualitative insight on dedicated electrical signals. This interface circuitry allows using the line-in input of a standard PC soundcard to be used as a 2-channel oscilloscope. In our circuit design, we have been selecting only channel1.This setup does not allow for exact measurements, however for some applications, a qualitative insight on dedicated timing or signal characteristics may be obtained. The interface limits the signals from input channel 1 and 2 to maximum amplitude of 1.2 V (over-voltage protection circuitry). At the left side of the schematic above, the two input channels for signal 38
  • 51. measurement and the common ground are shown. At the right side, next to the protection diodes, the connections for the 3.5 mm stereo jack to the soundcard (line-in) are drawn. Note: The results and data obtained from this above design realized in laboratory have been analyzed experimentally. Block diagram of the design is illustrated below Signal Interface Oscilloscope generator Figure 3.35: Block diagram of the design using oscilloscope PC General description The signal generator in this block diagram is there to generate signal frequency. This signal frequency is fed to oscilloscope through interfacing circuit. This interface between signal generator and oscilloscope does a job as a buffer for attenuating the amplitude of voltage in order to protect PC sound card which can be damaged by electrical signal from signal generator at the same time the signal is fed to PC. The PC screen displays signal frequency analyzed by Matlab software. The output to PC screen is one which has to be compared to oscilloscope’s output display. Figure 3.36: Photo of experiment for complete system 3.5.2. Procedure of experiment As above figure shows, this experiment was designed by generating the frequency of 200 Hz. This signal passes through interface circuit to oscilloscope. The amplitude (voltage) of this signal reaches on oscilloscope display will have the value of 0.5volts due to resistors implement interface circuit as described in interface design. This voltage of 0.5V has to be fed to PC sound 39
  • 52. card as data which is being to be acquired with matlab code in order to be analyzed by matlab software. As maximum amplitude to PC sound card is 1.2 V, we only choose 0.5V as amplitude which is less than that maximum voltage in order to avoid the damage of sound card. But also, any amplitude less than 1.2V can be used. 40
  • 53. CHAPTER4. ANALYSIS OF RESULTS AND DISCUSSION This chapter describes and discusses the results obtained during the experiment of this project. 4.1. Analysis of results 4.1.1. Results about Zelscope 1. Signal obtained on Zescope Display This signal is obtained by connecting the two stereo connectors one for Mobile phone line out and PC sound card line In,and tnen the signal is analysed on Zelscope Display accordingly. Figure 4.37:Signal analyzed on Zelscope Display 2.Signal obtained by acquisition using Matlab Programming language The two Stereo connectors are plugged into the two Audio In. One for mobile phone line out and other for PC sound card line In.After plugging these stereo connectors ,they have to connected together in other to pass signal from mobile phone to PC. The result obtained after acquisition of signal (signal played by mobile) is described by the figures below: 41
  • 54. Acquired signal "data" 1 0.8 0.6 0.4 Magnitude in volts 0.2 0 -0.2 -0.4 -0.6 -0.8 0 50 100 150 200 250 300 350 400 450 500 Frequency in Hz Figure 4.38: Accquisition of signal “Data” 42
  • 55. Power Spectral Density of the data 10 0 Power Spectrum Magnitude (dB) -10 -20 -30 -40 -50 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Frequency Figure 4.39: Power spectral density of data 43
  • 56. Filtered Signal "Data" 1 0.8 0.6 0.4 Magnitude in Volts 0.2 0 -0.2 -0.4 -0.6 -0.8 0 50 100 150 200 250 300 350 400 450 500 Frequency in Hz Figure 4.40: Filtered signal “data” 4.1.2. Description of interface circuit By well done of amplitude adjustment, the experiment shows some calculated amplitudes that our design interface circuit is allowed to pass. These are the current values obtained when doing experiment in the laboratory using signal generator, oscilloscope display and calculations. From mathematical formula (apply of ohm’s law), the interface output current from these values of input voltage and resistors on the circuit are given in the table by: Io= ........................................................... (4.11) Where Io : output current Vi: input voltage from signal generator Ri: input resistance Rv: variable resistance 44
  • 57. Interface I/P voltage Input Resistance in Ω Variable Resistance in Interface O/P current Ω (amplitude) in mV (amplitude) in mA 20 10000 5000 0.00133 50 10000 5000 0.00333 100 10000 5000 0.00667 200 10000 5000 0.0133 500 10000 5000 0.0333 1000 10000 5000 0.0667 Table.1: Results for interface circuit. 4.1.3. Result of experiment about acquisition of signal The input signal to be acquired must have the characteristics shown by the table 4.1 above. This signal is a square as shown on oscilloscope display. 1. Acquisition of signal Stereo is plugged into computer’s Audio In through sound card. a) Acquired signal “data”:unfiltered signal 45
  • 58. Acquired signal "data" 1.2 1 0.8 Magnitude in volts 0.6 0.4 0.2 0 -0.2 0 50 100 150 200 250 300 350 400 450 500 Frequency in Hz Figure 4.41: Acquired signal “data” b) Power spectral density: 46
  • 59. Power Spectral Density of the data 20 10 Power Spectrum Magnitude (dB) 0 -10 -20 -30 -40 -50 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Frequency Figure4. 42: Power spectral density of unfiltered signal “data” c) Filtered signal “data”: 47
  • 60. Filtered Signal"Data" 1.2 1 0.8 Magnitude in Volt 0.6 0.4 0.2 0 -0.2 0 50 100 150 200 250 300 350 400 450 500 Frequency in Hz Figure 4.43: Filtered signal “data”of figure 4.41 4.2. Discussion 4.2.1. Discussion about the use of Zelscope In this part of experiment, the signal obtained from Zelscope display and that obtained using matlab programming language are similar but not completely similar. The similarities come from in sense that the original signal (song) used is the same for both cases. Dissimilarities found are due to the fact that during acquiring of the signal using Matlab and analyzing with Zelscope display, the song is not played simultaneously and yet the frequency is not for whole song (it is harmonized). 4.2.2. Discussion about oscilloscope 4.2.2.1. Acquisition of signal As shown by the fig4.41, this displayed signal is obtaining by generating a square wave of 0.5V and a frequency of 200 Hz on oscilloscope display from signal generator. Thus, using matlab software the distorted signal has been occurred .This distorted signal is due to the junction of interface circuit with oscilloscope probes and the junction of interface circuit, oscilloscope probes with the stereo connectors to the PC sound card line In, which generate the losses. In addition, signal generator and PC sharing the same source of power supply may also cause the 48
  • 61. distortions on generated signal. Therefore that’s why the work of filtering is needed. Even the filtering process has being done; the filtered signal is not exactly the same as that has displayed on oscilloscope because of the problems mentioned early. But the similarity like 98% is obtained as shown by fig. 4.43. Notice: Although the experiments were well done, some measured values were not the same as the intended values due to the challenges mentioned above. 49
  • 62. CHAPTER5. CONCLUSION AND RECOMMENDATIONS 5.1. Conclusion To achieve and verify the hypothesis of design a computer based system to process an analog signal, interfacing circuit between PC sound card and signal generator, different circuit sections have been designed and their operating conditions have set out. This is illustrated by the designed circuit with different sections. Zelscope software used as oscilloscope to display signal from mobile phone. A signal generator plays role of setting a fixed frequency, voltage (amplitude) required for the whole sound card by using interface circuit and oscilloscope for displaying a signal. In this implementation 0.5v was used as input to the sound card jack. According to the generated signal using signal generator, it has been found that the output frequency and amplitude of generated signal increase or decrease by adjusting manually a variable resistance in order to control the sound card input voltage (amplitude) .The 16KΩ input resistor, 50KΩ variable resistor and 1N914 diodes also have been designed for protection issues of the PC sound card to allow a small amplitude from signal generator to be used on PC sound card Matlab software have played important role for data acquisition and filtering . For filtering effect, the design of Digital filter have done using fdatool but noise in the signal did not completely eliminated due to the unfixed frequency of original signal from harmonics of songs. 5.2. Recommendations This project concerning the “DESIGN OF COMPUTER BASED SYSTEM TO PROCESS ANALOG SIGNALS” is a low level method of interfacing exactly a signal generated from signal generator and display it on oscilloscope, then analyze it on PC by using matlab programming language. Therefore, it is recommended to those who need to improve this project, to work on High level application with interface. We therefore recommend KIST to tell the students to be efficiently and qualitatively familiarized to use software programming such as Matlab programming language during preparing their final year projects. KIST is also recommended to help final year students by allowing them to have access to computer, electronics and electrical equipments. It is also recommended to improve the practical skills for students especially in engineering faculty by modifying the program Curriculum and by adding more laboratory courses as requested in the general extra academic life. Some important implemented projects are being realized by the students during their final year projects, but after that no follow up about them. Therefore, KIST is recommended to install a workshop rooms for final year projects storage. This will help people who need to use or to improve them. In addition as today’s world systems are digitalized, KIST as High institute of Technology is recommended 50
  • 63. to encourage students to do the final year project based on digitalization and implementations using software programs. 51
  • 64. REFERENCES: 1. Practical Digital Electronics by Nigal P. Cook,2004 2. Digital Signal Processing . A Practical Approach . 2nd Ed. by Emmanuel C. Ifeachor & Barrie W. Jervis,2002 3. Introduction to computers by Peter Norton’s 4th Ed.,2001 4. Jason Starck (June 2000): HTML document formatting, which led to a much better-looking second edition 5. Computer by Larry Long and Nancy Long in their 8th Ed.,1996 6. James D. Broesch, Dag Stranneby and William Walker. Digital Signal Processing: Instant access. Butterworth-Heinemann. p. 3. ) 7. http: //www.Prenhall.com/long, www. Prenhall.com/demo) 8. http: //www.allaboutcircuits.com/vol_1/chpt_9/1.html(on Monday 12 July 2010) 9. http://www.hobbyprojects.com/oscilloscope_tutorial/oscilloscope_working.html(11 June2010) 10. books.google.com/books(Apr.2010) 11. Wikipedia,free-encyclopedia:www.scienceprog.com/digital-signal- processing(k.kumaresan: October 3rd, 2009 at 4:28 pm). 12. http://www.howstuffworks.com/sound-card.htm; http://computer.howstuffworks.com/sound-card.htm(Copyright© 1998- 2010 HowStuffWorks, Inc) 13. http://en.kioskea.net/contents/pc/carte-son.php3(24Apr.2009), en.kioskea.net/.../affich- 209761-how-do-i-bypass-my-sound-jack (29 Nov 2009) 14. http://www.zelscope.com Copyright © 2001-2006 K.Zeldovich, N.Shusharina 15. http://www.cygres.com/OcnPageE/Glosry/Spec.html; http://www.cbi.dongnocchi.it/glossary/PowerSpectralDensity.html 16. Matlab tutorial version 7.0 52
  • 66. Appendix1 MATHLAB CODE USED TO ACQUIRE, SAMPLE, PLOT, SAVE AND LOAD ANALOGUE SIGNAL "DATA" %CREATION OF THE OBJECT clear all; close all; clc; ai = analoginput('winsound');%Create the analog input object AI for a soundcard %ADDITION OF CHANNELS Chan = addchannel(ai,1);%Add two hardware channels to ai %CONFIGURATION OF PROPERTY VALUES Duration = 5;%5 seconds acquisition set(ai,'SampleRate',8000);%Specify the per-channel rate at which analog data is converted to digital data ActualRate = get(ai,'SampleRate');% define the device sample rate. This might be different from the specified value set(ai, 'SamplesPerTrigger', duration*ActualRate);%Specify the number of samples to acquire for each channel group member for each trigger that occurs. set(ai,'TriggerType','manual');%set the manual trigger function. The trigger will occur immediatly after the trigger function is manually issued blocksize=get(ai,'SamplesPerTrigger'); Fs=ActualRate;% define the sampling frequency %DATA ACQUISITION start(ai); trigger(ai);% apply a manual trigger wait (ai, duration+1);%pause MATLAB until either the acquisition completes or the timeout elapses %Adding 1 second to the duration allows some margin for the timeout [data,time] = getdata(ai);% Extract all data from the engine size(data(1:500));%returns the number of rows and columns in data as separate output variables with data scale of 1:500 54