I had a little trouble figuring this out, so I wanted to help anyone else having a hard time. There have been a couple ways I've seen it work, the first I came across was MotioninJoy. This works for some friends of mine, but sadly I had to look elsewhere to establish a connection between my controller and computer.
After much searching I came across an alternative.
Everything you need is here.
Install libusb and then plug your controller in. After this, run ps3sixaxis_en. It will open and close. Now it should work! If it still doesn't, do what I do and run ps3sixaxis_en three or for times while pressing the PS home button as many times as you can while it's up.
Happy gaming! I enjoy using my Playstation controller to play a lot of games on my computer. Figured it was going to be a lot cheaper than buying a PC gamepad, especially since I have a few of these laying around all the time.