I have a raspberry pi zero and a HC-SR505 (not 501, which apparently is what I should have bought). I'm a programmer, with only a little electronics from long ago, but some people suggest the it will not work, something about 3.3v vs 5v. Others say it will work. I don't want to waste my time, so I thought to ask someone here.
Well strangely, the adverts I have seen for this produce, such as this one suggest that it takes a 4.5-20Vdc supply voltage but that the output voltage is 3.3V high and 0.0V low.
If you want to be safe you could connect the device up to the RPi 5V supply and measure the voltage of the output under conditions where it is at a high logic. Having seen the schematics showing this device feeding the base of an NPN Common-Emitter transistor stage I think you could feed the output from this device through a 1K ohm resistor to the top most anode of a series of four 1N4148 diodes in series going down to ground via the bottom most cathode and then take the voltage (which will now be clamped to be no more than 4 x 0.7 Volts, i.e. 2.8V) via another resistor, say 10K ohms, to a GPIO pin set to be an input possibly with an internal pull-down. The levels concerned should be sufficient to now drive the RPi. Importantly this requires the sensor to be supplied from the RPi so that if the latter is powered down then so is the sensor.