Lesson 3: How to use a Button

In this lesson, we are going to add a button to the circuit we built last time. When we push the button, it will turn the LED on, and then the button is not pressed, the LED will be off.

You have probably seen and interacted with buttons or switches a lot. For this class, a switch is going to refer to something that you flip or press once and the device stays on. An example is a light switch. You flip the switch and the lights come on.

light switch

We are going to refer to buttons as things you press that turn on or do something only while they are being pressed. An example is a doorbell or a keyboard. For laser tag, we are going to use a button, shown below.

Button

These buttons have four pieces of metal sticking out of them. These are called legs. Two on one side and two on the other side. The button can be plugged into the breadboard as shown. Be sure that the legs are sticking out the side and go into the holes in the breadboard.

When pushing the button into the breadboard, have the top right leg go into hole f-5. 

Button positioning

Push the button into the breadboard so that it sits just on top of the breadboard. 

Button plugged in

One interesting thing about these buttons is how the legs are connected inside the button.  When the button isn't pressed, the top two legs are connected to each other internally. The bottom two are also connected internally. In the picture below, that means that hole e-5 and f-5 are connected, and e-7 and f-7 are connected, as shown in yellow.

Connection when not pushed

When the button is pushed, all of the pieces of metal on the button get connected together, so electricity can flow from any leg to any other leg. This is shown below in green.

Connection when pressed

So, what we want to do is have electricity turn on the LED when the button is pressed, but we do not want electricity to flow through the LED when the button is not pressed. Can you guess where you should add the button so that electricity only goes through the LED when the button is pressed?

There are a few ways to do this, and one is shown below. What we are going to do is connect the plus side of the batter to the top left leg on the button. We will then build the rest of the circuit, with the LED and resistor, connected to the bottom left leg of the button. That way, electricity will only flow through the button, and then through the LED and resistor when the button is pressed.

Button Circuit

To build this, connect the plus side of the battery to the plus power rail, and the minus side of the battery to the minus power rail. Use an orange wire to connect the plus power rail to a-5. Then connect the long leg of the LED to d-7 and the short leg to d-8. Connect the resistor from a-8 to the negative power rail. Finally, connect the negative power rail to the minus side of the battery.

When you push the button, the LED should turn on.

Button Pressed

The full circuit, in case you want to reference it, is shown below.

Full circuit

Now that we've added a button, we are going to rebuild the exact same circuit, but this time it is going to be controlled by an Arduino. Click here to go to Lesson 4 and learn how to connect this circuit to an Arduino.

Bonus Material

If you want to know what the inside of a button looks like, check out the picture below. Inside the button, there is a metal disk that is sitting over a piece of metal that connects all of the legs together. When you push down on the button, you push down on the disk, which connects all the legs together inside the button. 

Cool, right?

button taken apart

Now, onto the arduino!