Note: This is not for beginners and your device needs to be rooted!
This will not work with every Android device out there. The PS3 controller uses a specific type of Bluetooth protocol which not all Android devices have. To get this specific Bluetooth protocol I suggest installing CyanogenMod which has the protocol.
You can use Sixaxis Compatibility Checker to check if your device has the protocol.
Once you know your device is compatible you will need to download a program for your Windows PC called the Sixaxis Pairing Tool to pair your device properly with the controller. Once it has installed you should see a window that has a line which says "Current Master: Searching".
Now you have to connect your PS3 controller to your PC through the USB cable. Then the window on your PC should show a code in this format "xx:xx:xx:xx:xx:xx". This is the Bluetooth address of the controller.
You then need to find the Bluetooth address of your Android device. This can be find within the "Sixaxis Controller" app. At the bottom you should see "Local Bluetooth Address". The address then has to be entered into the PC program. Once entered, click on "Update".
Disconnect the PS3 controller from the PC and then press the PS button, the button in the middle of the controller. If you carried out the procedure correctly the PS3 controller should now be paired with your Android device.
Then tap on "Change Input Method" from within the app and select the controller.
This is an absolute dime for those who love playing their emulators. Using the virtual buttons on your Android device just does not do the emulators justice and doesn't feel natural. With this tutorial you can play your emulators the way they were supposed to be played.