How to decide on sonar signal?
More often than not you send as narrow a square pulse as possible, be it sonar (the 'ping'), ultrasound or radar. You want to keep ON time to a minimum, and OFF time to a maximum value that accounts for maximum range to be measured, so you can switch to receive mode quickly. The return time gives you basic distance, and return echo's can establish an objects shape and size (sonar and radar). Sound travels at about 900 feet/second in open air, so 40KHZ ultrasound has a minimum distance of about 3cm. Long distance travel causes ultrasound to weaken and distort from echos and air density, so unlike radar it has a very limited range, about 30 to 100 feet. Arrays of ultrasound emitters can travel hundreds of feet, often used as animal repellers. Ultrasound ranging modules are available from many sources. Check out Mouser, Newark, Acroname, Arduino. Prices range from $18 to $45 USD. Combine these with an MPU or Arduino or Raspberry Pi and some software and you have a complete ultrasound ranger.