# how to use arduino to detect an 8Mhz ultrasonic pulse using piezo disc as receiver?

i need a code to detect an 8MHz ultrasonic pulse and show its properties eg wave pattern and amplitude on serial plotter( like an oscilloscope)

• Which Arduino do you think you want to use for this? Commented Nov 12, 2018 at 23:20
• I have arduino uno...do you think it'll work? Commented Nov 12, 2018 at 23:25

In a word: no.

Let's crunch some numbers... You want detail like an oscilloscope. Okay...

My scope is 50MHz bandwidth and runs at 1 giga samples per second.

Drop that down to 8MHz with the same kind of resolution, and you get (1,000,000,000 * (8/50)) = 160,000,000 samples per second.

That's 10 times more samples per second that the clock speed of the Arduino, and it takes at least 1664 clock cycles to take one sample.

So, no. You need a board with an ADC which can run in the hundreds of millions of samples per second. The Arduino can only run at just under 10 thousand samples per second.

A slight discrepancy.

Even the Arduino Due can only get as good as 1Msps. I have seen MCUs with 15Msps theoretical maximum, but for the kind of output you want you would need considerably more.

So no, there won't be a cheap development "Arduino-like" board around that will do what you want. There may be an expensive one with a very fast CPU, DSP, ultra-high-speed ADC, etc, but you won't be programming it with Arduino, and you most likely won't be able to afford it to just play with.

• Thanks for the info but what is the highest value of frequency that arduino can detect with its clock speed of 16Mhz? Commented Nov 13, 2018 at 9:27
• You can sample at a maximum of 9615 samples per second, so 4807.5Hz is the maximum frequency component you can recover. If you don't care about the shape of the signal you can turn it into a square wave and use digital inputs (such as the T1 input to Timer1) to measure the frequency, but that's all you'll get - the fundamental frequency. No shape, no amplitude, nothing - just the fundamental frequency. And 8MHz is the absolute top limit (F_OSC/2). Commented Nov 13, 2018 at 10:13