In this paper, the HC-SR04 ultrasonic ranging module is used to send out sound waves with a fixed frequency. The shape of the resonator cross-section is changed by moving the piston up and down. In the experiment, the foam ball is used to find the levitated positions in the resonant cavity of different shapes and explore the maximum object that could be levitated at the position. Secondly, the experiment uses COMSOL to simulate the sound field, which agrees well with the experimental results. On this basis, the software is used to simulate the sound potential well of different resonant cavities to find the best position that can control the levitated object. Ultimately the simulation results are verified by experiment, realizing the control of the levitated object.