Turning Electricity On and Off
You've scrounged around your growing electronics bin and come up with wires to connect a circuit together and batteries to power the circuit. So how do you turn the power on and off? You use switches and relays.
Turning current on and off with switches
When you move the switch to shut off your flashlight, you disconnect the wires that run from the battery to the light bulb. All switches do the same thing: Connect wires to allow electric current to flow or disconnect wires to stop electric current from flowing.
When you turn off your flashlight, you put the switch in what is called the open position. With the switch in the open position, you have a disconnected wire, and no current can flow. When you turn on the flashlight, you put the switch in the closed position. With the switch in the closed position, you've connected the wire (and completed the circuit), and current can flow.
Starting with simple switches
Your flashlight usually comes with something called a slide switch. With a slide switch, you slide the switch forward or backward to turn the light on or off. But toggle, rocker, and slide switches all do the same job, so grab whatever switch you have handy that you can easily use on the project that you're building. For example, a slide switch works well on a round, handheld flashlight because of the position of your thumb, but a toggle switch may work best to flip on a gadget sitting on your workbench.
Push-button switches come in three versions:
- Normally closed (NC): This push-button switch disconnects the wire only when you push the button.
- Normally open (NO): This push-button switch connects the wire only when you push the button.
- Push on/Push off buttons: This switch connects the wire with one push and disconnects the wire with the next.
You typically find push-button switches in electronics to start or stop a circuit. For example, you press a normally open push-button switch to ring a doorbell.
What's inside a switch?
You call the basic switches that we talk about in the previous section single-pole single-throw, or SPST types. Don't worry about all the different names: In essence, these switch types have one wire coming into the switch and one wire leaving it.
Just to keep your electronics life interesting, you may come across other types of switches that are wired a bit differently, called double pole. Where single pole switches have one input wire, double pole switches have two input wires. With single throw switches you can connect or disconnect each input wire to one output wire, while double throw switches allow you to choose which of two output wires you connect each input wire to.
There are a few single- and double-pole variations, including
- Single-pole double-throw (SPDT): In this switch, one wire comes into the switch and two wires leave the switch. When you want to choose what device a circuit turns on (for example, a green light to let people know that they can enter a room or a red light to tell them to stay out), use an SPDT switch.
- Double-pole single-throw (DPST): This switch has two wires coming into it and two wires leaving. You can use a DPST switch to control two separate circuits. For example, you can have one circuit with components running on 5 volts and another circuit with components running on 12 volts. With one switch, you can turn both circuits on or off.
- Double-pole double-throw (DPDT): This switch has two wires coming into it and four wires leaving. A DPDT switch has three positions. In the first position, the first pair of output wires connect. In the second position, all four output wires disconnect (some DPDT switches do not have this position). In the third position, the second pair of output wires connect. You can use this type of switch to reverse the polarity of DC voltage going into a motor so that the motor turns in the opposite direction. (One position makes the motor turn clockwise, one position turns off power to the motor, and one position turns the motor counterclockwise.)
Let a relay flip the switch
You've made a gadget to let you know when your no-good brother-in-law, Herman, is raiding the refrigerator. But there's one problem: The gadget runs on a 5-volt battery pack, and you want the gadget to turn on enough sound and light to scare the guy into the next county. No problem, just use a relay.
How relays work
A relay is simply an electrically powered switch. When your gadget sends 5 volts to the relay, an electromagnet turns on and then closes a switch inside the relay. If you wire that switch to 117 volts, you can power enough lights and sirens to send Herman scurrying.
So how does the electromagnet part of a relay setup work? An electromagnet can be something as simple as coiled wire around an iron bar or even a nail. When you run some current through the wire, the nail becomes magnetized. When you shut off the current, the nail loses that magnetic quality.
Two magnets attract or repel each other, depending on which ends (or poles) of the magnets you put together. Part of the switch contained in a relay consists of a lever attached to a magnet. When voltage runs through the wire coil, the electromagnet pulls the lever toward it, and the switch closes, connecting the 115 volts to the lights and sirens (goodbye, Herman!). When you shut off current to the wire coil the electromagnet shuts off and a spring pulls the lever away, opening the switch.
You can find relays that use 5, 12, or 24 VDC to power an electromagnet with a SPST, SPDT, or DPDT switch.
Here are a few relay lingo options. Often instead of saying that a switch in the relay opens or closes, people talk about contacts opening or closing. Also, people sometimes call a lever in a relay an armature. But a relay by any other name, would work the same...