Erratic MOSFET

Hey everyone.

I'm having troubles with some mosfets I ordered, (4 * N-channel [30N06L], 4 * P-channel [27P06]).

When I first got them, every time you put voltage into a fet, it would randomly choose between turning a LED off, or slightly brighter (it was dim by default). Then after switching the fet (to another N-Channel), the gate wire stopped responding to the arduino (3.3v and 5v pins). However it would respond to the wires of battery; touching the positive turned it on (and it stayed on, even after removal), touching negative turned it off. I then uploaded the blink program, not surprisingly nothing happened. So I swapped drain and source around (I've read the datasheets, I know my original configuration was correct). Now, the led goes from dim to slightly brighter, every second, as the program specifies.
Here's a diagram:
http://imgur.com/KcyDc

Why is everything being so weird? And how come it only now faintly changes?
Thanks.

Are all your grounds tied together? If the MosFet circuit supply ground and the Arduino ground are not tied together (connected) your results will be unreliable. All grounds must be tied together unless you are using opto-couplers.

A mosfet gate has a high resistance and relatively high capacitance. If you leave the gate unconnected, it will be somewhat random how much it turns on. However, if you connect the gate terminal to the source terminal then it should turn off. If you connect the gate terminal of a N-channel logic level mosfet to +5v or more relative to the source terminal, then it should be fully on. For a logic level P-channel mosfet, you need to put -5v on the gate relative to the source to turn it fully on.

From your diagram, I see that the connection from Arduino ground to mosfet source terminal (battery -ve) is missing. That's why your circuit doesn't work properly.

Both those MOSFET types require 10V of gate drive, they won't work properly with 5V - they might turn on a little bit, but they won't do so reliably.

When looking for MOSFETs for direct drive from logic level (5V) signals, you must get logic-level MOSFETs. The key spec on the datasheet is the value of Vgs at which the Rds(on) is specified. "Rds(on) at Vgs=4.5V" is typically the specification to look for. 4.5V is used to allow for below-spec 5V supplies. If the only Rds(on) values are given for Vgs=10V, or if Vth is specified as "2--4V" then is NOT logic level.

Vth (threshold voltage) confuses a lot of newcomers - its the voltage at which the device switches OFF. For logic level devices it will typically be 0.5 to 1.0V or so.