Pages: [1] 2   Go Down
Author Topic: 20 Mhz analog read  (Read 1438 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5638
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
« Last Edit: December 28, 2012, 10:41:14 am by fungus » Logged

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

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8589
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 221
Posts: 13848
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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.

Logged

Rob Tillaart

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

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5638
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

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

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26485
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
« Last Edit: December 28, 2012, 10:36:23 am by AWOL » Logged

"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.

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5638
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.... smiley



Logged

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

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

It i s entirely possible on a 200Mhz avr.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


@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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26485
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

"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.

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 221
Posts: 13848
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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.


Logged

Rob Tillaart

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

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5638
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

« Last Edit: December 28, 2012, 12:39:20 pm by fungus » Logged

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

Pages: [1] 2   Go Up
Jump to: