How does a ultrasonic sensor work?
The ultrasound is generated with a piezo element. The ultrasound wave hits a medium and gets reflected. Ultrasonic sensors operate with a frequency up to 500 KHz.
The echo hits the piezo element. Distance to the object can be calculated by measuring the time between emission and echo.
For more details follow this link