PING Ultrasonic sensor output

intel-fpgasensor

I'm new to the world of Digital Systems 😀 I want to know whether the output of the Ultrasonic range finder sensor is analog or digital, so I can connect it to Altera DE2 GPIO directly or I need an ADC?
Thanks in advance 🙂

Best Answer

The PING Ultrasonic Range sensor will emit a pulse on the 5V signal line that corresponds to the amount of time between emitting a 40kHz ultrasonic pulse and receiving the echo of that pulse. When the sensor emits the pulse, its 5V SIG line will be set to a logic high (5V), and when the echo is received, the line will go low again. Your goal is to measure how long the SIG line is high and perform a calculation to convert that time to distance.

You can connect it to your GPIO. There is no need for an ADC, because the sensor output is a digital signal. It will either be high or low. My HDL programming is a bit rusty so I won't try to give you a code sample, but essentially you need to create some logic that monitors the GPIO your sensor is connected to and measure the time between the signal going high and when it goes low again. Then, use the test data from the manual here to make the proper conversion from time to distance.

As was pointed out in the comments, you probably don't want to connect it directly to the GPIO. You may need to put some resistors in between the sensor and the GPIO, but the datasheet for your board or chip should tell you that.