This tutorial will show you how you can fix any PS3 controller for most problems.
This fixed my PS3 DualShock 3 which wasn't charging and fixed my PlayStation Move controller which was not functioning properly.
I got this guide from the PlayStation Forum by a user called UKVampire, but it was not so good so I've changed it, edited it and added stuff to the guide to be more user friendly and posted here.
1) Turn off the PS3 so that the PS3 power LED is in Red color. Put the back power button to OFF and unplug the PS3 from the power source.
2) Disconnect any devices connected to the USB ports, including the USB cables.
3) Reset the controller (Press the button inside the small hole between the L2 button and the big screw hole with a paperclip, pin or pen etc.).
|This reset controller image is from PlayStation Knowledge Center.|
4) Connect the controller with the Original Sony USB Cable(the one that comes with your PS3) to the PS3.
5) Plug the PS3 again to the power source and put the back button to ON.
6) Press the PS button on the controller.
7) Turn on the PS3 by pressing the front power button(near eject button).
8) Press PS button on the controller again.
9) The controller will be recognized as #1. (Keep pressing the PS button until you have it recognized.)
10) Don't press any buttons, just wait for at least 60 seconds.
11) Then press and hold the PS button until you see a menu with the text Controller #1 and Charging written on it.
12) Just wait until it says Charge complete.
13) Then unplug the USB cable from both sides.
14) Keep pressing the PS button until you have it recognized and then it should work properly.
If your controller is still not fixed, even after trying the above mentioned steps multiple times, try the official Sony steps.
Troubleshoot DUALSHOCK®3/SIXAXIS™ Controllers - PlayStation Knowledge Center
This should work for all PS3-compatible devices.