Problems using PING sensor with PWM on 2 motors

Hello,

I know this is an old post, but I was wondering if someone could help me out with a similar issue. I am using the Arduino mega 2560 I have two 5v dc motors hooked to a motor driver, and one ping sensor. What I want to do is power the ping sensor and motors independently. Right now they are all hooked up to the 5v on the Arduino board. Could you tell me the proper way to set up the power input. I have the option of either 9v or using a combination of double A's.