The following information is a single lesson in a larger project. Find more great projects here.

Lesson Overview:

Now we'll build our simple circuit!

## Step 1: Connecting Power

To get started, wire up the 5V and GND pins of the Arduino to the 5 volt and ground rails of the breadboard. You'll also need to connect the top and bottom 5 volt and ground rail to each other. Use the picture below as a guide.

This project uses a lot of wires! You might want to use a few different wire colors to keep track of the connections.

1. Connect the 5V and GND pins on the Arduino to the voltage rails on the breadboard.

2. Connect the top and bottom ground rails to each other, and connect the top and bottom 5 volt rails to each other.

3. Continue to the next step.

## Step 2: Attach the Lock Button

Next, attach a pushbutton over the center gap in the breadboard, towards the right side. This is the button you'll push to lock the box!

This button will be connected to digital pin 1. Connect one side of the button to the 5 volt rail. Connect the other side to digital pin 2 and connect it to ground with a 10 k-ohm pulldown resistor, so the pin reads LOW when the button is not pressed.

1. Place the pushbutton over the center gap in the breadboard near the right edge.

2. Connect the left terminal to the 5 volt rail.

3. Connect the right terminal to digital pin 2 on the Arduino.

4. Also connect the right terminal to the breadboard's ground rail through a 10 k-ohm pull down resistor. It might be easiest to connect to the top ground rail, as the picture shows.

5. Continue to the next step.

## Step 3: Add the Piezo

Next plug the piezo into the breadboard in row E. Attach one terminal to the 5 volt rail. The other end will connect to analog pin A0 on your Arduino. You will also connect this terminal to ground through a 1 M-ohm resistor. Lower resistor values would make the piezo less sensitive to vibrations.

Note that if your piezo has a red wire or one marked with a “+”, that is the one to connect to power. If your piezo doesn’t indicate polarity, then you can hook it up either way!

1. Place the piezo on row I or J of the breadboard, as the picture shows.

2. Connect the right terminal to he 5 volt rail on the breadboard. It is probably easier to reach the top rail.

3. Connect the left terminal to analog pin A0.

4. Connect the left terminal to ground through a 1 M-ohm resistor. This might require an extra wire connection - use the picture as a guide.

5. Continue to the next step.

## Step 4: Connect the LEDs

Next you will add the red, green, and yellow LED indicators to row E of the breadboard. Each of these is connected to a digital pin through a 220 ohm resistor.

1. Place a red, green, and yellow LED on the breadboard in row E. Leave 4 breadboard sockets between each LED.

2. Attach the short leg, or cathode, of each LED to the ground rail.

3. Attach the anode of the red LED to digital pin 5 through a 220 ohm resistor. It will be helpful to use the picture as a guide.

4. Attach the anode of the green LED to digital pin 4 through a 220 ohm resistor.

5. Finally, attach the anode of the yellow LED to digital pin 5 through a 220 ohm resistor.

6. Continue to the next step.

## Step 5: Attach the Servo (simulator)

The servo has three wires coming out of it. One is power (red), one is ground (black), and the third (white or yellow) is the control line that will receive information from the Arduino.

In this project, it you should place the servo off the edge of the breadboard and extend wires down from each terminal, following the connection instructions below.

1. Drag the small servo motor into the Workplane and position it above the breadboard, as shown.

2. Next, connect the red terminal to the 5V rail and the black terminal to the ground rail of the breadboard.

3. Finally, connect the white pin to digital pin 9 on the Arduino. We made this connection with two gray wires, through the breadboard (see illustration above).

4. Continue to the next step.

## Step 6: Attach the Servo (Arduino Kit)

Attaching the servo motor in the Arduino kit has an additional step: extending the servo wires with "header pins." This part should look familiar if you did the project Mood Cue.

Again, the servo has three wires coming out of it. One is power (red), one is ground (black), and the third (white) is the control line. You will need to snap off three male header pins and plug them into the female ends of the servo wires, as shown in the picture.

1. Extend the servo motor wires using a block of 3 male header pins.
2. Continue to set up the circuit, as previously described, by plugging the header pins into separate columns on the breadboard.
3. Continue to the next step.

## Step 7: Decoupling Capacitor

Finally, place a 100 uF capacitor across the power and ground terminals of the servo to smooth out any irregularities in voltage.

In the simulator, you might need to place the capacitor off the edge of the breadboard, as we did, and connect wires from the capacitor terminals to the top power and ground rails. Make sure you have the polarity of the electrolytic capacitor correct! The stripe faces the ground rail.

1. Place a 100 uF electrolytic capacitor above the breadboard in the simulator.
2. Attach the capacitor terminals across the 5 volt and ground rails of the breadboard. Make sure the striped side of the capacitor connects to ground.
3. Continue to the next lesson to learn how to program your knock-activated lock!

Next Lesson:Writing the Code