PC Based Oscilloscope

DOI : 10.17577/IJERTV2IS100804

Download Full-Text PDF Cite this Publication

Text Only Version

PC Based Oscilloscope

Sandeep k. Verma 1, Rupesh Baghmar 2,Samarth Agrawal 3

Bachelor of Engineering in Electronics and Telecommunication

From Chhattisgarh Swami Vivekanand Technical University, Bhilai, C.G., India

Abstract

Oscilloscopes are one of the most versatile electronic instruments available. It allows one to see a voltage at an arbitrary point in an electronic circuit. It can also be used to observe variables in other phenomena, provided the appropriate sensor is available. Such as perhaps a sound wave, when converted to an electronic voltage by a microphone

the microphone being the sensor. Oscilloscopes are however very expensive, and thus requires substantial monetary investment, which is greater than the average student can afford.

PC monitors are standard these in days with Desktop PC systems. There is however a surplus of these monitors available, especially since the lifetime of the monitor is much longer than the lifetime of the desktop PC. With the accelerating changes in desktop PCs these days, this surplus is likely to increase at an even faster rate.

This has created an interesting possibility what if an cheap oscilloscope could bebuilt that has as its display a PC monitor.

  1. Introduction

    For our experimental design project, weve decided to build a PC-based oscilloscope. After spending four years for the bachelor of engineering, weve discovered that its extraordinarily difficult to design and build hardware outside of class because, aside from a multi-meter, good debugging tools are much too expensive for the average student. As we all know, the best way to learn something is to practice it, and without the ability to build at home, there is no real way to reinforce abstract topics like signal processing. In an effort to provide ourselves, and possibly future engineering students, with the tools to practice at home what they learn in class, were endeavoring to design, build, and complete an oscilloscope that is not only affordable for every engineering student to buy or build, but easy to use, small enough to fit in a small tool box, and fast enough to be useful.

  2. Limitations and Scope

    The thesis tries to implement a low-end oscilloscope with downscaled features from that of commercial oscilloscopes. It does not attempt to build the prototype with great accuracy. It is merely an attempt to see if the idea is possible and if possible, build a prototype system.

    Its bandwidth is only 500Hz, and peak to peak voltage is only 24v.

  3. Plan of Development

    The project starts off by describing the literature that was read to get a deeper understanding of the problem. It then describes the method used to attack the problem, followed by a description of some of the development tools used during the design. Then it describes some of the experiments that were performed. It then gives an overview of the initial design followed by a description of the design in detail, with pictures of some of the results of the prototype system. Finally it states some of the conclusions that were made and recommends further action that can be taken to improve the prototype.

  4. Benefits

    • Inexpensive (See cost analysis)

    • Portable

    • Small enough to take up little space in a bag.

    • USB interface and Windows software makes it compatible with most students, basement engineers, and professional engineers computers

  5. Specification

    • No extra power supply required (Works on USB power supply)

    • Communicate to PC with serial Port (no extra communication device required)

    • Small size (Portable)

    • Easy to use, easy to handle.

        1. The maximum Rating of this PC based oscilloscope is:

          • No. of Channels : 1;

          • V pp< 24v;

          • V max< 12v;

          • Vertical sensitivity (42 divisions): 0.0234V/div.

          • Input impedance ~ 20kohm;

          • Analog bandwidth (f max) < 500Hz;

          • Sampling Rate = 3.5kS/s;

  6. Research

    A large component of my thesis had been the reading of a wide range of literature. The oscilloscope and PC interfacing and controlling readings, had been essential to understanding how these components worked. These were fairly straightforward readings however.

    A greater part of my reading however, was on Microcontroller and its programming. I had no experience with these devices, and thus had to read a wide range of books, papers and articles, in order to understand, what exactly a Microcontroller was and how to program and apply them. I did not use most of the content I read on internet; however, the reading was essential in order to develop an initial feel for the capabilities and limitations of Microcontroller. This reading was done throughout my thesis. These readings did of course gain greater direction during the progression of the thesis, when certain concepts needed to be understood on a deeper level.

    I searched on internet, read books and magazine like electronics for you, for how to write program for microcontroller and how to interface it with computer. The major task for me is that, how to show graphical representation of my electrical value to the computer monitor. I have done this task by using language JAVA IDE on computer. By using this i made executable application which can communicate to microcontroller through serial port of computer.

  7. Experiments

    There was also a time for experimenting. I did some experiments in order to confirm my understanding of certain process.

    For example, when wanting to confirm my understanding of the program of the microcontroller, I wired up to the programmer and used a blinking LED program. I also experimented with the development board, in order to verify my understanding of its interface.

    In last stage of making of the oscilloscope by lack of the signal generator I used a program that gives sinusoidal output to serial port to check whether my computer program is worked properly or not.

    S.

    No.

    Name of the Components

    Rating

    Qua ntity

    Function

    1

    Microcontrolle r

    ATME GA328

    p

    2

    Analog to digital converter, Buffer storage.

    2

    Crystal Oscillator

    16Mhz

    2

    To provide Clocking signal

    3

    Capacitor (ceramic disk)

    22pF

    4

    For Stability

    4

    Transistor

    BC547

    3

    Amplifier and inverter

    5

    Zener Diode

    6v

    2

    For high voltage protection

    6

    Resistor

    10k,1k

    14

    Pull up, voltage divider

    7

    Potentiometer

    10k

    1

    To set the Transistor in Active region

    8

    LED

    3v

    2

    Indicator

    9

    RS232 Pin

    DB9

    male

    1

    To connect with PC

    10

    Dotted PCB

    1

    To implement Circuit

    11

    Project Box

    1

    To protect the circuit

    S.

    No.

    Name of the Components

    Rating

    Qua ntity

    Function

    1

    Microcontrolle r

    ATME GA328

    p

    2

    Analog to digital converter, Buffer storage.

    2

    Crystal Oscillator

    16Mhz

    2

    To provide Clocking signal

    3

    Capacitor (ceramic disk)

    22pF

    4

    For Stability

    4

    Transistor

    BC547

    3

    Amplifier and inverter

    5

    Zener Diode

    6v

    2

    For high voltage protection

    6

    Resistor

    10k,1k

    14

    Pull up, voltage divider

    7

    Potentiometer

    10k

    1

    To set the Transistor in Active region

    8

    LED

    3v

    2

    Indicator

    9

    RS232 Pin

    DB9

    male

    1

    To connect with PC

    10

    Dotted PCB

    1

    To implement Circuit

    11

    Project Box

    1

    To protect the circuit

  8. Component required

  9. Block Diagram:-

    i/p signal

    Voltage Level Shifter (RTL)

    Analog to Digital Converter

    Digital signal Buffer

    (RAM 2KB)

    Parallel to series converter

    Atmega328 P

    ATmega328p

    Display

    Signal Processing By Software

    RS232 port of PC

    Modem(MAX2 32 or RTL)

    Figure 1. Block diagram of PC based oscilloscope

  10. Circuit Diagram

    microcontroller to convert it in a single bit line. The second microcontroller sends it to the serial port of the computer.

    The analog input pin PD0 of the first ATmega328p gets analog value. In the circuit diagram we can see the transistor and some resistor also connected in input section, because of microcontroller can read only from 0V to 5V, and this extra circuit is for converting the sinusoidal wave (from -12v to +12v) to 0V to 5V. so that microcontroller can easily understand the sinusoidal wave. The potentiometer is placed in base of the transistor to set transistor on active region.

    Two Zener diode is placed back to back in the input side, so that high voltage signal can be easily ground, and not affect to the extra components.

    In the second microcontroller two transistorize not gate is present which is actually a TTL convert. We already know that any type of microcontroller can work on up to 5V. But DB9 port work on -15V to +15V. Hence we cannot directly connect microcontroller to the serial DB9 port. We must use TTL convert which convert its voltage level.

    Logi c

    Microcontroll er

    DB9 POR T

    0

    0V

    +3Vt

    o

    +15V

    1

    5V

    -3V

    to –

    15V

    Table:- Voltage level in microcontroller and DB9

    Figure 2. circuit diagram of PC based oscilloscope

  11. Description of Circuit Diagram

    As shown in above circuit diagram, here two microcontrollers is used, one for take analog reading and another for parallel to serial converter. The first microcontroller also uses its own RAM to store analog value because it cannot send the data serially to the computer as fast as it takes reading. Hence first Atmega328p stores the value to the RAM location and then it send to the second

  12. Circuit analysis

The main task in this project is, to convert AC waveform (contains negative polarity in negative half cycle) to pulsating DC waveform in between 0v to 5v. This is done by using a NPN transistor in Active region. Which collector is connected to the input pin of microcontroller and pull-up from 1k resistor. The mathematical analysis of this voltage shifter circuit is given below:-

Figure 3. Voltage level Shifter Circuit diagram

In the output of transistor three basic conditions may happens:

  1. When no input is applied the voltage across collector is 2.5V.

  2. When input voltage is +12V, the voltage across collector is 0V.

  3. When input voltage is -12V, the voltage across collector is 5V.

In First condition the voltage across 1k resistor is 2.5V. by this voltage we can easily get current across resistor:

V = IR I = V/R

I c = (5 – 2.5)/1000 I c= 2.5/1000

I c= .0025 Amp.

.0025 = 200 ·I b (h fe ~ 200 given in datasheet)

I b =.0025/200 I b = .0000125 I b = 12.5uA

In this case input voltage is zero. No potential difference create in 10k resistor by external means.

In second case the voltage across resistor is 0V. in this case

I c = (5 – 0)/1000 I c= 5/1000

I c= .005 Amp.

This is the collector current. Then base current is

I c = h fe ·I b

.0025 = 200 ·I b (h fe ~ 200 given in datasheet)

I b =.005/200

I b = .000025 Amp I b = 25 uA

In Third case the voltage across resistor is 5V. in this case

I c = (5 – 5)/1000 I c= 0/1000

I c= .0 Amp.

Here collector current is zero, means base current is also zero.

This is the collector current. Then base current is

I c = h fe ·I b

  1. Flow Chart of the program:-

    The above both AVR programs can be easily understand by this flow chart

    Figure 4. Flow Chart of AVR Program

  2. Experimental analysis

    The project is checked and analyzed by giving different waves of different frequency and amplitude to the PC based oscilloscope and waveform is obtain in the screen of the laptop.

    Image 1. Experimental arrangement of PC Based Oscilloscope

    The Typical arrangement of PC based oscilloscope is shown in above image. The output of Function generator is directly connected to the input of PC based Oscilloscope. The oscilloscope is connected to the PC through USB via USB to serial converter. By executing the executable Program in PC, The graphical representation of wave is formed.

    By giving Triangular wave of 360Hz from the function generator:

    Image 2. Triangular wave of 360Hz

    Image 3. Graphical representation of wave in PC display

    By giving sine wave of 299Hz from the function generator:

    Image 4. Sinusoidal wave of 299Hz

    Image 5. Graphical representation of wave in PC display

    By giving square wave of 516Hz from the function generator:

    Image 6. Square wave of 516Hz

    Image 7. Graphical representation of wave in PC display

  3. Conclusions

    You have seen the results. It works! It is however just a partial solution to the problem statement described in the introduction. Conclusions one of the purposes of this document is to give a better view on the different possibilities of oscilloscopes. What is a better way to do this then to implement one? Of course in the end the remote oscilloscope is developed which was the main goal of this work. This oscilloscope will be used in the distant laboratory of the Blekinge Institute of Technology (http://www.bth.se). Different kinds of schools around the world rent laboratory time on the servers of BTH. (http://distanslabserver.its.bth.se). Hopefully this paper gives a clear view on the working of the oscilloscope, the most important instrument in this laboratory. In this way this paper should also provide a better understanding of Lab VIEW for the reader.

    Developing the basic oscilloscope was an excellent way to learn how to work with Lab VIEW. The way this oscilloscope is implemented is the result of thoroughly testing and changing the whole concept. For making it more transparent; the oscilloscope was restructured several times. The code will also be submitted to National Instruments. It will be published on their website (http://www.ni.com) as a good example on how to build instruments around the basic acquisition boards they provide. The oscilloscope will also be used as an example in Lab VIEW lectures at BTH. Hopefully the final result is clear enough to be understandable for every reader of this report as well as for all the interested customers of National Instruments. At last there are still two existing problems in the basic oscilloscope. The first problem is the buffer overrun error discussed in the performance paragraph. Also a possible solution is suggested in that paragraph. The second problem is the maximum/minimum value calculation in AC mode. It can happen that in AC mode the signal is out of range as the maximum and minimum value are calculated only considering the volts/division setting, the position knob and the maximum Y-scale for the waveform graph. For example: when the signal has a high offset; this offset is removed by the AC-filter. Although it's possible that a signal that is considered out of range in the maximum/minimum value calculation is displayed anyway.

    When displaying the signal in DC mode, this is not a problem as the signal is out of the window of the waveform graph. This problem was solved by using the maximum possible range when one of the channels is in AC mode. The user of the oscilloscope

    should know that its not possible to do such accurate measurements in AC mode and should work in DC mode while using the position knobs. Of course this can be solved with a much more complex algorithm; but this will make the oscilloscope too complex as the goal of this first part of the project is to be basic and understandable. Generally speaking this is a limitation of the AC mode, and the user of the oscilloscope should be aware of this. The second oscilloscope is only tested with the discussed testing environment. It's not yet implemented in the existing distant laboratory. Therefore at the moment of writing, nothing is known about the performance of this code. When a client module is implemented for this oscilloscope, the developer should take care of all advices mentioned in the notes for client module implementation (see earlier).

    In the end it's a pity there was no time left to develop the function generator for the remote laboratory. This function generator still needs to get rebuild as the existing code contains some errors and many blanks. Also the existing code of the function generator is not structured in a good way. Of course the existing program works, so it's not a disaster that the function generator has not been rebuild. This can be done in a later stage.

  4. Recommendations

    The person following on from this project is advised to:

    1. Increase the main CLK rate.

      The CLK rate should be increase to at least 75MHz to provide the capability of a higher ADC. Increasing the main CLK rate, is however coupled to the next recommendation. By increasing CLK rate we get more bandwidth.

    2. Build the design on a PCB

      This should be done to support the higher CLK rates required on the board.

    3. Use a faster ADC

      A faster ADC should be used to support a greater input signal bandwidth.

    4. High input impedance

      By using operational Amplifier we can get high input impedance.

    5. Increase input voltage range

      By using proper isolation between microcontroller and input amplifier, and by feedback system, input voltage range can be increase.

    6. Parallel Port communication

      Instead if serial port, by using parallel port we can get real time measurement.

  5. References

  1. Various web site were visited and information was obtained from these websites They are too numerous to enumerate however. The primary web sources of help are outlined below. These were visited during the second half of 2004.

    The main web sites are:-

    1. www.altera.com

    2. www.fpga4fun.com iii)http://members.tripod.com/michaelgellis/scope.ht ml

  2. Hamblen J.O. & Furman M.D, 2001, Kluwer Academic Publishers, Rapid prototyping of Digital systems, 2nd edition

  3. Horowitz P.,Hill W.,1989,Cambridge University Press, The art of Electronics, 2nd Edition.

  4. Skahill K., 1996, Addison-Westley, VHDL for Programmable Logic

  5. Mano M.M, Kime C.R., 2001, Prentice Hall, Logic and Computer Design Fundamentals, 2nd edition

  6. Datasheets of the various manufacturers electronic parts I have used.

Leave a Reply