I wouldn't have too much faith in a homemade ultrasonic sensor, but I don't think it's necessary in this case.
If your shelves are not too heavy, you could use plastic anchors to mount the shelf brackets. These only require a small hole that will barely extend through the tile and the finish wall under the tile. You just have to be very careful when drilling not to overdrill into the wall void, where you might hit a pipe. Just keep in mind that with these anchors the tile will be carrying some of the weight, and you don't want to damage a tile, so don't try to use these unless the shelves are quite small and light.
If you have to support heavier shelves, I'd use toggles, and in this case you'll definitely want the new / improved type toggle rather than the old fashioned type.
Again you'll want to be careful not to drill past the wall into the void. You can use screws shorter than the ones that come with the anchors if there are any obstructions beyond the anchor.
If you have the bad luck to land directly on an obstruction, without even enough room to expand the anchor - not likely, but not impossible - you may have to repair a small hole in the tile.