loading

In your lifetime you have used many thousands of switches. Every time you enter a room and turn on the light, you are using a switch. When you get into an elevator and press the button, you are using a switch. When someone cuts you off in your car and you lean on the horn, you are using a switch. When you are programming the time on the microwave to reheat leftovers, you are using switches. The list goes on and on.

Almost all electrical devices have at least one switch and they play a vital role in all electronics. Fortunately, they are extremely simple to understand. Over the course of this lesson we will discuss switches and how they work. All of this will culminate with a project.


Lesson Materials

This lesson has two projects to choose from. There is a Mad Scientist Extension Cord which is slightly dangerous and likely not up to any sort of building code. This is more of a novelty item for irrational individuals.

The Useless Machine is also a novelty item for irrational individuals, but runs little risk of electrocuting you.

You may build either one to complete this lesson.

For the Mad Scientist Extension Cord you will need:

(x1) 3PDT 100A knife switch
(x1) Cord end plug
(x1) Cord end socket
(x1) 25' heavy duty fabric cord
(x2) Zip ties

For the Useless Machine you will need:

(x1) Continuous rotation servo motor
(x1) DPDT toggle switch
(x1) SPDT lever switch
(x1) 3 x AA battery holder
(x1) Small hinged wooden box
(x1) Wooden letter ('C' or 'J' tends to work well)
(x1) 1" wood cube
(x1) Wood glue


How a Switch Works

A switch is the simplest device you can imagine. It is basically a mechanical device which makes or breaks a circuit. In other words, a switch consists of two (or more) conductive terminals that can be connected or disconnected with a mechanism (such as a lever or button).

In this example, you can see that I have replaced the push button of the auto-waving novelty flag with a knife switch. When the metal bar closes between the terminals, the two wires are connected and the flag waves. When the bar is lifted, the switch is disengaged and the flag stops.


Poles and Throws

Of course it gets a bit more complicated than that. Switches can make or break more than one connection at a time. Switches consist of poles and throws. You can think of a pole as the point a switch enters a circuit and the throw as the potential exit points.

The most basic switch has a single throw and a single pole, since electricity only has a single point of entry and exit. This is often referred to in shorthand as SPST.

If we were to add another throw or exit point, we have created a single pole, double throw - or SPDT - switch. This allows you to toggle between two different electrical pathways.

We can also add additional poles. If we were to add another pole to the SPDT switch, we would get a double-pole double-throw (DPDT) switch. This is basically the same as having two separate SPDT switches that get toggled by the same lever.

The easiest way of determining poles and throws on a switch is with the continuity setting on a multimeter. Touch the probes to the different terminals until you get a connection. Once you have determined which pins are connected, flip the switch to its other position(s) and check again to be entirely certain.

There are all kind of different pole and throw arrangements you will find. For instance, this pushbutton switch has three input poles, and two output throws. This is what is called a 3PDT switch (three poles, double throw). On the other hand, this rotary switch has two input pole and six throws. This is a DP6T (double-pole, six-throw) switch. This type of switch gives you a lot of different output choices.

Which brings us to our next point...


Types of Switches

Switches come in a bonanza of different form factors! This means that they come in all shapes, and sizes. They also have a host of mechanisms; some of which will be familiar to you and some which you may find surprising. Here is an extensive, but by no means exhaustive list of common switches you may encounter.

A knife switch is one of the oldest forms of switch, and likely familiar to you if you are a fan of old monster movies. It's about as simple as switches come, consisting of a metal bar with an insulated handle that bridges two (or more electrical contacts). In the switch pictures, when you lower the lever onto the terminal, it makes a connection and completes the circuit. Otherwise, no circuit is made.

Getting a bit more advanced, we have a toggle switch. This type of switch has a little lever that is toggled back and forth to activate the switch. By flicking the lever back and forth, you can make or break one or more connections.The nice thing about these is that they are typically mounted to an enclosure using a round hole, which make installing them a breeze.

The standard light switch is basically little more than just a specialized toggle switch meant to handle a fair bit of electricity.

Very similarly to the toggle switch, the rocker switch moves back and forth. Instead of being pushed back and forth, it "rocks" or pivots along its center axis. They are commonly used as power switches and are sometimes illuminated (i.e. internally light up). These are typically mounting using rectangular holes, which makes installing them into an enclosure very annoying.

Just like toggle and rocker switches, the slider switch toggles back and forth. Unlike a toggle switch, the lever switch can have multiple positions to toggle between. However, most of the ones you might encounter are typically just two positions. These are commonly found as power switches in consumer devices.

A pushbutton switch is activated when you push down on it. These are found everywhere from elevators, to arcade machines, to game shows, to consumer products. They share the ease of mounting that we have come to know and love from the toggle switch.

The tactile switch is basically just a small pushbutton switch that gets soldered directly to a circuit board. Most small electronics devices with a pushbutton interface are actually using one of these with a custom molded plastic cab on top of it. These are actually everywhere, but you likely have not seen them anywhere unless you have a penchant for taking things apart.

The lever switch is like a pushbutton switch, but has a lever which adds a mechanical advantage. The benefit to this is that it can be activated with very little force.

On the contrary, rotary switches typically require a fair bit of force to operate. However, what they lack in ease of activation, the more than make up for in number of inputs and outputs. By turning the knob you can toggle between a massive amount of different configurations of inputs and outputs. These switches are great when you need to toggle between lots and lots of different circuit combinations.

The DIP switch is another switch with lots of different inputs and outputs. However, instead of toggling between inputs and outputs, this switch is really just a whole ton of SPST switches jammed together in a single package and mounted to a circuit board. You normally see these used when you need to configure a circuit to perform in a different way and leave it. For instance, each tiny switch could represent a different setting within a circuit. This are commonly used for things such as setting custom security codes for garage door openers.

Speaking of switches and home access, the reed switch is commonly found as part of many home alarm systems. While it may seem complicated, it is actually just a switch that is activated by a magnet. In your home, the way it works is that when people open the window and slide the magnet away, the switch gets triggered. It's actually a really simple device consisting of two metal plates that are either pulled together or pushed apart depending on whether a magnet is present. In fact, if you listen very carefully, you can often hear the switch click when a magnet activates it.

Moving on to other esoteric switches sometimes encased in glass, we have the tilt switch. What is cool about the tilt switch is that the connection is made depending on what direction it is tilted. Historically these switches used a mercury bead to make electrical contact between two wires (like the one pictured). However, in modern times, this has been replaced by a much safer metal ball. You can get switches which make or break connections at a number of different tilt angles.

We're nearing the end, but before we get there I would be remiss not to mention the pull cord switch. This type of switch is activated when the cord is pulled and most often used in lamps and ceiling fans. While not used very often in other projects, it could be a fun switch to add to a project for a zany retro feel.

Now we finally reach the end of our switch-a-palooza with the key switch. This switch is activated when a key is turned. These are obviously found in cars, alarm systems, and anywhere where you want to control access. These are always a fun finishing touch to add to hobbyist projects. They make everything seem important.


Momentary vs. Latching

There is another distinct aspect of switches worth pointing out and that is the difference between momentary and latching switches.

A momentary switch is only connected while you are activating it. That means the moment you stop applying force upon it, it toggles.

A latching switch on the other hand is activated with a force once to toggle one way, and then needs to be activated again to be toggled back to its initial state.

While there are a few types of switches which can only ever be one type or the other, most switches can be produced to be either momentary or latching. It is important to pay attention to what type of switch you get.


Power!

The size of a switch is typically a good indication of how much voltage and current a switch can handle before it malfunctions. However, to be sure, just look at the switch itself. They typically have their power rating printed on them.


Switch Projects

In this lesson we will cover two different switch-related projects. Since - again - one is a bit dangerous, I leave it to you to decide which one to make.

The Mad Scientist Extension Cord uses a 'monster movie' knife switch to toggle anything plugged into the extension cord. It can be paired with either of the projects from the electricity lesson for dramatic effect. However, this is just a prop, and you should pay careful attention while operating it, and never leave it plugged in as there are dangerous exposed electrical contacts.

The second project is a classic Useless Machine. When you toggle the switch to turn the machine on, an arm comes out, reverses the switch and then hides back in the box, effectively turning it off. This is a safe and fun project for children of all ages.

This project also incorporates a motor. We will not be covering motors directly in this class, but they will be discussed briefly in the inductor lesson.


Mad Scientist Extension Cord

The Mad Scientist Extension Cord uses a heavy duty 3PDT knife switch and 18 AWG 3 conductor fabric wire that is rated for up to 5A of current.

The high voltage might make this seem complicated, but it is a rather simple project. In fact, we are only wiring up half of the switch's connections, such that is wired more like a 3PST switch. Ultimately, it is simply an extension cord with a switch in the middle. We are simply extending the three prongs from the wall socket and making or breaking each of three connections.

While this is simple, I'd once again like to reiterate that the electrical contact from the wall is slightly exposed, and there exists a real chance of electric shock if used wrong. You will need to be careful when handling this, and it is not good to leave plugged in anywhere you may have children, small animals or people who don't understand electricity. Since I have just described most places, it is not recommended you keep this plugged in when not actively demonstrating it. In fact, is likely in violation of most building codes in most places, so this is only a novelty item that you should always be careful when handling, and never leave plugged in or unattended. But it's great for your Halloween Haunted House display, or for impressing house guests.

{
    "id": "quiz-1",
    "question": "Do you understand that this project is dangerous?",
    "answers": [
        {
            "title": "NO!",
            "correct": false
        },
        {
            "title": "YES!",
            "correct": true
        }
    ],
    "correctNotice": "Indeed it is.",
    "incorrectNotice": "You better re-read the intro and try again!"
}
{
    "id": "quiz-2",
    "question": "You should never touch:",
    "answers": [
        {
            "title": "Any of the exposed metal contacts.",
            "correct": true
        },
        {
            "title": "The insulated safety handle.",
            "correct": false
        }
    ],
    "correctNotice": "That is very true.",
    "incorrectNotice": "Errr. Wrong. That is the part you are allowed to touch!"
}

{
    "id": "quiz-3",
    "question": "When you are done using this, this lamp should be:",
    "answers": [
        {
            "title": "left unattended in perpetuity.",
            "correct": false
        },
        {
            "title": "unplugged and put away.",
            "correct": true
        }
    ],
    "correctNotice": "You got it.",
    "incorrectNotice": "Errr. Wrong. Try again!"
}

Remove the Cover

Remove the half of the cover which exposes most of the screw terminals for the center electrical contacts.


Widen the Hole

We need to widen the center hole of the cover to allow the fabric cord to be cleanly inserted.

Since this is a very soft plastic, we can misuse a hand drill drill to cut horizontally and extend the hole.

Insert a 3/8" or 1/2" drill bit and at a medium to high speed gently cut inward to widen the hole.


Remove the Insulation

Using a razor blade, box cutter, or craft knife, carefully remove 3" of the outer insulation from one end of a 8' section of fabric cable. Wrap the cut end of the insulation with tape (preferably the color of the cable) so it does not fray.

Repeat this process for a second cable.


Wire it Up

Strip a little insulation off the end of each of the three inner wires. Wrap each wire clockwise around a screw terminal, and fasten each one firmly in place.

Which color gets connected to which is unimportant at this juncture.

While you are at it, affix a zip tie to the end of the cable (around the tape) and trim away most of the tail. This zip tie will be used to prevent the cord from being able to fit back through the hole in the cover.


Remove the Remaining Cover

Remove the second half of the cover.


Remove the Center Screw

Remove the center screw from the other outer set of screw terminals. This will allow you to easily pass the cable through later.


Finish the Wiring

Strip insulation of the three inner wires of the remaining cable. Connect these wire to the center terminals such that wires of the same color are aligned with one another.

Attach a zip tie to this cable near the edge of the switch and cut off most of the tail. Again, this is meant to prevent the cable from being pulled free from the switch.


Case Closed

Put the protective covers back on while ensuring the zip tie attach to each cable is on the inside of the covers.


Affix the Socket and Plug

The last thing left to do is to attach the socket and plug to each end of the cable. The plug should go to the end connected to the outer terminals, and the socket should go to the end connected to the center terminals. This is very important to get right because if you do this backwards, the center bars of the switch will always be hot, which increases the likelihood of electric shock dramatically.

Disassemble the socket and pass the cable through its casing.

Strip away about an inch and a half of the outer insulation.

Next strip a half inch from the ends of the inner wire and insert each of them into one of the screw terminals in the socket. The wire color is not important, so long as it matches the wiring on the plug.

Wrap the end of the cut insulation with tape to keep it from eventually fraying.

Repeat this exact process for the plug.

Ensure you got it right by inserting the extension cord's plug into its own socket and seeing if the wires line up.

If the colors are all aligned, close both of their cases back up.

The plug and socket should be assembled and it should now be complete.


Let 'er Rip

When it's done, plug something in and throw switch (kuh-chunk!) to turn it on. It works well for dramatic effect with either of the projects from the previous lesson. Don't forget not to leave it unattended.


Build a Useless Machine

The Useless Machine is a variation on Marvin Minsky's "Ultimate Machine," which is basically a machine whose ultimate goal is to turn itself off. After building it, you will be amazed how a machine consisting of two switches and a motor and does nothing but disable itself seems to have so much personality. While it does not have much purpose, it always seems to bring smiles to people's faces.


How it Works

At the heart of the machine there is a DPDT toggle switch wired to reverse polarity to a motor. This means that the direction electricity is flowing through the motor changes when the switch is toggled. This is important because the direction a motor rotates is dependent on which direction electricity flows through it. So, to put it simply, when power and ground get reversed, the direction of the motor changes.

There is also a lever switch inside the case which disconnects power to the motor, but only when it is pressed and the power is reversed.

Thus, when the toggle switch is pressed, the power is no longer reversed and the machine is once again turned on. The arm is then free to rotate up out of the box and hit the switch. This in turn reverses the arm, which rotates back into the box, where it hits the lever switch, and turns itself off once more.

This project demonstrates how a lot can be achieved by cleverly routing electricity through a few simple switches.


Modify the Servo

First things first, we need to convert a servo motor, which is a circuit board controlled motor into a basic gear motor. The reason for this is because servos are reliable, easy to work with, and have gearboxes with a lot of torque, which is necessary for pressing the switch.

All this entails is removing the circuit board attached to the motor and attaching two wires instead. It's not as scary as it sounds, and gives us a chance to practice desoldering.

Remove the four screws to find the servo's circuit board and locate the two large solder terminals connected to the motor.

Carefully use desoldering braid to remove the solder from the two terminals connecting the circuit board to the motor.

Remove the circuit board from the case.

Solder a red wire to the positive terminal of the motor. This is typically marked with a red dot. Then, solder a black wire to the other terminal. If you mess this up or they are not marked, don't sweat it. It will just mean your motor might spin backwards when power is connected. If this is the case, just rewire it with the wires reversed.

Trim away any excess wire leads from the terminal. This will make it easier to get the lid back on.

Tie the red and black wire together in a knot such that the knot itself extends past the outside of the motor enclosure. Then, place the knot on the inside of the motor enclosure. This will prevent anything from placing strain on the wire and it getting pulled free.

Close the case back up and you are done.


Drill and Trim the Servo Horn

The gear-looking thing attached to the servo is called its horn.

On one of its arms, widen the innermost and outermost holes using a 1/8" drill bit. This is so they are large enough that we can pass a zip tie through them later.

Then, use diagonal cutters to cut away all of the remaining arms so that they will not later get in the way of the box lid opening and closing.


Shape Your Letter

Place the servo on top of the box and get your wooden letter. I found that the "C" worked exceptionally well.

The goal is to mark it so that it forms a hook which will be small enough to rotate fully into the box, but be large enough that it will rotate far enough out of the box to press the switch.

This might take some trial and error. Fortunately, wooden letters are cheap and easy to work with.


Cut to Size

Cut the wooden letter into a hook shape using the markings you made in the last step.

Smooth out any rough edges with sandpaper.


Trim the Lid

Place the motor atop the lid on the far edge from the hinges. Position the motor to figure out just how much of the lid is necessary to keep in order to mount the motor such that the servo horn is just clear of the lid.

Once you have figured this out, draw a cut line across the box.

Also make a cut line on the side of the lid angled slightly towards the edge with the hinges.

Cut the lid into two sections at an angle by following the cut line.

When you are done, the part of the lid connected to the hinges should have a slight overhang.


Glue

Using wood glue, permanently attach the part of the lid without the hinges to the box.


Wire the Circuit

Let's wire together the circuit as outlined in the wiring diagram above.

To begin, attach the motor to the center terminals on the switch.

Then, attach the battery back to the outer terminals on the switch, keeping an eye to line up power and ground connections. If the switch were to be thrown now, power will either be connected or disconnected, and the motor should spin clockwise.

Since we want the motor to get disconnected when it spins counter clockwise and presses the lever switch, we then connect wires to its common and normally closed pins. In this way, the switch is normally closed to allow electricity to flow, but the connection is opened (or 'broken') when it is pressed.

Finally, the outer terminals of the switch are crisscrossed to allow the motor to be powered backwards when the switch is toggled. For ground we simply use a short wire. However, for power we use the wires from the lever switch such that it can be toggled on and off.


Drill Mounting Holes

Align the servo's lever with the base of the wooden arm, and use the servo's mounting holes to make two drill guides on the arm.

Drill these marks with a 1/8" drill bit.


Fasten the Arm

Fasten the arm to the servo's lever using a small zip tie.

Trim the excess zip tie tail when done to prevent it from catching and getting in the way.


Epoxy the Servo

Mix together 2-part 5-minute epoxy and glue the servo to the inside of the lid such that lever arm will sit roughly centered in the box. Also, make sure that it will be able to rotate upwards over the box lip without immediately catching.

Once you are certain on the positioning, turn the box over, and wait 30 minutes for the epoxy to fully set.


Drill a Hole

Drill a 1/4" hole centered along the edge of the box. This is for the switch. Thus, the hole should be positioned in a spot where the lever arm can rotate up and past the hole. This will ensure that the arm will always be able to hit the toggle switch and push it far enough to activate it.


Install the Switch

Using the switch's mounting nut, install it in place.


Drill

Position the lever switch centered along one edge of the cube such that the body of the switch is level with the top of the cube and the lever extends up above it.

Mark the switch's mounting holes with a pencil, and then drill these markings with a 1/8" drill bit.


Zip Tie the Switch

Zip tie the switch to the 1" wooden cube in such a manner that the lever is extending up past the top of the cube.


Glue the Battery Holder

Use 5-minute epoxy and attach the battery holder into the bottom corner of the case below the servo. This will ensure it is out of the way.


Glue the Block

Glue the wooden block into the box such that when the arm rotates inward, it ultimately presses down firmly upon the lever switch.


Insert Batteries

Insert batteries into the battery holder.

The arm should ultimately rotate into the box, and turn itself off.

If it does not do this, quickly remove the batteries, and then check to see if your DPDT switch was installed backwards into the box. This is a common mistake and should typically fix things when the battery is re-inserted.

If it is still not working after you try this, again remove the batteries quickly and double check all of your wiring. Something is not right.

Likely, you might have messed up the polarity on the motor wiring. However, you should check everything carefully before switching any wiring.


Close the Lid

Once the arm has rotated into the box, and turned itself off, close the lid to the box.


Congratulations!

You now have a machine which does nothing. Share it with your friends and family.

CLASS PROJECT

Share a photo of your finished project with the class to complete the lesson!

Nice work! You've completed the class project