Relay for Arduino

Attached shows the various ways a relay module may have for controlling the coil current.
The left top & bottom use optocouplers that require the Arduino to either drive high or low to put current thru the LED to turn on the output stage.
The right top & bottom skip the opto; the Arduino either drives current into the NPN to turn it on directly, or drives the voltage high to turn on the MOSFET directly. A good design will have a resistor to Gnd to keep the MOSFET off when not connected, and a small resistor to limit Arduino current into the gate; the gate has an input capacitance that looks like a short to Gnd when switching states.