How to measure output of the ultrasonic transducer using arduino uno

Hi i have found a test circuit for the ultrasonic transducer.How do I measure the output distance sensed by the ultrasonic transducer using my arduino uno r3?. Please help. Thanks in advance. :slight_smile: I have attached the test circuit.

Use the Ping library? Outputs a pulse, times how long for an echo to come back.

Thanks for the reply. I have connected the input to pin 11 and the output of op-amp to the pin 7. Is that connection right? This connection is giving me '0' at the output :(. And I will attach the code am using. Please help.

#include <Ping.h>

Ping ping = Ping(7);

void setup(){
Serial.begin(9600);
pinMode(11,OUTPUT);

}
void startTransducer() //generate 40khz signal on pin 11
{
TCCR2A = _BV(COM2A0) | _BV(WGM21) | _BV(WGM20);
TCCR2B = _BV(WGM22) | _BV(CS20);
OCR2A = B11000111; // 199, so timer2 counts from 0 to 199 (200 cycles at 16 MHz)
}

void stopTransducer() //stop the timer
{
TCCR2A = 0;
TCCR2B = 0; // I think this is all that is needed since setting the CS bits to zero stops the timer.
}

void loop(){
startTransducer();
ping.fire();
delayMicroseconds(400); // wait for 400 microseconds

Serial.print("Microseconds: ");
Serial.print(ping.microseconds());
Serial.print(" | Inches ");
Serial.print(ping.inches());
Serial.print(" | Centimeters: ");
Serial.print(ping.centimeters());
Serial.println();
stopTransducer();
}

Please help!!! I'm struck in this. Is there anything wrong in the way I posted? Sorry if I didn't follow any rule. Please help!!!