Sunday, July 17, 2011

Two-Channel PC Based Oscilloscope USB

Inroduction

More and more experiments are now ‘PC-assisted.’ Also conventional acquisition systems are very expensive. Since portable  PCs are today common and a USB link is a better solutionhere we present an oscilloscope using USB port of the PC that operates at up to 10 kHz with ±16V input voltage. It has much more improved features than the PC-based oscilloscope . The oscilloscope uses IC PIC18F2550 from  Microchip as the main controller, which makes the oscilloscope compact as there is no need of additional power supply for the entire circuit board.


Circuit description

     At the heart of this oscilloscope is USB2.0-compliant microcontroller PIC18F2550 from Microchip. You can also use  IC18F2445 in place of PIC18F2550. Specifications of this microcontroller are:-
Features of 18F2550
Programming
1. Up to 32 kB of flash memory, 2kB RAM and 256-byte EEPROM
2. Extended instruction set (optimised for ‘C’ compiler)
3. 8x8 single-cycle multiplier
4. Single-supply serial programming and easy debugging
USB transceiver
1. USB1.1 and 2.0 from 1.5 MB/s to 12 MB/s
2. Isochronous, bulk and interrupt transfer modes
3. 1 kB of access RAM usable with 32 endpoints (64 bytes each)
Multiple oscillator and power modes
1. From internal 31 kHz to external 48 MHz with PLL
2. Possible software switching between ‘run,’ ‘idle’ and sleep
modes. In sleep mode, current is down to 0.1 μA.
3. Wide operating voltage range (2.0V to 5.5V). Useful for battery
operations.
Complete set of classical peripherals
1. Several input/output (I/O) ports, four timers with capture/
compares
2. Synchronous and asynchronous enhanced modules
3. Streaming parallel port
4. 10-bit ADC module with up to 13-channel multiplexer.

This microcontroller has a USB2.0-compliant transceiver and a CPU running up to 12 MIPS.




Other Projects.

Avobe Schematic shows the circuit of the two-channel PC-based oscilloscope. MCP6S91 from Microchip Technology is an analogue programmable gain amplifier that is well suited to driving analogue-to-digital converters (ADCs) and an analogue input to a PIC microcontroller. Two MCP6S91 programmable gain amplifiers (IC4 and IC5) make it possible to choose the input ranges for each of the two channels, by selecting a gain from 1:1 to 32:1. The amplifiers are small, cheap and easy to use. A simple three-wire serial peripheral interface  (SPI) allows the PIC to control them through  pins 5, 6 and 7.

The MCP6S91 amplifier is designed with CMOS input devices. It is designed to not exhibit phase inversion when the input pins exceed the supply voltages. The maximum voltage that can be applied to the input pin is –0.3V (VSS) to +0.3V (VDD). Input voltages that exceed this absolute maximum rating can cause excessive current into or out of the input pins. Current beyond ±2 mA can cause reliability problems. Applications that exceed this rating must be externally limited with a resistor to the input pin.(pin 3), which is an analogue input, should be at a voltage between VSS and VDD. The voltage at this pin shifts the output voltage. The SPI interface inputs are chip-select (CS), serial input (SI) and serial clock (SCK). These are Schmitt-triggered, CMOS logic inputs.

     The only disadvantage is that these amplifiers accept only positive signals. That’s why voltage-shifting amplifiers LF353 (IC2A and IC3A) are used,one each for each channel input (see Fig. 1). The LF353 is a JFET input operational amplifier with an internally compensated input offset voltage. The JFET input device provides wide bandwidth, low input bias currents and offset currents. This voltage-shifting amplifier results in a high input impedance and an attenuation factor of 1:4.5. A ±16V input signal is then shifted to the0-5V range when the programmed gain is 1:1.

       Two halves of the LF353 (IC2B and IC3B) are used as voltage followers to provide a low-impedance shifting voltage (Vref) to the programmable amplifiers. This voltage must be precisely adjusted with two 4.7-kiloohm presets to measure precisely 2.5V level on the inputs of IC2 and IC3 when the input signals are grounded.

      Because LF353 opamps need a symmetrical supply voltage, a small DC-DC voltage converter ICL7660 (IC1) is used to feed –5V to LF353. With its small 8-pin DIP package, it needs only two polarised capacitors. ICL7660 can be replaced with a MAX1044. The MAX1044 and ICL7660 are monolithic, CMOS switched-capacitor voltage converters that invert, double, divide or multiply a positive input voltage.These are pin compatible with the industry-standard LTC1044

Overview of the universal serial bus 


All the data is transmitted on the D+/D- symmetrical pins using a variable bit rate. The position of a resistor (R13) on D+ or D- allows you to choose between the full-speed (12 Mbps) and lowspeed modes (1.5 Mbps). Note that the IC18F2550/2455 devices have built-in pull-up resistors designed to meet the requirements of low-speed and fullspeed speed USB. The UPUEN bit (UCFG=4) enables the internal pull-ups. In this project, R13 is not used. External pullup may also be used. The VUSB pin may be used to pull up D+ or D-. The pull-up resistor must be 1.5 kilo-ohms (±5%) as required by the USB specification

The PIC software

The program for the microcontroller is written in ‘C’ language. MPLAB 8.70 along with MPLAB_C18 is used as the software tool for development. The software tools can be downloaded for free from website ‘www.microchip.com.’ Based on Microchip’s application notes, the program for the chip is centered on a main loop continually polling the USB transceiver state. This loop never stops and each USB operation is done in one pass. All operations are initiated by the host (the PC), which ends a 16-byte command
The first command byte determines the chip actions. The four possible actions are:
1. Command 80h: Clears the EEPROM calibration memory
2. Command 81h: Receives parameters, and stores the gain-error compensation for the two channels.
3. Command 83h: Initiates a zero calibration sequence of the two chan The first command byte determines the chip actions. The four possible actions are:
4. Command 80h: Clears the EEPROM calibration memory
5. Command 81h: Receives parameters, and stores the gain-error compensation for the two channels.
6. Command 83h: Initiates a zero calibration sequence of the two channel.


Installation of the USB driver.
 1. If everything is fine, plug the oscilloscope with a USB cable to your PC (running Windows 98SE or higher version). A “new hardware detected–USB2-MiniOscilloscope”  dialogue box must immediately appear on the screen.
NOTE:- The driver for this oscilloscope is not for windows 7 or vista.

2. Now you can start the driver installation process. To download drive click here . The goal is to select a good driver (mchpusb.inf) by choosing the ‘specific location’ option. Don’t let Windows take a generic driver by default.

3.When you are done with installation, go to ‘device manager’ and check whether ‘USB2-MiniOscilloscope’ is under ‘other device’ in ‘view devices by type' option. Otherwise, repeat Steps 1 and 2.

User interface program and operations.
A user-interface software written in Visual Basic 6, called ‘OscilloPIC,’. You can download this sofware click here to download Run the set up program , This will automatically install the ‘OscilloPIC’ user-interface program.


application program looks like a small digital oscilloscope as shown in the screenshot below. Various settings for operations are given in the following menu bars:
1. Inputs: Selects the active channels
2. Sampling: Sets time-base and number of samples
3. Trigger: Sets the triggering condition
4. Cursors: Selects horizontal or vertical cursor positions
5. Num: Shows numerical  sampled values, with an export command (text file format)
6. Config: Configures gain and offset errors

Calibration is to be done as described below before reading the output signals on the monitor screen by clicking ‘channels calibration’ under ‘config’ menu bar. Feed the input waveforms (say, sine, rectangular, sawtooth, etc) from the source. Click ‘go’ button. The output waveform will be displayed on the monitor screen. Channel-1 and channel-2 output waveforms can be differentiated by screen and red lines, respectively. By default, the time base is 200 μs per division and amplitude is 4V per division. You can set these parameters as per your requirements.


Test and calibration



        The first step is to adjust the zero offset error. Connect the two analogue inputs to the ground level and tune the two 4.7- kilo-ohm presets until pin 2 of both MCP6S21 is at 2.5V. A more precise tuning can be achieved through ‘OscilloPIC’
software. Choose the smallest calibration value at ±0.5V for both the inputs.


           The ‘zero calibration’ command tells the PIC to start its own internal compensation for all calibrations. Don’t forget to  connect the inputs to the ground while calibrating.


       The second parameter to check is the gain error. By clicking the ‘gain calibration’ command, it’s possible to specify a small correction factor. This can be done after several measurements. You have to know the actual levels  sine and triangular waveforms and the measured levels (with the cursors) for the two channels. The gain error is less than 0.1 per cent. The number of samples can be set between ‘10’ and ‘500.’ The minimum sampling 10 μs for two channels.


Construction 

           assembly on a bread board.

          An actual-size, single-side PCB layout for the two-channel PC-based USB oscilloscope circuit is shown in Figure and its component layout . Since the circuit is compact, the construction is easy. 


          It is advised to use IC bases for mounting IC1 through IC7 on the PCB for easy troubleshooting. The USB connector (CON1) must be firmly soldered and fixed on the board. It is located on the extreme right of the board (refer Figure.). 





Two BNC connectors can be used for the input signals for channels ‘1’and ‘2,’ respectively. The connectors can be fixed on the front panel of the enclosure. The performance of the oscilloscope can be improved by changing the PIC and its ADC with a faster model. AD9238 (20 MS/s) is a good choice. This fast, parallel ADC converter could be used with a powerful DSP PIC.


DOWNLOAD Firmware and PC Software:-


Click here to Download PIC Firmware
Click here to Download PC Software  and Driver
Click here to Download PCB File 


NOTE:-  PCB file optimized for home made process That's why thread are so thick, if you want to PCB manufacture by professional the you can reduce the size further 


if somebody has any problem the please make a comment 

you may also like  30 volts Panel Volt Meter Using Pic mcu

105 comments:

  1. nice job. I was waiting for this.
    How much will cost for the components in india

    ReplyDelete
  2. hi Vanangamudi
    The total cost in Delhi is around 500 INR

    if any of these components are not available at your place you can ask me ..

    Thank you

    ReplyDelete
    Replies
    1. hi gaurav plz send me d coding of pc based oscillscope n tell me d location where i can get this ic

      Delete
    2. hey , thanks for schematic , but i cannot source the microcontroller and opamps , where can i find them in india .
      i live in remote city so it's impossible to find such devices .

      Delete
    3. thankyou for sharing ur project
      plz send me the coding
      my email is"sebinjames2000@gmail.com"

      Delete
  3. Hi and thanks for sharing your project!

    So the bandwith of this is about 10 kHz?

    Not to sound rude but then I think I'll be still using my soundcard for these jobs :P

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. could contact me? will like to know more about this oscilloscope of the sound card.

      contaco: Rubenebur_19@hotmail.com

      Delete
  4. Hi Pere

    Thanks for your comment

    This is not a professional thing, this is just to learn few working principals.

    with sound card what will be the max signal voltage??

    ReplyDelete
  5. can u plz give me microcontroller coding
    gurkirat1989@gmail.com

    ReplyDelete
    Replies
    1. hello , do u has the microcontroller coding of the page http://www.circuitvalley.com/2011/07/two-channel-pcbased-oscilloscope-usb.html?showComment=1343663658484#c759998961351208843
      please help me

      Delete
  6. hi bro do you have any link to buy mcp6s91 or is there any equvalent?

    ReplyDelete
  7. i get mcp6s91 from digikey

    i guess few of them are left in my stock....

    ReplyDelete
    Replies
    1. i need mcp6s91 can i get that from u

      Delete
    2. if you r from India then i can help you

      send me a mail at

      mailchaduarygaurav{at}gmail.com

      Delete
    3. i just sent a mail to you.plz help me with thiz its emergency

      Delete
  8. Cool project. Is it possible to get the C code you used to program the PIC?

    ReplyDelete
  9. can u plz upload the visual basic code

    ReplyDelete
  10. sir i have upgraded the avr usbasp with the help of ur given code(at89xx )series
    it could burn the at16,at32
    but it couldnt detect the at89c51,,
    will u pleaseee help me.

    ReplyDelete
  11. that would be great if you can mail codings...

    ReplyDelete
  12. kes.628@gmail.com

    ReplyDelete
  13. Hi!
    Is the VB6 source code available?
    Thank you.

    ReplyDelete
  14. HI FRIEND CAN I USE LM358 INSTEAD OF LF353 AND IS THERE ANY EQUIVALENT OF MCP6S91?

    ReplyDelete
    Replies
    1. LF353 is a jfet opamp it has very high input impedance , LM358 is general purpose opamp it will attenuate the signal a little bit .but you can use LM358 there is nothing so big to worry about
      MCP6S91 has no alternatives
      if you need some part then you can ask me i can help you send me email.

      Delete
  15. dausygbezz@gmail.com

    pls send the code

    ReplyDelete
    Replies
    1. salam, awak ade dapat code microcontroller x . bagi page nie
      http://www.circuitvalley.com/2011/07/two-channel-pcbased-oscilloscope-usb.html?showComment=1343663658484#c759998961351208843

      kalau dapat tolong bagi saya boleh kat email saya
      muhdnuraidil.ymail.com.

      Delete
  16. are the software can only run to the window xp & vista only. can't window 7 use the software. please replay ,,, because i am interesting

    ReplyDelete
  17. Hi, can you send to me the Vb6 program source file
    nonno.matrix@libero.it

    thank you

    ReplyDelete
  18. What is the highest voltage can be measured in this circuit, you could apply the AC voltage is 220 volts.

    ReplyDelete
  19. hi sir,
    this is kutumba rao from hyderabad, A.P. Pl, help me. i want PIC18F2550 PC based scope kit with software(GUI). pl send the price and payment method. E-mail:kbraochandu@gmail.com

    ReplyDelete
    Replies
    1. hi sir, i am try this project. but not working. pl, send the HEX file and GUI
      otherwise pl give me the working kit. pl, help me.

      Delete
    2. hi sir, i am doing hobby electronics, basically B.Tech ECE student. i con't purchase CRO. that's why i am impressing the project. there is no commercial activity. thank you for your supporting. pl give me the price detail of the kit.

      Delete
    3. hi sir, my requirement is ready made kit. it is not available, give me the one set of 1.PCB, 2.PIC18F2550[with code(hex file dump and tested ok)], 3.MCP6S91, 4.LF353. pl give me the price details and SBI bank A/C no. thank you your support.
      Pl, give me the your contact number cell/ telephone.

      Delete
  20. hello sir..i am a m.tech student..can i apply the same procedure of the above mentioned project for doing the 4 channel digital oscilloscope?if no,can you please help me out in doing this?

    ReplyDelete
    Replies
    1. hello Bhaswati

      sure you can modify the firmware code to work as 4 channels.
      but keep in mind that 18F2550 has limited speed of ADC ~200Ksps. and if you go for 4 channel with this limited speed then bandwidth of such scope will be ~5Khz and due to limited number of sample memory, number of samples also less.

      if you need any other information please let me know
      sure i can help you doing this.

      Delete
  21. sir can you please give your contact no so that i can contact you over phone

    ReplyDelete
    Replies
    1. i would prefer to communication via email , chat, skype you can find my email any where on the blog . please try to understand that i can't share my number.

      Delete
  22. its absolutely ok sir...but i didnt find ur email address..can u plz give ur email address..

    ReplyDelete
  23. Hello Mr.Gaurav
    Best wishes for you work. Sir, im doing my project based on msp430 Microcontroller in order to measure ECG signals. i designed the Visual basic program to get the ADC value from the serial port using microsoft visual basic 2008 express edition. it works nice. what i want is to create oscilloscope in order to display ECG waveform based on value received from the serial port.
    i want to create my own oscilloscope using Visual Basic. i have seen your work for displaying waveform.

    1. Please tell me that " how to create real time waveform graph using VB?
    2. Please tell me the simple sample program to create waveform graph
    3. There is no tool of waveform chart in this edition. how to add that tool to microsoft visual basic editor?

    ReplyDelete
  24. hello
    can i replace the mcp6s91 with another one
    plz give me example

    ReplyDelete
    Replies
    1. MCP6S91 is not directly replaceable from any other device, ofcourse there are lost of PGA available in the market but to use them you need a little change in the software too. and pinout may also be different.

      Delete
  25. Hello!

    Can you send me (or make public) the VB software?
    I'm student, and intrested in product, btw, I want to rewrite the software in C#.
    Mail: fazy@tmvp.hu

    Thanks:

    Peter

    ReplyDelete
  26. Hi Gaurav,

    I read your project of Two-Channel PC Based Oscilloscope USB. I have question below about this:

    Why you using MPLAB for coding?
    Are you aware of MikroC HID library if you aware than why not mikroc compiler?
    I am also capturing data from two analog channel of PIC18F4553 and further transferring data through USB to PC. Data transferring speed is too low that online I am not able to see data. What will be the problem kindly suggest?

    ReplyDelete
  27. Can you do x-y measurements (Lissajous mode)?

    ReplyDelete
  28. Hello Sir,
    can you give me the coding for this microcontroller .... email me rimza19@yahoo.com
    I will glad if you help me... ^^

    ReplyDelete
  29. hello sir i m in urgent need of this project. can i get it from u at the earliest.

    ReplyDelete
  30. Hi,
    nice project but there a problem while installing software it says it says version of tabcl32.ox is outdated and while doing setup it says runtime error setup not sucessfull can please send an email about this at Bedrockelectro@gmail.com

    ReplyDelete
  31. Dear Sir,
    can you give me the coding for this microcontroller .
    my email eiqa145@yahoo.com
    Thank you.

    ReplyDelete
  32. Hi,
    nice project but there a problem while installing software it says it says version of tabcl32.ox is outdated and while doing setup it says runtime error setup not sucessfull can please send an email about this

    omer113143@gmail.com

    ReplyDelete
  33. Thanks for the circuit and info! I'm trying to build it, but I'm having problems calibrating it. The voltage at pin 2 of the MCP6S21 ic's never changes even while I turn the trim pots. The voltage coming out of the pots does change though. Any suggestions as to how to begin debugging this? As far as I know, the circuit etched very well and I think that I have all of the components placed correctly. The computer recognizes the device and the drivers are installed.

    Thanks!

    ReplyDelete
    Replies
    1. Nevermind! I adjusted the voltage coming out of pin 7 on IC2b and IC3b to 2.5v and it seems to be working fine with that.

      Thanks!

      Delete
  34. Good day Sir,
    can you give me the coding for this microcontroller .
    my email cyrohn15@hotmail.com
    Thank you.

    ReplyDelete
  35. Sir please tell about the max. Frequency and voltage of oscilloscope

    ReplyDelete
  36. the visual basic code? please!
    ricardo@ridecom.com.br

    ReplyDelete
  37. It would nice if you give the whole thing as a kit !!!

    ReplyDelete
  38. This software not work windows 7. Pls give me driver for windows 7.

    ReplyDelete
  39. mcp6s91 this ic is not available
    if any mcp dealers please contact us or give your contact no
    roshan.p
    9895100277
    roshu1221@gmail.com

    ReplyDelete
  40. Sir will u please provide driver for win 7/win 8,
    I kindly request you to provide as soon as possible

    ReplyDelete
  41. how to increase the operating frequency greater than 10khz,,and what is the sampling rate to display 10khz signal,how much time it takes for conversion,,why this circuit operats only upto khz,,,,kindly reply me,,its urgent,,bcz am dng this as my main projectin BE final year.

    ReplyDelete
  42. Dear Sir,
    can you give me the coding for this PIC.
    my email prashantkhot90@gmail.com
    Thank you.

    ReplyDelete
  43. nice....i m waiting for this....is this working fine??

    ReplyDelete
  44. Can u send me schematic pdf on ermihirec@gmail.com..

    Thanx..

    ReplyDelete
  45. please tell me the alternative of mcp6s91 on proteous 8.0. OR any other softwere on which i can simulate this

    ReplyDelete
    Replies
    1. there is no direct alternative for MCP6S91 , you need to change source for that, you may try to develop or find online some where proteous model for this.

      Delete
    2. dear gaurav chaudhary please tel me the alternative model . i am try to finout alternative model of mcp6s91 from last 2 months but i am fail to findout .please help me .

      Delete
    3. i personally don't have any model for this device.
      for testing purpose only there may be many other methods that can be used.

      for example MCP6S91 is an opamp only with digitally selectable gain setting so you can make circuit which have same functionality ,although i won't recommend wasting time that.

      Delete
  46. If anybody need MCP6s91, contact me. I have ordered it and have 3 ic extra.
    Email: sadichha.kolwankar@gmail.com

    ReplyDelete
  47. can You help me - how to connect bnc connector? where holes for probe? - it is not marked.
    igorneuro@gmail.com

    ReplyDelete
  48. hi , someone to operated this scope usb

    ReplyDelete
  49. Sir can you please send me the code? Thank you.
    pradeepkumar3092@gmail.com

    ReplyDelete
  50. where are the capacitors for crystal? And 4 Mhz is not to be little?

    ReplyDelete
    Replies
    1. you can add two 22pf caps to the gnd if you like to have more stability.

      mcu got pll inside so 4Mhz will be multiplied to achieve correct USB frequency

      Delete
  51. This comment has been removed by the author.

    ReplyDelete
  52. Project doesnt work for me in windows 7 or xp.
    It gives message "OscilloPIC Board not found!"
    Can anyone give solution to this problem...
    :)

    ReplyDelete
  53. Driver will not work with win 7, the system use microchip USB stack somebody has to update the stack with newer one ‎, then it may work, u can use the circuit with virtual pc or something like that.

    First u need to confirm that the scope detected as a USB device in device manager.

    ReplyDelete
  54. feasible solution for windows 7
    http://www.microchip.com/forums/download.axd?file=0;836237

    ReplyDelete
  55. my device can be detect my pc but device not recognized showing in taskbar and also showing code 10 error...anybody help me URGENT PLZ....

    ReplyDelete
  56. Buenas tardes desde Venezuela, espero que todas y todos estén muy bien, me gustaría saber si alguien pudo hacer funcionar el kit, y hasta que voltajes se puede poner a trabajar, cuanto es el máximo voltaje pico a pico aceptable en cada canal?? les estoy agradecido desde ya, muchos saludos.

    ReplyDelete
  57. Hello, Could you please share the PCB layout in proteus, asrappa.h@gmail.com

    ReplyDelete
  58. Hola Mohamed, instala Eagle software y podras apreciar el pcb, alguien tendrá otro software para ver las graficas en la pc que este actualizada?

    ReplyDelete
  59. Hi Sir, can I know what software you used to open the PCB file? I am using Express PCB but I can't open the .pcb file provided by you.

    ReplyDelete
  60. can you please send me the coding to manishadhanwani71@gmail.com

    ReplyDelete
  61. HELLO! can you please send me the coding to nattan.gs@hotmail.com

    ReplyDelete
  62. HELLO! can you please send me the coding to nattan.gs@hotmail.com or natttan.gs@gmail.com

    ReplyDelete
  63. what would I have to do if I needed to increase the number of channels ? say to three or four channels, may be more

    ReplyDelete
    Replies
    1. to make this 4 channel you need to add necessary hardware , change firmware , software.
      sampling rate capability will be divided into 4 parts.

      Delete
  64. I'm not a good programmer and I'm not interested in the source code. I am interested in why in the circuit pin 7 of the processor is free, and on the PCB pin 7 is connected to +5 volts.
    Is this a mistake.
    If it is an error it may damage the processor.

    ReplyDelete
    Replies
    1. NO pin 7 of the mcu is not connected at all if you look closely at images , i have removed pin7 from socket. Actually i used this pin area to route 5V around the board. so schematic and pcb both are correct. pin 7 of the mcu is not used at all.

      Delete
  65. Hola, quisiera saber si cada vez que quiera ver alguna representación gráfica en el programa tengo que actualizar o refrescar para verlo o es una falla? por favor diganme si es asi o puedo ver en tiempo real las gráficas?

    ReplyDelete
  66. Hello, I would like to know if every time I want to see some graphic representation in the program I have to update or refresh to see it or is it a failure? please tell me if this is the case or can I see the graphics in real time?

    ReplyDelete
  67. and additionally contrasts in the expense and simple entry to systems, weaken this possibility to a more noteworthy or lesser degree. win USA

    ReplyDelete
  68. Can you please send me the hex file. ASAP uwaninduwara812@gmail.com

    ReplyDelete