Traditional relay drivers involve multiple discrete components to drive the relay and protect against damage to the microcontroller or other devices that can be caused by the voltage spike generated ...
Figure 1 A series diode protects systems from reverse polarity but wastes power in diode losses. Figure 2 You can use a bridge rectifier so that your system works no matter what the input polarity is.