Copyright 2001 R.G. Keen. All rights reserved. No permission for local copies or for presentation from any web site other than http://www.geofex.com.
Relays are some of the oldest switching parts available, but they are misunderstood by many audio hackers. Here's a run down on the basics and how to apply them.
Relays are electro-magnetically activated switches. Literally, there is an electromagnet inside the relay, and energizing that electromagnet causes the switch to change position by pulling the movable parts of the switch mechanism to a different position. To the greatest extent possible, the electromagnet is made to be electrically isolated from the signal path.
There are two main classes of relays - latching and non-latching. Non-latching relays are the simplest kind.
In a non-latching relay, the electromagnet pulls on a switch that is spring-loaded to one side, which is called the "normal" or "reset" side. Whenever the electromagnet's coil carries enough current (called the pull-in current), it makes enough ampere-turns of magnetic force to pull the switch to the "energized" or "set" position. The switch stays in the energized position as long as the current in the coil is enough to make the electromagnet overcome the force of the spring. As soon as the current drops below the holding current, the spring pulls the switch back to the non-energized condition. Because of the way magnetic attraction works, it takes less magnetic force - and therefore less current in the coil - to hold the relay set than it did to move it there in the first place, so the holding current is less than the pull-in current.
The nonlatching relay is shown schematically in the upper left hand corner of the "Relay Basics" illustration. The switch portion of the basic SPDT relay is shown as a switch that consists of a pole which can be switched to one of two throws. The throw that the pole connects to when no current flows in the coil is called the normally closed (NC) throw. The normally open (NO) contact is - well, normally open. A spring holds the switch in this position. The pole and throws are the only signal connections on the relay. The coil is only used to control the relay, not to conduct signal currents.
If you think of the coil and the iron core it is wound on as the electromagnet, and imagine that the swinging arm of the switch is also made of iron, you can see that when the coil is energized, the electromagnet develops enough magnetic pull to make the moving arm plop over into the energized position against the spring's pull. When the switch opens and the coil current drops, the spring pulls the swinging arm back. This is a very simplified view, of course. There may be many SPDT sections within one relay, or there may be only one NO or only one NC switch section. The basics are that the electromagnet pulls the switch to a new position.
On the right hand side of "Relay Basics", we see the other major kind of relay, the latching relay. If we have no spring, but make the swinging arm a magnet (indicated by the n and s poles), then the swinging arm will be made to be attracted to the closest of the two iron coil cores. It will stay in that position forever unless something makes it move. We can make it move by briefly connecting the switch and battery to make the two electromagnets energize in a way that repels the magnet in the swing arm away from its current position. If the polarity of the battery is such that the iron core attracts the swinging arm, the arm stays right where it is and nothing happens. Only if the polarity of the battery is such that the iron core repels the swinging arm, and the other iron core attracts the swinging arm, will the swinging arm will flip to the other side and stay there. By proper winding and connections, this forms a magnetically latching relay. This particular kind is called a "single coil" latching relay. You make it change states by putting a reverse pulse into the single coil. To flip it back, you have to invert the coil polarities again.
Notice that there is no "normal" position on a latching relay. The relay is just as happy staying in one position as the other
There is another way to make a magnetically latching relay. If we have two separate coils as in the sketch in the lower right, it's sufficient to just repel the swinging arm away from its rest position, and let its natural magnetic attraction to the non-energized coil pull it into the new position. It will stay there until we make the new rest position core repel it. This two-coil magnetically latched relay can have both coils attached to the same battery supply, and the relay will flip positions if we energize the two coils alternately with one switch. The single coil magnetic latching relay needs the battery polarity reversed, which is more challenging electronically than simply pulling down one or the other contact. But both types are available.
There are other ways than magnetic means to make latching relays, but this way is a good way to think of how they all work.
To get the swinging arm to move at all in any type of relay, you have to make the electromagnet pull strongly enough to get the arm to overcome either the spring force or the magnetic latching force. This is the pull-in current mentioned above. Once you exceed the pull-in current, the swinging arm swings, and the relay moves to the new position. In non-latching relays, less current is needed to hold the swinging arm in the new position than to move it there originally, so the coil current can be decreased somewhat and the swinging arm will stay in the energized position. Until the coil current drops below the holding current the relay stays switched. Obviously, magnetic latching relays don't have this limitation - their hold in current is zero.
The difference between a holding current of some fixed amount (in non-latching relays) and a holding current of zero (in latching relays) is a crucial one for battery powered equipment like guitar effects. You can usually afford a pulse of current from your battery to flip a switch, but you usually can't afford continuous current for holding a relay in. This is why latching relays are likely to be a better solution for battery powered equipment. On the other hand, if you are usually powered from an AC adapter, you can take advantage of the simpler circuitry involved in non-latching relays.
What determines the relay coil's current? Skipping over several pages of high-density advanced math, relay coils need a fixed amount of ampere-turns to operate mechanically. How you get the ampere turns is up to the designer. If a relay needs 10 ampere-turns to operate, you can put 10 amps through one turn (ACK!) or one ampere through 10 turns (better, but still not great), 100 milliamperes through 100 turns, or 10 ma through 1000 turns.
If you've ever looked at relay specs you probably are wondering where they specify the ampere-turns. They don't. All they specify is the relay voltage. Here's how that works.
Since copper wire has some resistance, you can take advantage of that resistance to make the copper wire in the coil limit its own current. To do this, the relay designer picks a relay voltage for the relay. He knows how many ampere-turns are needed to make the relay operate from the magnetic design of the relay, and so his job is to get enough turns of wire to make the relay operate, and make that copper wire just the right size so that the copper resistance lets just that much current flow.
If you are doing the 100ma/1000turn case, you might like to power the relay from, say, 12V so if you can make 1000turns of wire be 12V/100ma = 120 ohms, you can just hook 12V directly to the relay, and the coil resistance will limit itself to the right value of ampere turns by the resistance of the wire. You can usually do this by messing with the number of turns and the thickness (or thinness!) of the copper wire. Manufacturers typically make several versions, each with a different rated coil voltage by messing with the ampere-turns and wire thickness to get various models that all work with different voltages. The commonest voltages are 5 (logic voltage), 6 (from vacuum tube filament supplies), 9 (yes, Virginia, there are 9V relays!), 12, 24, and 48 in (usually) AC and DC. These are not all equally available. Often, a distributor will only stock 5, 12 and 24Vdc relays, and a smattering of others, principally 24Vac and 120Vac.
You can cheat a bit after the relay is designed, which is how folks work with relays that already exist. In practice, people work with coil voltages and coil resistances. If you already have a power supply voltage that's too high, like 12V, for a relay that's rated at 5V, you can get the amperes to work out right by sticking enough resistance in series with the coil to keep the total current down. For instance, if you have a 5V/50 ohm rated relay, you can run it on 12V by putting a 70 ohm resistor in series with it. The 70 ohm resistor in series with the 50 ohms of copper resistance makes the current be the same as if you only had 5V across the relay. In fact, if you set this up and measure, you will find that there actually is only 5V across the relay coil.
There are some other things you need to know. Those coils in the electromagnets - they act like (and are!) inductors. When you set up current in them to make the relay switch positions, you are loading up an inductor with current. When you try to turn it off, the inductor responds by reversing its voltage to try to keep the current flowing. This happens as fast as you can cut the current off, so inductors can make very fast, sharp voltage spikes. Since inductance varies as the square of the number of turns on a coil, it usually happens that many turns of very thin wire on a higher-voltage (and hence, lower current) version of a relay will have much larger inductance than the same-physical-size relay in a lower voltage (hence, fewer turns of larger copper wire) version. The coil inductance directly slows down the build up and ramp down of current in the coil when you apply a voltage, so in general, higher voltage relays take longer to operate.
The fast, sharp voltage spike that comes from the relay coil reversing its voltage to try to keep the current flowing can kill your driver transistor. You have to protect the device from the voltage spike. This is usually done by placing a diode in parallel with the relay coil, but in a direction where the diode does not conduct when the relay coil is turned on. The diode only conducts when the relay coil reverses the voltage across it at turn-off. This clamps the voltage spike to only one diode drop more than the power supply voltage.
In addition the spike can be coupled to the signal path by stray capacitances inside the relay. In this case, the part of the coil voltage change from fully on to only a diode drop across the coil gets coupled. You can prevent this coupling in a couple of ways. One is to only buy shielded relays. These have an electrical shield between the coil and the signal contacts to shunt any capacitive voltage change to ground. The other way is to make the voltage across the coil change slowly by driving the driver with a ramp up or down when it switches. This prevents the coupling by making the edges be too slow to be coupled well by the very small (typically 1-2pF) of stray coupling capacitance.