How to Use Relays to Control Electronic Line-Voltage Circuits
In many electronics projects, you need to turn line-voltage powered circuits on and off using circuits that use low-voltage DC power supplies. For example, suppose you want to flash a 120 VAC flood lamp on and off at regular intervals. Relays to the rescue!
You could build a circuit to provide the necessary timing using a 555 timer integrated circuit (IC), but the 555 timer IC requires just a small DC power supply, in the range of 5 to 15 V. And the output current can't exceed 200 mA, not nearly enough to light a flood lamp. That is where the relay come in.
A relay is an electromechanical device that uses an electromagnet to open or close a switch. The circuit that powers the electromagnet’s coil is completely separate from the circuit that is switched on or off by the relay’s switch, so it's possible to use a relay whose coil requires just a few volts to turn a line voltage circuit on or off.
For this relay, the coil requires just 12 VDC to operate and pulls just 75 mA, well under the current limit that can be sourced by the 555 timer IC’s output pin. But the switch part of this relay can handle up to 10 A of current at 120 VAC, more than enough to illuminate a flood lamp.
The switch part of a relay is available in different configurations just like manual switches. The most common switch configuration is double pole, double throw (DPDT), which means that the relay actually controls two separate switches that operate together, and that each switch has both normally open and normally closed contacts.
Here is a schematic diagram for a simple circuit that uses a 9 VDC circuit with a handheld pushbutton to turn a 120 VAC lamp on and off. The relay in the circuit has a coil rated for 9 VDC and a switch rating of 10 A at 117 VAC. Thus, only 9 VDC passes through the handheld pushbutton. If the person holding the switch decides to take it apart, he or she won’t be exposed to dangerous voltage.
A more complicated circuit, in which a 555 timer IC controls a flood lamp via a relay is another option. Here, one end of the relay coil is connected to the 555 timer IC’s output pin (pin 3), and the other end is connected to ground. When the 555’s output switches on, the relay closes, and the flood lamp circuit is completed.
Note the diode that’s placed across the relay coil in this circuit. This diode is required to protect the 555 timer IC from any back-current that might be created within the relay’s coil when the coil is energized. Because of electromagnetic induction, relay coils are prone to this problem.
When the coil is energized, it creates a magnetic field that causes the relay’s switch contacts to move. However, this magnetic field has a subtle side effect. In the instant that the voltage on the coil goes from zero to the Vss supply voltage, the magnetic field surrounding the coil expands from nothing to its maximum strength.
During this expansion, the magnetic field is moving relative to the coil itself. Because of the principal of induction, this moving magnetic field induces a current in the coil itself, in the opposite direction as the current that is energizing the coil.
Depending on the circumstances, this back current can be powerful — powerful enough to overwhelm the output current coming from the 555 timer IC and possibly powerful enough to send current into the output pin, which can damage or destroy the 555 chip. D1 prevents this from happening by providing the equivalent of a short circuit across the coil for current flowing back toward the output pin.
Whenever you drive a relay from a circuit that has delicate components such as integrated circuits or transistors, you should always include a diode across the relay coil to prevent the relay from damaging your circuits.