In this project we'll be adding a new input device — the pushbutton (or just "button"). A button is just a very simple switch — electric current can flow through it only when it is pressed.

If we go back to our first breadboard circuit — the one containing just a resistor and an LED that is always illuminated — we should be able to add a switch that we can then use to control the LED. The switch could turn the LED on and off when it is pressed or released.

Here's what the schematic will look like to build that circuit:

Now, let's actually build this circuit. To build the circuit, we can start with the circuit we built in the last project — :

Remove wire from LED to ground.

We're going to be adding the button into the circuit between the LED and ground, so the first step will be to remove the wire that connects the LED to ground.

This is what the breadboard should look like at this point:

Provide connectivity from the LED to the button.

The next step is to provide connectivity between the second lead of the LED and where the button will sit. You could wire the button directly to the LED (in the same row of holes), but to space the parts out a little more, we're going to use an additional wire (one of the the half-inch green wires) to connect the LED and the button.

This is what the breadboard should look like at this point:

Place button on the breadboard.

Next, we'll place the button on the breadboard, connected to the new wire we placed in the previous step. Note that the button should be oriented so that the two sides of the button sit on different connect strips, as follows:

CORRECT WRONG!!!

One side of the button should sit in the same connect strip as the green wire coming from the LED. This will provide connectivity from the LED through the green wire and to the button, as follows:

Note: In our diagram above, you'll notice that the button sits across a notch in the breadboard. This isn't absolutely necessary — the button could sit with both left legs in the same connect strip and both right legs in the same connect strip. But, because buttons take up a lot of space on the breadboard, we find it easier to position them across a notch in many cases. You can decide how you want to wire your buttons, but keep in mind that either way will work.

Connect the other side of the button to ground.

Finally, we can complete the circuit by connecting the other side of the button to ground, like this:

At this point, your LED should not be lit. Remember, while we have a potentially complete circuit, there is still a lack of physical connection through the button until the button is pressed. In other words, there is a break in the circuit inside the button (this is how a button works) and the way to complete the circuit is to press the button.

If you press the button, you should see the LED illuminate.

"Breaking the Circuit"

In this project, we controlled the flow of electric current through the circuit by inserting a switch (the button) between the LED and ground. That said, the switch didn't need to be inserted at that point in the circuit for it to work — we could have inserted the switch anywhere in the circuit and it would have worked the exact same way. Remember, if the flow of electric charge is broken anywhere in the circuit, then we've created an open circuit, and current will not flow. So, our decision to insert the button where we did was completely arbitrary.

Congratulations — you've just built the same circuit used in most simple flashlights!

  1. We added the button in at the end of our circuit (after the LED and resistor). Try adding the button between the resistor and the LED and see if it still works the same way. (It should!)

  2. How about inserting the button in the circuit before the resistor (between power and the resistor)? Does it still work?

  3. How do you think the circuit would work if you hooked up two buttons within it? Give it a try and see if it works as you'd expect.