I know how to do it because I use a ps3 controller myself.
But I'll tell you right now.. it's really a pain in the ass the do it.
You need your ps3 controller and the usb cable you use to charge your controller on the ps3.
Then you need to do this tutorial:http://www.youtube.com/watch?feature=iv&v=33WA-qsm2eI&annotation_id=annotation_47629
Apparently this video is updated and it's less of a hassle to do it now. When I did it it was really hard and now my pc is always in testmode, but it DID work :P.
I hope this works for you, good luck!