Dangerous Prototypes

Other projects => Past projects => CPLD programmable logic => Topic started by: sqkybeaver on October 16, 2011, 04:17:07 pm

Title: Re: Faster Digital Oscilloscope
Post by: sqkybeaver on October 16, 2011, 04:17:07 pm
as a general rule the sampling rate for a dso is usually 10x the analog bandwidth. for a 25MHz you would want at least 250Ms/s

there single chip adc that will run that fast. ex http://http://search.digikey.com/us/en/products/AD9481BSUZ-250/AD9481BSUZ-250-ND/996580 however if you want the total cost to to stay under $100 your out of luck.

2 channels adc + trigger + fpga + dsp + lcd

your already way over budget.

for 300 to 500 $ you can buy a scope with 100MHz bandwidth and 1Gs/s

that is about as good as you can get.

on the other hand a couple 555s and some opamps and comparators and you can turn a vga monitor into a simple analog scope.
Title: Re: Faster Digital Oscilloscope
Post by: ian on October 16, 2011, 06:20:56 pm
Check out our dso design. It uses a fpga plus flash adc and an analog front end for 60msps sampling.

For a stand alone like you describe, check out the DSo quad and dso nano from seeedstudiio studio and similar. It is 60 to 80 bucks.
Title: Re: Faster Digital Oscilloscope
Post by: arhi on October 16, 2011, 07:22:03 pm
There is a full schematic for the DSO QUAD available IIRC so you can get all the ideas they implemented there and reimplement on your own device. Also, even without source of the current fpga and arm platform, noone prevents you to write some from scratch.
Title: Re: Faster Digital Oscilloscope
Post by: sqkybeaver on October 16, 2011, 07:40:48 pm
[quote author="jason"]I'm not sure where you get your 10x "general rule" from[/quote]

the higher the multiple of sampling over analog bandwidth increases the accuracy of the displayed waveform.

[quote author="jason"]In order to prevent aliasing, we'll want to use a low pass filter to limit the bandwidth to less than one half of the sampling frequency.[/quote]

for a real time square wave at 10MHz sampling at 20MHz could look exactly like a 10MHz sine wave. even at 4x sampling a square wave could look like a sine wave.

aliasing can happen at nearly any sampling rate regardless of filtering.

these are some of the problems with a digital storage oscilloscope.
Title: Re: Faster Digital Oscilloscope
Post by: sqkybeaver on October 17, 2011, 12:47:50 am
[quote author="jason"][quote author="sqkybeaver"][quote author="jason"]I'm not sure where you get your 10x "general rule" from[/quote]

the higher the multiple of sampling over analog bandwidth increases the accuracy of the displayed waveform.
[/quote]

First, ask yourself why you would need more accuracy.  Consider the resolution of the screen you are displaying the waveform on and compare this to the dynamic range of an 8-bit A/D.  Now, unless you are using considerably more than 256 pixels in the vertical dimension, additional accuracy buys you nothing.[/quote]

in the case of additional accuracy in the time domain, even if you can't display 10k points horizontally, if you use an adc that compleates the sampling in 1[sub:]u[/sub:]S, there can be a rather large chunk of time where the signal may change in a manner that is invisible. oversampling can be used to determine if such changes happen(time-base set too low). it is trivial to throw away samples that are not used.

using a higher resolution ADC can give better noise reduction, allow you to adjust for any offset in the analog circuitry, have multiple voltage ranges available for a single gain in the analog front end.

the thing is there is no one way to do this, I just think it will be beyond the budget for a $100 device to have an 20MHz analog bandwidth with reasonable accuracy.
Title: Re: Faster Digital Oscilloscope
Post by: willemite on October 17, 2011, 12:54:44 am
perhaps something along the lines of the Flashy?  I can't post the link do to "spam filtering" so just google knjn and Flashy

I came across this a couple years back, just have not come up with an excuse to buy one. 200MSPS
Title: Re: Faster Digital Oscilloscope
Post by: sqkybeaver on October 17, 2011, 04:05:39 am
sure the math works, it has been proven

however actually sampling a square wave near the nyquist of that signal, will result in the misrepresenting of that signal as a sine wave.
this can be proven on any dso that will tell you the sampling rate. i have witnessed this many times.

the reason for the much higher sampling rate is fairly straight forward.
1. since there is no perfect low pas filter, a scope with a analog bandwidth of 10MHz will let a 50MHz signal signal past.(all though attenuated)
2. you may not be measuring a perfect sinusoidal signal, it could be a square wave.
3. you could be looking at a signal with the fundamental at sampling/2, but would want to look at components that are not reproducible because that portion of the cycle is much shorter than Nyquist would permit.

a sampling of a signal at an order of magnitude higher than the analog bandwidth, will ensure that the signals can be reproduced reliability.

Removing the fpga and high power processor and replacing them with a cpld and a dspic, the amount of work don in the fpga now has to be moved to the microcontroller because it surly cant fit in the cpld. how much math needs to be done?

lets say we are looking at a graph with 240x480 pixels. and a CPU speed of 40MIPS, for real-time sampling with 30 frame/second update rate, that would give us about 2.5k instructions to calculate the Y for each given X, this does not include the code for the user interface, retrieving the data from the ADC, triggering, time keeping, etc.

imho there is a reason there are no good high bandwidth/sampling microcontroller based oscilloscopes. but i would be interested in seeing how far you can push one of this type.
Title: Re: Faster Digital Oscilloscope
Post by: sqkybeaver on October 17, 2011, 04:41:22 am
the top picture is a 10MHz square wave sampled at 25MHz, and the bottom is the same signal sampled at 1GHz.

this is the reason that Nyquist is not good enough. the scope will think it is looking at something different.
Title: Re: Faster Digital Oscilloscope
Post by: sqkybeaver on October 17, 2011, 05:21:15 am
[quote author="jason"] the math shows us that any periodic signal can be separated into a sum of a series of sine waves at different frequencies and phases.  In the case of a true square wave, the series is infinite.[/quote]

unfortunately only sampling at only 2.5 times per cycle is not sufficient to reproduce a square wave or anything that is not sinusoidal.
Title: Re: Faster Digital Oscilloscope
Post by: sqkybeaver on October 17, 2011, 08:03:35 am
[quote author="jason"]However, you are incorrect in saying that sampling at 2.5 times per cycle is not sufficient to reproduce anything that is not sinusoidal.[/quote]

actually i'd bet farm on it!

have you actually sampled a square wave at ~2x the signal it self? weather a square or saw-tooth the same thing will happen.

for the purpose of a scope with a 40MHz sampling i would not trust it at all for any signal above 4MHz or so.

over all, if i was to buy a $150 scope that could only represent a sinusoidal at its advertised bandwidth, id send it back. i would rather have reasonable reproduction of any signal at the advertised bandwidth, that can not be expected with bandwidth and sampling at 18/40 respectively.

i believe that math at the heart of this conversation is only used to "fill-in the spaces between actual samples" when some limit has been reached in the hardware.(possibly zoom function)

[quote author="jason"]Notice that despite running at 1/2 your sampling rate, my square wave shows much less distortion.[/quote]
I am pretty sure that is all from the signal generator, i'd use a better one if i had one. however it proves that (semi)square waves have higher requirements than a pure sinusoidal waves. and thus making the ideal sampling rate much higher than 2x the max bandwidth for a dso.
Title: Re: Faster Digital Oscilloscope
Post by: sqkybeaver on October 17, 2011, 05:05:02 pm
perhaps you don't understand the point i am making.

lets assume a perfect analog front end. and we are well within its lower end.

if you are displaying an ideal square wave of 1KHz and you are sampling at 2.5K/s, and your timebase is set to 500uS/division. the basic math will tell you that there will only be 1.25 samples per division. this would be about 12 samples represented on the display, and about 5 cycles displayed at once, about as far as needed(in most cases) to view the wave form. most scopes will not let you zoom in that close unless you are using single shot capture.

please reconstruct the various waveforms you may encounter, near your maximum analog bandwidth, within an acceptable degree of accuracy(90%), tell me the number of samples per single cycle needed to reconstruct the following signals using only one formula.
10%pwm, square, triangle, saw-tooth and sine.

if your designing a scope where the ratio of bandwidth is only half of the max sampling, you will not get reasonable representation of a signal anywhere remotely close to the maximum bandwidth(save for a perfect sine). and i'm pretty sure that a majority of scope users will look at a waveform other than a perfect sine.

this is my case for having sampling at least 10x the analog bandwidth. and the point i was after to begin with.
Title: Re: Faster Digital Oscilloscope
Post by: Rubu on October 17, 2011, 05:44:33 pm
Interesting discussion going on here.
I think the most important thing when using a scope, is know what exactly you are measuring. In other words, when well aware of the limitations of your set up, even sampling at only 2.5x the base frequency might prove useful.
Naturally, when measuring a 10Khz square wave sampled at 25Khz, you're not going to see a square wave on your screen. However, this might still contain useful information to you, depending on what you want to 'learn'.

Anyway, I really like the idea presented in the topic start, curious to see if/where this will go!
Title: Re: Faster Digital Oscilloscope
Post by: sqkybeaver on October 17, 2011, 06:09:40 pm
[quote author="Rubu"]Interesting discussion going on here.
I think the most important thing when using a scope, is know what exactly you are measuring. In other words, when well aware of the limitations of your set up, even sampling at only 2.5x the base frequency might prove useful.
Naturally, when measuring a 10Khz square wave sampled at 25Khz, you're not going to see a square wave on your screen. However, this might still contain useful information to you, depending on what you want to 'learn'.[/quote]

over all i think the idea of a hobbyist scope, should take into account the fact that the user may not know about sampling requirements for various waveforms, aliasing, and distortion. that the more advanced scope users will recognize.

i'm not sure if DP will ever produce a scope past what has already been done, after all it is very complex to produce a good scope.
Title: Re: Faster Digital Oscilloscope
Post by: sqkybeaver on October 17, 2011, 06:34:52 pm
[quote author="jason"]This oversampling trick that Atten and perhaps Rigol are using is a double-edged sword.  Whilst it may allow you to see signals above the 3dB analog bandwidth of the scope, they will be distorted representations.  This is fine if you're dealing with sinusoidal signals and don't need to make accurate amplitude measurements, but otherwise it is going to lead to erroneous conclusions about the nature of the signals.  I suspect this is why it I haven't seen it on any of the Tektronix DSOs I've used.[/quote]

the oversampling actually refers to running the ADC that is rated at 40MHz at 100MHz, i think this was done to reduce cost.

I have recently been able to compare my $300 scope to a $30K scope and it is not as bad as I originally expected. while there are major differences, you also get what you pay for. complex waveforms up to about 55MHz are fairly accurate, for a 60MHz scope. since i don't use it for anything but simple projects, I don't mind it being a little off from time to time.

I think the major difference between your Tek and my elcheapo is just as you said related to how the adc are over-driven, but without knowing exactly how that specifically effects the signal, your guess is as good as mine.

The Atten scopes are nearly identical to the Rigol ones as far as components used. I would not be surprised if the Attens were a product of industrial espionage, or reverse engineering.
Title: Re: Faster Digital Oscilloscope
Post by: sqkybeaver on October 17, 2011, 06:56:35 pm
Jason,

I think we are on the same page, but may be getting to it from different directions.

If I was to build a scope for a hobbyist, I'd rate it for 10MHz, sample at 100+MHz, and low pass at 50MHz. this would be to give reasonable confidence in any signal up to 10MHz fundamental.

For a hobbyist the simpler rating may be helpful?

This conversation persuaded me to at least brush up an sampling theory.

[quote author="jason"]By the way, I paid about US$400 for my Tek TDS-360 -- only $100 more than your Atten. I got it used on eBay. Personally, I think you are going to get a lot more bang for your buck going this route than buying one of the Chinese scopes new.[/quote]
That was a great deal, i chose the atten because portability was a major factor right behind price.

[quote author="jason"]I would be surprised if they are overclocking the ADCs by much. I would expect it would cause them to produce erroneous results. What happens when you try to clock your 3GHz i7 at 6GHz?[/quote]

Dave's tear-down of the rigol proved they were over-clocking by 120%. I suspect that the silicon used in those ADCs can handle it well enough, they are fairly low clock-rates compared to what has been achieved with similar silicon.
Title: Re: Faster Digital Oscilloscope
Post by: sqkybeaver on October 17, 2011, 08:26:50 pm
for the PGA it is worth looking at the lineup from microchip, i think there is one avalable with a bandwidth of about 12MHz or so.
Title: Re: Faster Digital Oscilloscope
Post by: Rubu on October 17, 2011, 11:07:19 pm
QVGA screen + touchscreen doesn't have to be that expensive. I know sourcing from something like ebay is dangerous, but there are QVGA TFT's with touchscreen to be had for 20usd incl worldwide shipping and up.
Also, the LCD of the DSO Nano is listed on seeed for 20 usd, this is without a touchscreen though.

I'd love to help out where I can, definitely will be reading along. I have had university courses on analog and digital signal processing, but not much hands on experience.
Title: Re: Faster Digital Oscilloscope
Post by: sqkybeaver on October 17, 2011, 11:22:34 pm
i think the rigols use an AD9288 dual channel 40MHz 8bit adc at $9 each it is not bad. there are versions that will hit 100MHz too.
Title: Re: Faster Digital Oscilloscope
Post by: sqkybeaver on October 18, 2011, 03:51:10 pm
[quote author="jason"]I like the idea of using a touchscreen because it simplifies the design, and because none of the other hobbyist DSOs are doing it.[/quote]

if will be no buttons on the front, the screen can be bigger than the others, id suggest at least80x120mm little bigger than an iPhone maybe.

how big of a battery would be necessary to run it for 2 hours at max sampling?

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.01432143968session_write_close ( )...(null):0
20.01472275560ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.01472276336Database_MySQL->query( ).../DatabaseHandler.php:119
40.05862415072Database_MySQL->error( ).../Db-mysql.class.php:273