Looking for way to capture a 'window' of ADC values at high frequency #13169
-
I'm building a flash meter and have a nice fast light sensor (photodiode and transimpedence amp.) I want to find a way to monitor the ADC at as close to the 500ksps as I can get. A typical flash duration is about 1/1000th sec, with the quick ones being around 1/5000th sec. There are examples of how to do this in C, but given that my code is currently in upython, I'd like to know if there are any options I should pursue before switching to C. A viper emitter seems to get me to 160 ksps which might be fast enough. Anyway my question is: (How) can I sample the ADC at close to 500ksps? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
If flash duration is 1/5000th sec i.e. pulse corresponds to 5kHz frequency, then depending on how detailed you want to sample a pulse envelope then usually 5 to 10 x 5kHz = 25 to 50 kHz sampling should be OK, so "A viper emitter seems to get me to 160 ksps." will be enough But if you want "catch" typical optical pulse radiation (laser/ fast flash) is about 80 us with 4-6 us for rising slope then 160ksps will be slow for catching rising slope. |
Beta Was this translation helpful? Give feedback.
-
Hooray!
Fires up google Thanks |
Beta Was this translation helpful? Give feedback.
Allocate an array of sufficient size of 8bit or 16bit unsigned values. (import array)
Use register modification (datasheet) to:
It now spews out a continuous stream of ADC values via the FIFO.
Write a function (viper will do) which constantly checks the FIFO count, reads the values and puts'em into the (indexed) array.
That's basically it.
You'll have to think about trigger conditions, either at the beginning of after the measurement.
You'll also have to hope that a 2µs resolution is quick enough.
In case a pure digital (1/0) decision is enough, use the PIO instead. It'll…