Completely confused about MOSFETs

First off, let me start by saying I'm pretty new to electronics, and I could really use some help.

Here's what I'm trying to do. I want to control a 12V RGB LED strip with an arduino. Right now I'm focusing on just getting one of the color channels to work, expanding to all 3 colors should be trivial.
The LED strip has a common positive connection. I'm using a IRF510 mosfet.

Now I'm completely confused as to how I should wire the thing up. I connected a PWM pin of the arduino to the gate of the MOSFET and a pull-down resistor to ground. The positive lead of the LED strip is connected to the +V connection of the power supply. One of the color channels of the LED strip is connected to the source of the mosfet. The drain of the mosfet is connected to ground.
I also connected the ground of the arduino to the -V of the 12V power supply. (picture included as attachment, just imagine the single LED in the image is a LED strip)

When I do this, the LED strip lights up no matter what. Even if I disconnect the gate pin, the LED strip will still light up ... which confuses me to no end. How can current flow through the mosfet if there is no charge on the gate? No matter what I do I can't seem to get the thing to work like I want it to.

The drain has to be more positive than the source. You are conducting current through the Drain-Body diode.

jbaeten:
I'm using a IRF510 mosfet.

That is your first mistake. IRF510 is not a logic level mosfet. it is specified for 10V gate drive, and you are only giving it 5V. If you are lucky, it will work with 5V gate drive provided that the LED strip doesn't draw a lot of current.

jbaeten:
Now I'm completely confused as to how I should wire the thing up. I connected a PWM pin of the arduino to the gate of the MOSFET and a pull-down resistor to ground. The positive lead of the LED strip is connected to the +V connection of the power supply. One of the color channels of the LED strip is connected to the source of the mosfet. The drain of the mosfet is connected to ground.
I also connected the ground of the arduino to the -V of the 12V power supply. (picture included as attachment, just imagine the single LED in the image is a LED strip)

You need to swap the source and drain connections.

Thanks for the replies. I switched the drain and source connections, but it's still not working as I would expect.

The LED strip is now glowing very faintly and stays that way, it does not seem to matter if I put 0V or 5V on the gate of the mosfet. Even if I disconnect the PWM pin from the gate the LED strip glows faintly. Does the MOSFET allow a small amount of current to flow no matter what the charge on the gate pin is?

Sooo, I'm guessing that the MOSFET indeed doesn't turn fully ON with 5V. Which again has me confused a little. The LED strip should draw somewhere around 200mA-250mA per color channel, and if I look at the graphs in the IRF510 datasheet, 5V should be enough to allow that much current to flow. I agree that the IRF510 might be overkill for this application, but it should work, no?

Not driving the gate to saturation means your FET will act something like a voltage-controlled resistor. The more voltage, the less resistance. Don't do that unless you've calculated it to provide a certain resistance, and know it's doing what you think it's doing.

When you want to switch current, use a FET that has a low Rds(on) (the resistance between drain and source) specified at 5v on the gate. Vgs is NOT the spec you want. Look for something like: Rds(on): 20mOhm @ 5V. <---- you want that number (mOhm) to be close to insignificant. Resistance here means heat.

+5v to your LED's common anode, each cathode to its own current-limiting resistor (sized appropriately for the LED's forward voltage and current rating, but 470R is a reasonable starting point), the other end of that resistor to the drain pin of its own N-channel Logic-Level MOSFET, the source pin to ground. 10K resistor from ground to gate, 220R from gate to Arduino's PWM pin. You'll be solid then. 8)

jbaeten:
The LED strip is now glowing very faintly and stays that way, it does not seem to matter if I put 0V or 5V on the gate of the mosfet.

If the LED strip is glowing faintly when you have 0V on the mosfet gate (i.e. mosfet gate is connected to mosfet source), then there is something wrong with the mosfet or with your wiring.

dc42:

jbaeten:
The LED strip is now glowing very faintly and stays that way, it does not seem to matter if I put 0V or 5V on the gate of the mosfet.

If the LED strip is glowing faintly when you have 0V on the mosfet gate (i.e. mosfet gate is connected to mosfet source), then there is something wrong with the mosfet or with your wiring.

MOSFET gates may tend to float if they don't have a pull down resistor.