I remember the first time I had to deal with a faulty relay. My garage door opener had stopped working, and my kids were tired of going out in the rain to open the garage door manually (it’s my job as the dad to control the car). It turned out that our 20-year-old opener had a bad relay.
But what the heck is a relay? How do they work? Why do you need one? Yes, I am going to answer these questions for you.
It appears that the first relays were created for the telegraph system. A telegraph is a fairly simple technology. Essentially, it’s a battery and a switch on one end and an electromagnet on the other end. When a human presses the switch at the transmitting side of the telegraph, electric current runs down a wire and activates an electromagnetic switch on the receiving side to produce a “click.” These clicks can then be timed to generate a pattern that can be mapped to letters—you know this as Morse Code.
But there’s a problem. If you have wires that are too long, you don’t get a signal on the receiving end. With long wires you can get significant resistance such that the current is too small to activate the electromagnet. This is where the relay comes into play. It was essentially a remote battery with its own receiver and switch so that it could re-send the signal.
That’s where these relays come from, but that’s not really how they are used today. Oh, you live in an apartment and don’t have a garage door opener? Well, do you have a refrigerator? What about a microwave? Or an oven? Do you have a television? Just about any home appliance or electrical device is going to have a relay in it. They are everywhere.
In short, a relay is an electronic switch that is controlled by a smaller electric current. How about a simple example showing a relay in use. Suppose you want to turn on this very bright light that uses 5 amps of current. Here is how you could turn that on with a relay.
Using this relay, you don’t have to have a huge current going through both your low-power thingy and your high-power lightbulb. But what the heck is inside that box? How about we just break one of these suckers open.
The key thing in this relay is an electromagnet—it’s that coil of wire that you can see in the picture above. When a low current is run through this coil of wire, it makes a magnetic field. The magnetic field pulls the movable arm above it so that the arm makes a connection between the two high-current arms (also shown).
But wait! I feel like you can’t completely understand a relay until you build one yourself. So, that’s exactly what I did. Here is how mine turned out.
This is a simpler version of a real relay, so let me go over some of the important aspects.
- There is a D-cell battery that turns the relay “on.”
- This D-cell is connected to a small on-off switch that I made out of two paper clips.
- The current from this small battery then goes to a wire wrapped around a nail and back to the battery.
- On the high-current side, there is a power supply (you can’t see it) that goes to another paper clip near the head of the nail.
- When the electromagnet is turned on, this paper clip is attracted to the head of the nail and completes a circuit.
- So the high current goes through the movable paper clip, through the nail, and then through the lightbulb.
- The end.
Just to prove that it works, this is what it looks like.
Boom. It works. Just to be clear—I also measured the current going through the lightbulb. It was 1.84 amps. That’s a fairly large current to run through my little paper clip switch. You almost have to run this through a relay rather than a straight switch-controlled light. Also, if I wanted to use some microcontroller (like an Arduino or Raspberry Pi) to turn this light on and off, the controller only needs a small output current rather than almost 2 amps.
In the case of my garage door opener, the relay allows the control board to send a small current that turns on the very high-current electric motor to open the door.
That’s why you need a relay.