Sound pulses gets reflected from hard surfaces. The SR04 distance sensor has two 40 KHz Piezo discs on it. One Transmits and the other receives. The circuitry os powered by 5 volts. Giving a pulse on the trigger input sends a packet of ultrasound pulses and the Echo output is asserted when the reflected pulse is received.
The time interval between the Trigger and Echo are measured. Assuming the speed of sound in air, the distance to the reflecting surface can be calculated.
The distance is continuously measured and plotted. From the “Record Data” tab, distance can be measured for a given time interval.