I use one of the outputs of the Arduino for the Vin voltage and use a IRF2807 mosfet to turn on a piece of LED strip connected to an external 12V battery. I am not using a flywheel diode since the load is resistive.
Now some questions for the two resistors. Rin limits the inrush current to the gate. Since I don’t have an oscilloscope yet, I made a model of the circuit on LTSpice.
Indeed, in the model without an Rin there is a 40mA spike when the Vin (5VDC) is applied. This is close to the Arduino output pin limit, so using a resistor there is wise.
But what the heck does the Rgs do? Another schematic I found calls for a 1MΩ resistor there. But I tried the model with and without it and cannot see any difference.
Rgs is to ensure that the MOSFET stays off if the input isn’t connected, since it is basically a capacitor with very little leakage current (which is mostly due to external factors, so if there was enough leakage between the drain and gate pins, then it could turn on, which could be bad if it only partially turns on with a heavy load and is otherwise not heatsinked). It can be omitted if you are sure that the input is always active; in other words, not floating during power-up or other times (don’t know about Arduino, but many microcontrollers float their pins during reset).
Also, I noticed that the MOSFET you are using isn’t a logic level part, which means that 5 volts isn’t enough to reliably turn it on (it can still conduct lower currents, but with more “on” losses; how much current are you switching?). At 12 volts, you could use a lower voltage part, where logic-level FETs are more common, as well as available with lower “on” resistance; for example, I recently bought 100 of these, which I have used in 15 amp DC/DC converters with no heatsinking (these are SMT parts, but I soldered leads to them, with three of them stuck together along with a diode and capacitor in a module used as a synchronous output stage converting 12 volts to ~3 volts); these are also logic-level compatible (“on” resistance is still higher with 5 volts drive, but much lower than a similar non-logic-level FET).
For this application, you can probably eliminate Rin.
Rin slows the switching speed, which can otherwise be fast enough to generate RFI. But if all you are doing is switching the LEDs on/off infrequently, the switching speed is pretty much a non-issue.