# Introduction

955

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

Project Overview:

In this project, you will make a small musical keyboard using buttons and the piezo buzzer. You will use a new technique called a "resistor ladder." Each button you press will provide a different voltage to an analog input pin.

## Step 1: Project Description

With just a few resistors and buttons, you are going to build a small musical keyboard! In this project, you will use a row of buttons to create different tones on the piezo buzzer.

You will be using the tone() function to create different frequencies, as you did in the Light Theremin project. While it’s possible to simply hook up four buttons to four different digital inputs, in this project you’ll be constructing something called a resistor ladder. This is a way to read a number of switches using the analog input, as shown in the circuit diagram below. When you press each button, a different voltage level will pass to the input pin.

1. Continue to the next step.

## Step 2: Bill of Materials

You will need the following electrical components for this project:

1 piezo buzzer

4 pushbuttons

2 10 k-ohm resistors

1 220 ohm resistor

1 M-ohm resistor ...and of course your Arduino Uno and a breadboard!

If you are using the Arduino kit, you will also need the paper keyboard template to create your own musical instrument interface.

1. Can you match each component on the list to its location on the breadboard?

2. Continue to the next step to learn how to set up the circuit!

Let's take a closer look at the resistor ladder, which connects the 4-button keyboard to a single analog pin.

All of the buttons share one terminal connection at pin A0. The other terminals are connected to the 5 volt pin through resistors of different value. Pressing each button effectively creates a different voltage divider, resulting in a different voltage at A0.

For example:

If no buttons are pressed, A0 sees 0 volts or ground

Pressing the first button results in 5V input,

Pressing the 3rd button results in 2.5V input.

1. During the "Use it!" portion of the project, you will see the unique input voltage produced by each button in the keyboard.
2. If you press two buttons at the same time, you'll get a unique input based on the relationship between two resistors in parallel.
3. Continue to the next lesson to learn how to build the circuit.

Next Lesson:Setting Up the Circuit

## Recommendations

• ### Arduino Class

77,633 Enrolled