High speed sampling technique

edmunds

Senior Member
Dear MFB,

This might be very interesting for raw pic, but I'm wondering if the idea is relevant for picaxe. If I understand the idea correctly, then instead of the adc reads that allow up to 60k such reads per second, you could use the comparator, which is much faster. Even having to "try" where the comparator threshold is, this still comes out faster than ADC if the resolution needed is not very high. Rates of up to 1Mbps are quoted in the article.

I'm thinking if you would ever get up to speeds where you would run out of raw pic adc sample rate before you have run out of time executing picaxe basic interpreter code.

Just my 2 cents :).


Best regards,

Edmunds
 
Last edited:

MFB

Senior Member
I agree that the technique is not directly relevant to a PICAXE but thought it was a good introduction to sampling repetitive waveforms, which is commonly used by microcontroller based 'high speed' scopes.
 

eggdweather

Senior Member
It is interesting that the technique proposed (effectively quantisation) is to periodically sample a waveform based on the assumption that the waveform is repetitive, that is it is not a square wave then a triangle then sine, i.e. it is always some regular form and from relatively slow (within a PICAXE capability) samples a representation of the waveform can be established and then analysed. Seems plausible for the PICAXE to do this within its expected usage range and to note the paper suggests using a slow sampling technique. So I think for educational purposes, a PICAXE would be perfect as the programming is easy (removes an unnecessary burden to learning about quantisation) allowing the students to concentrate on the principles and to experiment with the theory.
 

Goeytex

Senior Member
From the Author:

To capture a waveform, the PWM D/A converter (PWM DAC) is set to its maximum output voltage. Then, using timing loops to generate regularly spaced sampling times (1 µs in Figure 1), the microcontroller looks at the output of the voltage comparator to determine if the incoming voltage is higher than the PWM voltage. At each sampling time, if the PWM voltage is at a higher voltage than that of the incoming waveform, the PWM value is stored in a RAM array location corresponding to that sampling time.
IMO This would be impractical with a Picaxe as the sample rate (READAC > Write to Ram > Change PWM > Repeat) would be painfully slow. It would also be difficult to utilize enough RAM to acquire an adequate number of samples for meaningful data.

This method is meant for compiled code where MIPS are high, adequate RAM is available, and the compiler supports large arrays.

Still an interesting concept though.
 

eggdweather

Senior Member
It is a very interesting concept, I think for educational purposes, there I no reason why the waveform cannot be very low, perhaps 1Hz, as it will still demonstrate the theory, although take longer, but relatively not that long. I'm thinking students learning about such theories, getting a trial setup quickly and not worrying too much about high speed sampling techniques or circuits or programming, for which the PICAXE feels like a perfect tool.
 

womai

Senior Member
Equivalent time sampling (i.e. capturing one or a few samples at a time, assuming the incoming waveform ist repetitive) is indeed a very useful method. My own oscilloscope creations (including the OSC001 PCB scope sold by RevEd) use this method to provide timing resolutions beyond the raw capturing speed of the PIC microcontrollers I employ.

Years ago I tried to use this to build a simple oscilloscope based on the Picaxe. Unfortunately success was very limited - due to the interpreted nature of the Picaxe Basic (and things going on beyond the user's contol), especially the fact that the Picaxe interrupts are polled by software rather than being true hardware interrupts, timing between repeats varied far too much. For the method to work it is important that not only the incoming signal is perfectly repetitive in time, but also the sampling timing has to have highly repetitive and well controllable timing. The latter is not the case with the Picaxe.

The concept itself can of course be demonstrated on a Picaxe and does work, but only for input signals up to maybe < 100 Hz - beyond that the timing jitter of the Picaxe interrupts becomes visible.
 
Last edited:

MFB

Senior Member
Thanks for sharing your practical experience of sampling repetitive waveforms. My motive for highlighting the article was that it was a very well written introduction to the technique.
 
Top