How to read analog values with a rate of > 1 MHz?

Hi all,

For a project I need a high frequency (analog) measurement.
each microsecond (or faster) a signal needs to be evaluated;
It is either rising, falling or steady.
I need to know the time between a rising signal and a steady signal, resolution < 1 microsecond.

First bridge i’d like to cross is having a analog measurement below 1 mirco.
Thus far I’ve been able to reduce it from 110 mirco to 17 by changing the prescale to 16.

How do I increase the measurement rate further?

THanks,

detector.ino (444 Bytes)

Well - a little googling on "high speed arduino oscilloscope" found these two (among others) interesting links:

Maybe they'll help...?

You are already at the limit for the internal ADC in a 16MHz Atmega chip - according to the Atmel datasheets.

Maybe a Due would be suitable - but it is a 3.3v board.

Using a faster external ADC is possible - but where are you going to store all those samples?

...R

I think the name for what you want is a flash converter or maybe resistance ladder.
And you'll want something faster than an AVR to process the data.

Thanks for the help guys,

I do not need to store the data, the only info i need is the time it takes from the signal to switch between the rising state and the steady state.
Would a ATtiny 45 work as an external ADC, they can run at 64MHz.

As long as your MCU's digital input characteristics are suitable, you could connect the same signal to a digital pin to evaluate the time between a rising signal and a steady signal. This would be much faster. The ADC could still be used to read the signal's value if required.

dlloyd,

Could you elaborate a bit, i'm not sure i can follow you.

Mark

KingBee:
Would a ATtiny 45 work as an external ADC, they can run at 64MHz.

The data sheet says the top clock frequency is 10MHz where did you get 64MHz from?

I do not need to store the data, the only info i need is the time it takes from the signal to switch between the rising state and the steady state.

This is very unclear. Do you mean the rise time of the signal? That is often defined as the time the signal takes to go from 10% of steady state amplitude to 90% of steady state.

I'm not sure where i picked up the 64 MHz, can't seem to reproduce it at this time.

The signal I want to measure is the (characteristic) flyback signal of a coil. The signal first rises to a peak level (start timer),and then decays until it becomes steady again (end timer). Or if the signal drops below a certain threshold.

Use two comparators and a flip flop to get digital signals. Then use a high speed oscillator to count the clock pulses between those two events.
No arduino needed.

I strongly agree with @Grumpy_Mike

KingBee:
I need to know the time between a rising signal and a steady signal, resolution < 1 microsecond.

On a standard 16 MHz Arduino, that gives you 16 processor cycles to complete your task. Just this one line of code…

  analogRead(RxPin);

…is…

  da:	80 91 30 01 	lds	r24, 0x0130
  de:	0e 94 67 01 	call	0x2ce	; 0x2ce <analogRead>
...
 310:	08 95       	ret

2 + 4 + 4 = 10 clock cycles. That’s right. Just the function call itself is more than half of your cycle budget.

You may be able to get what you want but it will require carefully crafted assembly to ensure the time constraint is met.

The ATtiny85 has a PLL that runs at 64MHz. The CPU can use that as a clock source after being prescaled/4 (so, 16MHz). Timer1 can also be clocked from the PLL with a variety of prescalers, including /1 (so, 64MHz).

You don't need the PLL to speed up the ADC clock, though. The ADC (on other ATtinies as well as ATmega) has it's own clock which can be prescaled to various values separate from the CPU clock.

Could you elaborate a bit, i’m not sure i can follow you.

Perhaps you could use an interrupt pin.
The datasheet will specify the VIH and VIL levels.
VIH would be the peak level that triggers the interrupt and starts a timer (RISING interrupt).
VIL would signify that the signal is steady and stops the timer (FALLING interrupt).
The time would measure a significant portion of the signal, could scale this result to approximate other trigger levels.

Check the cycles to call the interrupt.

Less than 4 usec timing on Arduino takes loop counting or inline instruction sequences.
You can get sub-usec IIRC down to 4 cycles or so.

The ATtiny85 has a PLL that runs at 64MHz.

So it has, didn't know that.
However, it is only a Peripheral Clock Generation, the CPU will not run at that speed.

This thread could be of interest for information on high speed interrupts and timing.

Attached is an example of the signal I want to measure

You should be able to get accurate timing measurements with a logic analyzer that has adjustable trigger levels. The signal could be connected to 2 inputs, one input triggering on "rising edge" and the other at the required voltage level.

Also, this would be an easy task for a CPLD. You might be interested in this thread:
http://forum.arduino.cc/index.php/topic,120220.0.html

KingBee:
Attached is an example of the signal I want to measure

And do what with the measurements?