Primary Circuit (Coil Side)
...

If you are connecting a relay to a microprocessor, you need to pay attention to the amount of voltage and current needed to operate the coil on the primary side of the relay.

Typically, microprocessors pinouts output voltages between 3.3 to 5V and around 20 mA of max current per output pin (best case scenario).

For example, the relay used during the "Speed of Operation" section can work at 3 and 5V. At these voltages the minimum current to trigger the coil is 120 mA and 72 mA respectively.

Note:

A microprocessor will not be able to handle these currents. This is not a TTL friendly relay.

schematic_relay_up_not_recommended.png

Even if, the relay is TTL friendly and can provide the required voltage and current, you need to pay attention to something called back EMF. Back EMF can destroy your microprocessor or electronics around the relay. Avoid connecting the relay directly to the microprocessor pins without including an important component - a diode.

schematic_relay_up_recommended_1.png

If the relay needs more current to activate the coil than the microprocessor pinout can give, or the voltage is higher than 5V, we need to build a logic level driver to interface between the microprocessor and relay.

schematic_relay_up_recommended_2.png