Go Down

Topic: 20 Mhz analog read (Read 1 time) previous topic - next topic

Hi all, I have been playing around with Arduinos for a while but still have a lot to learn and I could use some advice for my next project. I need a very high sample rate for an two analog read inputs, around 20 Mhz. Is this possible with an ATMega, or preferably an ATTiny85?

fungus

#1
Dec 28, 2012, 03:52 pm Last Edit: Dec 28, 2012, 04:41 pm by fungus Reason: 1

Hi all, I have been playing around with Arduinos for a while but still have a lot to learn and I could use some advice for my next project. I need a very high sample rate for an two analog read inputs, around 20 Mhz. Is this possible with an ATMega, or preferably an ATTiny85?


No. The maximum for AVR chips is about 1mHz.

Edit: That should be 1MHz (one megahertz)
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Graynomad

Not a chance in hell, even if you used a 20MHz external ADC the AVR isn't fast enough to read the data let alone do anything with it.

What is the application? Maybe there's a better way.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

I'm trying to measure the speed of a bullet. I will have two IR detectors at a known distance with IR LEDs on the other opposite side, the bullet will travel through and interrupt the light beam. Is there any way to measure this at that frequency? I am totally open to any options. Arduino is what I'm familiar with but I'm more than happy to research some other controllers if that is what I need to do.

robtillaart


if you can get a digital pulse from the detector it might work.

connect the 2 detectors to interrupts
take timestamp when changed

speed = distanceBetweenSensors/(time2-time1).

As the minimal speed difference with micros is 4 usec and assuming the 2 sensors are 1 meter apart, the detectable speed is 1M/4e-6sec = 0.25e6M/s = 250 KM.sec

given a bulletspeed of 1000M/sec you should get a time interval of about 1 millisec.

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

fungus


I'm trying to measure the speed of a bullet. I will have two IR detectors at a known distance with IR LEDs on the other opposite side, the bullet will travel through and interrupt the light beam. Is there any way to measure this at that frequency? I am totally open to any options. Arduino is what I'm familiar with but I'm more than happy to research some other controllers if that is what I need to do.


The Arduino hardware timers can copy the value of the clock to a 'capture' register when an digital pin changes state LOW/HIGH or via the analog comparator. The timers can count at full system clock speed which can be 20MHz.

Only 16-bit timers support this so you can't use a Tiny85, you'll need at least a Tiny84. Look at the section "Input Capture Unit" for the 16-bit timer in the datasheet.

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

AWOL

#6
Dec 28, 2012, 04:30 pm Last Edit: Dec 28, 2012, 04:36 pm by AWOL Reason: 1
Quote
No. The maximum for AVR chips is about 1mHz.

No, fungus, it is much higher than that.

@OP, an analogue read is not what you want.

Some back of a beer-mat calculations.
A bullet at Mach 1, or about 340ms-1, travels about one third of a millimetre in one microsecond.
An Arduino could execute up to 16 instructions in that time.

What are your accuracy constraints?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

fungus


Quote
No. The maximum for AVR chips is about 1mHz.

No, fungus, it is much higher than that.


I meant one Megahertz, obviously. One millihertz would be silly.... :)



No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

dhenry

Quote
Is this possible with an ATMega, or preferably an ATTiny85?


It i s entirely possible on a 200Mhz avr.



@OP, an analogue read is not what you want.

Some back of a beer-mat calculations.
A bullet at Mach 1, or about 340ms-1, travels about one third of a millimetre in one microsecond.
An Arduino could execute up to 16 instructions in that time.

What are your accuracy constraints?


It is going to be going a lot faster than that, the upper limit of speed is closer to 1200m/s, which I did a quick number crunch on and came up with about 1.2 mm traveled in a microsecond. The measure distance is going to be about 50mm. This would be about 800 instructions. However, the device will be used in varying light conditions so I am not sure a digital read will be accurate enough. I think I need to do some tests to see what kind of accuracy I get with a digital read, this project is still in the planning phase. I am worried, however, that I may need to do some comparisons of the sensor value and therefore a digital read won't suffice. The analog reads take about 100 microseconds. I'm afraid this may be too slow.


Quote
Is this possible with an ATMega, or preferably an ATTiny85?


It i s entirely possible on a 200Mhz avr.



That sounds pretty promising. My previous microcontroller experience is limited to Arduinos. Would that be programmed and implemented in a similar way, or do I have a lot of learning to do?

AWOL

I don't know why you're hanging onto analogue reads.
The bullet is either there or it isn't.
You'll almost certainly need some signal conditioning external to the processor, but taking this kind of stuff out of the lab isn't a good idea (it is, after all, packing a lot of punch, even if it is very light!).
I don't imagine commercial, enthusiast-grade chronos go this high, simply because such velocities are way out of the ordinary (about 50% greater than what you'd expect for a Barrett?)
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.


I don't know why you're hanging onto analogue reads.
The bullet is either there or it isn't.
You'll almost certainly need some signal conditioning external to the processor, but taking this kind of stuff out of the lab isn't a good idea (it is, after all, packing a lot of punch, even if it is very light!).
I don't imagine commercial, enthusiast-grade chronos go this high, simply because such velocities are way out of the ordinary (about 50% greater than what you'd expect for a Barrett?)


It is going to be used for .223 which is often shot around 1000 m/s. I have been using 1200 as for my calculations to make sure I will be able to measure even the fastest bullet. I am not married to analog read, but the device is going to be used in the field so I just want to make sure I can accurately sense the bullet. I think what are really need to do are some tests to see how easy it is to sense before I worry to much about input sample rates. Thanks everyone for all of your help!

robtillaart


I would increase the distance between the measurements from 50 mm to 500mm or even better 3 layers 0 - 500 - 1000.

With 3 times you can measure not only the speed but also the decrease in speed. which helps you to get the speed measurement itself more precise.


Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

fungus

#14
Dec 28, 2012, 06:33 pm Last Edit: Dec 28, 2012, 06:39 pm by fungus Reason: 1
I'm not sure a single LED will work. You'd have to aim very precisely...

I've seen gadgets like this on TV. I have no idea what sort of sensors they were using but they didn't seem to be aiming particularly accurately. It was just a square box they were firing through.

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Go Up