DC Motor speed control

dc42:
Avoid IRL540, it's one of the more commonly available mosfets but not suitable for driving directly from an Arduino because it needs 10V gate drive.

Absolutely - its got truly awful specs (it is a decades-old design). For 8A you should choose a device with Rds(on) < 0.008 ohm (no heatsink), or < 0.05 ohms (moderate heat sink). The IRL540 has Rds(on) = 0.54 ohms and can only be used upto 1A with a heatsink.

Stick a 180 ohm resistor between the Arduino pin and the MOSFET gate, and a 10k resistor between MOSFET gate and source (source is connected to GND).