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.
In this lesson we will be building a useless machine, which is a machine that turns itself off.
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
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.
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...
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.
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.
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.
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.
Aside from switches, this project incorporates a motor. We will not be covering motors directly in this class, but they will be discussed briefly in the inductor lesson.
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.
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.
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.
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 the wooden letter into a hook shape using the markings you made in the last step.
Smooth out any rough edges with sandpaper.
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.
Using wood glue, permanently attach the part of the lid without the hinges to the box.
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.
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 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.
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 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.
Using the switch's mounting nut, install it in place.
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 to the 1" wooden cube in such a manner that the lever is extending up past the top of the cube.
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 wooden block into the box such that when the arm rotates inward, it ultimately presses down firmly upon the lever switch.
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.
Once the arm has rotated into the box, and turned itself off, close the lid to the box.
You now have a machine which does nothing. Share it with your friends and family.
Share a photo of your finished project with the class!
Nice work! You've completed the class project