Building a PIC based oscilloscope

Status
Not open for further replies.

Speakerguy

Active Member
I know there are projects like this out there, but I would like to attempt my own.

I would like a high speed analog front end feeding an external ADC interfaced to a PIC via SPI, and PIC to PC via USB, and a Visual Basic or C# program written to display the data. This is somewhat of a big project, but I think I can pull it off given my past experience.

First question: What is the max transmission speed of an 18F series pic on the SPI bus? I can't seem to find it in the data sheet.
 
alright this might be way off but i imagine your best bet would be to find a REALLY old one and try to emulate what the components are doing. i think a CRT screen would be a must since the inputs would be so much easier
 
Max clock on the SPI for 18F2525 is Fosc/4 (or Tcy). Document is DS39626E-page 166.

If you have a different PIC family, search for SCK.
 
Mkay, so with a 40MHz xtal oscillator, anything more than 10Msps is definitely a waste. And I probably can't even come close to that when you consider overhead of the SPI and USB functions for two channels.

I essentially want two channels of data to the PIC as fast as it can go, and the PIC spitting it out over USB2.0 to the PC. Any idea what kind of sampling rate I would be looking at overall for a dual channel system?
 
SPI speed will be listed under Electrical Specifications, in the form of required delays.

Keep in mind a scope generally won't continuously dump data to the computer. This could exceed viewable speed. Instead, you have a triggering event, capture say 256 samples, and you may not begin capturing on the next triggerable event if it's too soon. But capture speed is still very important because that affects your max sampleable frequency. 100ksamp/sec would not correctly read components above 50khz (Nyquist rate).

Note that the 30F series has pretty high power consumption at high speeds, and it's not as fast as the lower power 33F. There's faster 33F devices up to 1.1Msamp/sec IIRC, and the processor's up to 40MIPs. You probably need a USB port for sure though. There's also the new PIC32 line, half the product tree has USB.
 
To see data prior to the trigger you must start sampling data at run and continuously sample up to and some distance past the trigger event.
 
Yes the simplest way to do it would be a dsPIC they have internal ADCs capable of 1000ksps and some even 2000ksps. An external SPI ADC would not provide much better because the SPI line will run at max 40Mhz for the high end dsPICs.So if the ADC takes 1 byte of data to get 1 sample you get 5000ksps.

For a real good scope a difrent method must be used.A ADC with parallel output (all high speed ADCs are like that for the obvius speed problems of SPI) and just connect its data lines to a RAM chip.Then there is a binary counter connected to the RAMs address bus and the clock line of the counter and ADC conected to a oscilator. So for evry pulse of the clock line 1 sample is stored in to the ram chip. With this method i guess up to 100Msps is posible. Also this would preferdaby be asembeld from SMD components on a well designed PCB because you are dealing with very high freqency signals.

As for the analog front end you should have a good modern opamp to amplify the signal so you can have a like 100mV and 10mV range and some kind or resistor divider cirucit to provide the ranges for voltages higher than 5V. Also you need to have a AC and DC setting where the AC has its 0V at acualy half of the supply voltage so the signals that go below 0 dont get cut off.

But for a start a dsPIC and its internal ADC should do.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…