20 Mhz analog read

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?

loveforvdubs: 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)

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

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.

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.

loveforvdubs: 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. 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?

AWOL:

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.... :)

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

It i s entirely possible on a 200Mhz avr.

AWOL:
@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.

dhenry:

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?

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?)

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?)

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!

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.

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.

You can use foil detectors - two layers of foil stretched across a few mm apart, bullet shorts them together at the point it touches the second layer. If its a metal projectile (which as 1200m/s it is likely to be).

A friend of mine a long time back used to do physics experiments with a hydrogen gas gun, I think they just used the high speed cameras to get the velocity data, but I believe it was good for firing a tiny water drop at 5000m/s (which could then cut into a diamond surface!). Hydrogen gas gun fires soft metal pellet into a tny hardened metal funnel with drop of water in it - water accelerated to many times the pellet speed.

I just tested a quick piece and I could measure down to 15us accurately. That translates to about 18mm at 1200/s, not much longer than most bullets I think.

So it sure works.

I can now generate two discrete pulses 10us apart and the code continues to work.

dhenry: I just tested a quick piece and I could measure down to 15us accurately. That translates to about 18mm at 1200/s, not much longer than most bullets I think.

So it sure works.

That's great! My planned measure distance is about 50 mm.