Go Down

Topic: MHz Speed Analog Reading + High Quality 40kHz Square Wave (Read 2101 times) previous topic - next topic

Rigelation

Apr 21, 2012, 10:21 pm Last Edit: Apr 21, 2012, 11:22 pm by Rigelation Reason: 1
Hi folks!

I have an idea for an optical alignment tool that requires a high-resolution distance sensor. I thought that maybe I could achieve this with ultrasound transducers, by looking at the travel time from a sender to a receiver. The idea is really straightforward, but the catch is that I would need to be sampling a 40kHz sine wave at a minimum of 3MHz for the resolution required. I just peeked around a bit, and got the impression that the fastest the Arduino can sample an analog signal is about 10kHz. I don't actually need the data streaming or in real time--I just need to send a pulse, time that really precisely, then look at the reaction it creates in a receiver (sampled at 3MHz), and send all that data to my Arduino or computer for processing. I've included an extremely scientific diagram to show this in visual form:



Can I do this with some external components that buffer the data and send it to the Arduino at a speed it can handle? Are there other electronic solutions I should be considering entirely?
Aspiring Hobbyist!

AWOL

#1
Apr 21, 2012, 10:31 pm Last Edit: Apr 21, 2012, 10:32 pm by AWOL Reason: 1
10kHz is the limit with the Arduino unless you want to go off-piste, when higher speeds with lower resolutions are possible.
Comparators and zero-crossing detectors can be useful techniques for higher resolution ultrasonics, as can external high speed clocks.

Perhaps you should rethink your thread title?
"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.

Rigelation

Thanks AWOL--I just changed my title to make the analog read speed I'm looking for clearer. Off-piste has to do with changing the way the core clock frequency is divided, right? Can I get the three orders of magnitude increase I'm looking for by doing this? I don't need huge resolution on my reading (I think 8-bits would be plenty). I'm going to look up "comparators", "zero-crossing detectors" and external clocks now.
Aspiring Hobbyist!

AWOL

I'm still unclear where the clean 40MHz square wave comes in.
Is it something to do with the three orders of magnitude?
You divide the 40MHz by 1000?
"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.

Rigelation

#4
Apr 21, 2012, 11:08 pm Last Edit: Apr 21, 2012, 11:23 pm by Rigelation Reason: 1
I need a clean 40khz square wave to power the "sender" transducer. I had just assumed that I could do this by basically "blinking" one of my output pins at this frequency--but I realized earlier today that that didn't work at all. It looks like this might work: http://www.arduino.cc/playground/Code/Timer1 but I still need to try it.

I noticed that some other people were suggested somehow getting the PWM to do this. Regardless, I assume this is a pretty trivial task compared to the high speed analog reading, so what I'm really trying to get a pulse on here is whether there is some reasonable technique I can use to sample an input at that frequency.

The three orders of magnitude I was referring to was from 10kHZ (the fastest stock analog read speed of the Arduino) to ~3MHz (the speed I need to sample my signal at). I guess that's technically closer to two orders of magnitude, to be precise.
Aspiring Hobbyist!

el_supremo

Quote
I need a clean 40Mhz square wave to power the "sender" transducer

Even if an Arduino could generate a 40MHz square wave, "clean" or not, no ultrasonic transducer can respond to a frequency that high.

Quote
I don't need huge resolution on my reading (I think 8-bits would be plenty)

Could you at least try to make sense? Sampling a 40kHz sine wave at 40MHz or even 3MHz with 8-bit resolution is pointless.

Pete

AWOL

Quote
no ultrasonic transducer can respond to a frequency that high.

I think medical ultrasound goes up to around 20MHz, but you're unlikely to want to afford one of those.
"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.

Rigelation

Whoops, just a mistype there supremo--I meant a 40kHz square wave--like in the diagram. I can't believe I missed that in the title.
Aspiring Hobbyist!

Rigelation

I do stand by the 8-bit resolution being sufficient, though. My idea is to determine at what point the wave peaks, thus allowing me to be able to compare the peak of the square wave that created the sound to the peak of the corresponding sine wave in the receiver.

I've looked at the transducer receiver output on an oscilloscope, and it's a clean, symmetric sine wave, so I was thinking that I may even be able to deal with a lower sampling resolution (say 400kHz instead of 3MHz) if I could reconstruct the sine wave in code and calculate the location of the peak.
Aspiring Hobbyist!

CrossRoads

You are making things confusing by mixing 40 MegaHertz and 40 kiloHertz.
Arduino only runs at 16 MHz; sampling at 3 MHz is not possible without using an external highspeed ADC, and creating a 40 MHz source is also not possible without an external source.

This one might meet your needs
http://www.analog.com/static/imported-files/data_sheets/AD7276_7277_7278.pdf
if you run the SPI at a high rate.


Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

BenF


I thought that maybe I could achieve this with ultrasound transducers, by looking at the travel time from a sender to a receiver. The idea is really straightforward, but the catch is that I would need to be sampling a 40kHz sine wave at a minimum of 3MHz for the resolution required.

When working with ultrasound transducers, you need to amplify the received signal (using an op-amp) into the logic level range of your microcontroller/Arduino.  You can then sample the signal digitally (edge detect) at 16Mhz. Speed of sound through air is about 343m/s and the theoretical resolution is then in the low micrometer range (343m / 16e6). It is not practical to build a device with such accuracy for a number of reasons, but sub-centimeter is within reach after calibration.

liudr

How do you account for amplitude changing with distance?

BenF


How do you account for amplitude changing with distance?

You tune the amplifier so that at max range (minimum amplitude), your output is just above the digital-high threshold for your microcontroller. This set point wil be a trade off between range/sensitivity and noise immunity. Output swing will be limited by your choice of op-amp supply voltage.

AWOL

With phase comparison, I can see displacement measurement of ± 8mm or so with good accuracy (with proper temperature, humidity and pressure/altitude compensation), but with commonly available piezo ultrasonic transducers with their resonances, relying on absolute amplitude will be trick.
Or so I imagine.
"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.

Rigelation

Hmm, I'm going to need to get to more like .1mm or better for my application. The reason I thought this might be feasible (and I could just be missing some simple factor that I'm not aware of, like variable response time in the crystal or something) is that I want to send the data to a processor and actually figure out where the peak is--so the idea rests around having a high speed analog reading of the pulse from the transmitting transducer. Is this possible? What I'm basically looking for I guess is a high speed oscilloscope circuit or chip that can read these values and then get them to my arduino.
Aspiring Hobbyist!

Go Up