Skip to main content
Topic: USB Scope (Read 19274 times) previous topic - next topic

USB Scope

disclaimer:
this project wont be done next week, nor even next month.
its a summer holiday project so i will seriously start with it after 4 juli when my 7 weeks of nothingness begins :D
i hope its OK to post a not done project, i will add stuff while making it so i end up with a good log of the whole project.

I want to make a USB scope, but you could have guessed that from the title.
I also want to make it quite cheap, I aim for 50 euro's to make one
as a school project we are already making a simple scope but its rather limited in speed and use, 1Msps is kinda slow :)
but we got the scope part working, only the software is left to do.
but 1Msps is really not useful, effective bandwidth for looking at a sine wave is maybe 50Khz.

Then i saw the scope project from DP(Dangerous Prototypes)
That looks a lot better, 50Msps means 3 to 5 MHz usefulness bandwidth for looking at sine waves.
But then its single channel, uses a Xilinx FPGA and a Picmicro for USB transfer.
Single channel is an easy fix, add another ADC.
I personally work with altera CPLD's so i wont use a Xilinx device and i will use a CPLD and not a FPGA.
As a CPLD is a lot smaller then a FPGA i will need to have a separate SRAM IC for buffering.
Not a real problem, 64 or 128K ram is less then 5 euro's, even 10nS speed SRAM.

I never used a Picmicro for USB transfer, i only used 16F 8 bits Picmicro's  until now.
I have used FTDI devices before, the normal FT232 but also the very fast FT2232H so USB transfer is not a problem.
I have some good experience with high speed analog design, tip for DP, even a 1pf capacity between the inputs of the ADC and the ground can be troublesome.
So removing a piece of the ground plane underneath the inputs of the ADC can help a lot for analog performance :)
All with all, in theory i should be able to make a scope, only the PC software is a bit hard for me.
The whole project will be open source so if someone else can help with the software it would be awesome.


Until now I only have design ideas on paper.
When my summer holiday starts I want to have a PCB design done so I can give Iteadstudio something to do :)
Design ideas:

2 ADC's, ADS830@ 50Mhz
2 speedy op-amps, TI has some nice ones for a low price
1 SRAM Buffer, 64KByte, at least 10ns speed
1 CPLD, EPM570 from altera, fast enough and because the SRAM is a separate IC its is probably big enough.
A CPLD doesn’t need a SRAM IC to load code from so CPLD + SRAM is a bit cheaper then an FPGA.
1 FT232 in bitbang mode for a max of 12Mbit USB transfer speed.
I could use a FT2232H but that one is double the price of a FT232
A better 5V and -5V power supply than the USB ones.

And thatch about it :)

Buffer chaos
well I need a buffer, 2 ADC's at 50Mhz create a 100MByte per sec dataflow and its madness to send that trough USB.
I normally get 10 to 12MByte with a FT2232H, 100Mbyte is USB3 range and roughly impossible to do as a student.

I will use a FT232R in bitbang mode, 4 I/O for data and 4 for handshaking/setting trigger/other stuff
at 12Mbit I will have ~750Kbyte per sec with 4 I/O ports.
With a 64K buffer it means I can send it trough USB more then 10 times per second.
Enough, not going to mess with that :)

but 64K buffer means 32K per channel.
At 50Mhz that’s just 640uS of data, seems really tiny right?
Now image you are looking at a 1Mhz sine-wave signal, one sine-wave is then 1uS
you can fit 640 whole sines in that buffer, more then enough it seems
now imagine looking at a 1Khz signal, that’s 1mS for one sine-wave
Now you can't even fit one sine-wave in the buffer, that’s bad!
The solution is simple, you can lower the speed of the ADC or lower the speed that the buffer saves the data.
Both solutions do the same, making the ADC run 100 times slower or just saving one in every 100 samples to the buffer, both ideas slow the whole thing down by 100 times.
When everything is slowed down 100 times you can fit 64mS in the 32K buffer, a lot better.
Then 1Khz isn’t a problem anymore.

Like I said in the top of this slightly to long post, this wont be done in a month.
I want to have it done in begin august when school starts again.
The whole project will be open source and if it actually works and people want it I might poke seeedstudio about selling them.

That’s it for today, when I have more info about anything related to this project I will make another massive post ;)
I will try to connect a ADS830 to a FT2232H directly next week, ADS @ 6 to 10Mhz so I don’t need any form of a buffer and see what happens.
Ideas, please share them :)

Rik

Re: USB Scope

Reply #1
I'll be really interested to see these parts of your project:
*Altera chip, I'd also like to port the Demon core to an Altera FPGA (not CPLD)
*FT2232H setup

Keep us updated :)
Got a question? Please ask in the forum for the fastest answers.

Re: USB Scope

Reply #2
well, i never used VHDL or Verilog, i use schematic entry mode >:)
i already made a fully working 4 bit ALU in Schematic entry mode so a scope is a new challenge.
with 570 logic cells i can add a fair amount of counters etc etc for SRAM control so i think it should work out fine.
i used the FT2232H before and i find it quite easy to use when i need lots of speed.
i made some documentation for school for it but i am afraid its in dutch, so posting it here wont be really helpful for most of you ;)
going to make a PCB for it tomorrow so i can connect an ADC to the FT2232H, parts will arrive monday i think.

Re: USB Scope

Reply #3
Wij spreken nederlands hier :) Grtz.

Schematic entry will become quite bulky for this design. I designed a simple LA in verilog for a 72macrocell CPLD. It is fairly well documented here:
http://dangerousprototypes.com/docs/Lul ... c_analyzer
Got a question? Please ask in the forum for the fastest answers.

Re: USB Scope

Reply #4
Here are some useful links if you want to build your own scope:

Re: USB Scope

Reply #5
about your original scope with 1MSPS you can easily get 400KHZ spectrum out of it, by using software, search the net about fast furier transform, oversampeling, and digital filtering.

By defiiniton any signal that is sampled at a freq. Fs can be reproduced fully up to the freq Fm = Fs/2 by simply adding a low pass filter with a freq max at Fm. of course you have to add a input fillter as well that cuts of any freq higher then Fm.

once the signal has been sampled and is in your computer you can reproduce it on the screen using varius digital filtering tehniques and fft.

here is an explanation without the math of how it works.

when you sample a signas with a maximum freq Fm with a freq Fs = Fm*2, the spectrum of the resulting signal is a copyied spectrum of the original and pasted all over the infinit spectrum at Fs intervals.
you get a signal that has the original signal at 0->Fm, at Fs->Fs+Fm, 2Fs->2Fs+Fm............*well actualy there is a neg. component but lets not get into it as it is not important. so to retrive the original all you have to do is cutt off all the higher componets then Fm. the cool par is that all this can be simulated in a computer.

in other words a signa with a spectrum od 0->4KHZ sampled at 8Ksps can be fully recoverd on the output be it a DAC circuit or the screen of a monitor, all the information about hte signa is inside those samples, in other words the resolution at witch you can display it on a monitor can theroeticly be infinite!
-even thoug you only get 2 samples per cycle of the original signal, you can show on your screen 1000 samples, per cycle.
Fs=FM*2 is the theretical margin, but since input filters can never be perfect, and if any component above Fm get trough they will generate error in the resulting signal so it is easier to use Fs = 2.5 * Fm, and a cheaper filter with a lower slope.
 -sorry if this was rant, but i thought all DSO and computer oscilator projects should know that they don't need 100 samples per cycle to show the signal properly on the screen. 3 is more then enough, 10 -15 is more then enough even for sqare waves!

PS. the input filter is a must, and in many ADC circuits the most expensive part of the circuit.
P.S.S that means that with a 50MSPS you can show 20 MHZ signals on your scope with ease.

full math and explanation can be fount at this sites
http://www2.tek.com/cmswpt/tidetails.lo ... 4295&lc=EN
near the bottom under
How Sin(x)/x Interpolation Works

http://www.johnloomis.org/ece561/notes/ ... nterp.html
http://health.tau.ac.il/Communication%2 ... nting.html

of coure all this is in Spectrum, and since only sine wawe have a single spectrum defining them the above is the sine wave cut off point, square waves have many harmonics and to display it as square would require a lot of them, so the freq of a well shown square wave will be lower than that of the sine wave, about 7 times for 4 harmonics to be shown.

this is an image of a 4 harmonic square wave
best regards FIlip.

Re: USB Scope

Reply #6
got one ADS working :)
had some free time and made a small PCB with a ADS830 and a fast opamp.
it works, didnt test anything special, 8 digital I/O's to a logic analyzer.
so i know how to connect the while stuff, next week more free time to make a full PCB :)
will post a picture tomorrow

Re: USB Scope

Reply #7
ADS830 with FT2232 is interesting. I can't wait to see where this goes.
Got a question? Please ask in the forum for the fastest answers.

Re: USB Scope

Reply #8
picture time:
http://http://img809.imageshack.us/img809/4682/dsc02169p.jpg
http://http://img121.imageshack.us/img121/2474/dsc02170y.jpg
BRC electronics is the name we use for our project group on school ;)
the PCB and soldering are ugly ugly ugly, we used the soldering over first but half the stuff didn't solder correctly so i redid every solder :(
this connects to my breadboard, from breadboard to FT2232 to PC.
6Mhz sample rate, actually works.
vb.net gets the data and puts it in a text file, text files goes in excel and i see some sine waves :)

Re: USB Scope

Reply #9
I got a block diagram.
look at it.
from the input there's a amplifier that amplifies the input 10 times and a resistor divider to divide the input by 100.
all selectable so you can amplify the input by 10 or divide it by 10 or 100 or just keep it this way.
http://http://img825.imageshack.us/img825/5711/blockdiagram.jpg
any ideas, please post them :)

Re: USB Scope

Reply #10
party time, analog inputstage done in multisim:
http://http://img148.imageshack.us/img148/2038/input.jpg
in 2 weeks i will have a new scope, 4 * 250Mhz analog tek, then i can build the input stage and verify it in real life.
for now i have to do with a multisim simulation but it looks promising.
i will need some bad-ass opamps to reach 10+ Mhz so i used virtual ones for now.
the 10X amplifier will be an LT6200-10, to make it easy i used the specs of an LT6200-10 for all the virtual opamps.
the buffer wil be something like an AD8065 (really low input current and fairly fast), the one for the offset something like an LT1222 (fast enough)
time to enter it in eagle together with the ADS830 and stuff.
i think that i will make 2 PCB's
one for analog and one for digital, analog one will have everything from input to ADC and the digital one will have the CPLD and FT(2)232

hope to hear some feedback :)

Re: USB Scope

Reply #11
Have you thought of using USB 3.0 instead of an on board memory chip?

USB 3.0 transievers are out there, and it should be able to easily transfer 200 msps at 8 bit values without any problem. Then you can store the data in RAM on the computer instead of the HDD by allocating say, a few Megabytes with malloc or something of the sort. No need to worry about storage capacity, since the limit is how much ram you have.

Just a thought there though, I never looked much more into it.

edit:
http://www.mouser.com/ProductDetail/Tex ... BVE2NM8%3d <-- ah there we go.

The board would obviously have to be at least a 4 layer board to accompany the 175pin BGA though.

Re: USB Scope

Reply #12
USB2 is high speed enough for me :)
the added price of a RAM IC is much much lower then a USB3.0 IC and 4 layer board.
and USB3 looks a lot harder then just using a FT2232, FTDI has drivers available and i already worked with a FT2232 before.
the FT2232 easily gets 10+ Mbyte per second, thats more then enough with 64K 16 bit RAM, tjhats just 128Kbyte of data.

Re: USB Scope

Reply #13
I wonder how much bandwidth can you get, sampling in real time, with the ADC connected directly to the FT2232, with a simple program displaying the info on the computer side...

since I dont have a real scope and I dont know how to program an CPLD or FPGA it would be a great project to me :D

Re: USB Scope

Reply #14
i had a testsetup like that, got me 6Msps of data, roughly 500Khz without Sin(x)/x Interpolation.
with Sin(x)/x Interpolation 2Mhz should be possible.
the downside is, as soon as you plug in an USb stick or external HDD and start copying things the bandwith from the FT2232 plummits.
USB printer and printing a big file does the same.