Partial Design Process These resources engage students in some of the steps in the engineering design process,
but do not have them complete the full process. While some of these resources may focus heavily on the brainstorm and design steps,
others may emphasize the testing and analysis phases.

Summary

Students work as if they are electrical engineers to program a keyboard to play different audible tones depending on where a sensor is pressed. They construct the keyboard from a soft potentiometer, an Arduino capable board, and a small speaker. The soft potentiometer “keyboard” responds to the pressure of touch on its eight “keys” (C, D, E, F, G, A, B, C) and feeds an input signal to the Arduino-capable board. Each group programs a board to take the input and send an output signal to the speaker to produce a tone that is dependent on the input signal—that is, which “key” is pressed. After the keyboard is working, students play "Twinkle, Twinkle, Little Star" and (if time allows) modify the code so that different keys or a different number of notes can be played.

Engineering Connection

Electronics and sensory equipment are ubiquitous across all engineering fields. Electrical and mechanical engineers in particular design buttons and knobs as sensors that give output to users. For example, the “beeps” that microwave buttons make when pressed serve as cues to make the device more user-friendly, which is an important design consideration when creating consumer products.

Pre-Req Knowledge

It is highly recommended that students are familiar with Arduino and circuitry. If self-coding, students should also have experience with “for loops” and “if statements.”

Learning Objectives

After this activity, students should be able to:

Describe potentiometers and provide examples of real-world applications for them.

Connect electrical components and troubleshoot in case of unexpected results.

Use “for loops” and “if statements” to carry out a program.

More Curriculum Like This

Introduction to Arduino: Getting Connected and Blinking LEDs

Students learn how to connect Arduino microcontroller boards to computers and write basic code to blink LEDs. Provided steps guide students through the connection process, troubleshooting common pitfalls and writing their first Arduino programs. Then they independently write their own code to blink ...

Students learn how roadways are designed and constructed, and discuss the advantages and limitations of the current roadway construction process. This lesson prepares students for the associated activity in which they act as civil engineers hired by USDOT to research through their own model experime...

Students learn what goes on inside video game controllers by building their own, which shows them the use of simple circuits and switches. Inside a shoebox, they wire up a joystick and two arcade push buttons to a MaKey MaKey and a laptop by following a provided hole-cutting template and wiring sche...

Students learn about nondestructive testing, the use of the finite element method (systems of equations) and real-world impacts, and then conduct mini-activities to apply Maxwell’s equations, generate currents, create magnetic fields and solve a system of equations. They see the value of NDE and FEM...

Students will develop abilities to use and maintain technological products and systems.
(Grades K - 12)
Details...View more aligned curriculum...
Do you agree with this alignment?
Thanks for your feedback!

Systems, which are the building blocks of technology, are embedded within larger technological, social, and environmental systems.
(Grades 9 - 12)
Details...View more aligned curriculum...
Do you agree with this alignment?
Thanks for your feedback!

Troubleshoot, analyze, and maintain systems to ensure safe and proper function and precision.
(Grades 9 - 12)
Details...View more aligned curriculum...
Do you agree with this alignment?
Thanks for your feedback!

Introduction/Motivation

Programmable electronics are everywhere—from your phone to cars to entertainment—and even healthcare! Many devices make an audible chime when a component is plugged in or a button is pressed, such as the noise your phone makes when you plug in its charger or the beeps that microwave buttons make when pushed. Can you think of any other examples? (Listen to student responses.)

Today you will work as if you are electrical engineers with the task to program a horn to play different tones depending on where a sensor is pressed. You will use a soft potentiometer that responds to the pressure of touch and feeds an input signal to an Arduino-capable board. Pressing along the soft potentiometer produces different voltages depending on the depression location (that is, where you press). For this activity, we will press just one location at a time. The resulting voltage travels along connecting wires from the potentiometer to a SparkFun RedBoard. The programmable RedBoard then reads the voltage supplied by the potentiometer and responds to the supplied voltage however the board is programmed.

For this activity, the board transforms the read voltage into a tone. Then an electrical impulse is sent from the RedBoard to the speaker; the impulse will vary depending on the potentiometer voltage and RedBoard programming. Then the electrical impulse sent to the speaker causes the electromagnet in the speaker to drive a thin metal sheet, which produces a tone. Let’s get started!

potentiometer: A variable resistor in which the resistance provided changes depending on where along the potentiometer it is pressed.

Procedure

Background

The program works by reading an incoming value from the potentiometer. If the read value is in the allowable range, then the program decides to play a note. “If statements” are used to divide the read potentiometer value into different notes. If the potentiometer value is in the range of a certain note assignment, then the speaker for the programmed time value plays that note.

Before the Activity

Gather materials and organize them by group for easy distribution and to prevent loss/theft of small components.

Decide whether or not your students have the programming skill to write the code from scratch. If not, make copies of the SIK Keyboard Code, one per group.

Decide whether to cut the breadboards (see Figure 1) to better fit in the keyboard-housing boxes you gathered—or leave them intact.

With the class, review polarized components, which are asymmetrical and can only be placed into the circuit one-way or the component will short and cease to function. The potentiometer is the only polarized component in this build. An arrow on the potentiometer lead indicates the negative or grounded end.

(optional) Prepare a projector to show the class activity setup images, which are Figures 2 and 3, also provided in the Visual Aid. Alternatively, make a sketch on the classroom board.

Figure 1. Cutting the breadboard for the project to better fit in a box.

Direct each group to connect its components to the breadboard and the RedBoard, as shown in Figure 2 (if you chose to leave the breadboards intact) or Figure 3 (if you chose to cut the breadboards). Project the visual aid for students to see; alternatively, sketch it out on the board. Tell students to pay close attention to the potentiometer. This component is polarized and must be connected as shown in order to function correctly.

Have students use rulers to mark 6-mm intervals on the touchable, silver area of the potentiometer, as shown in Figure 4, to make eight “keys.” Have them make a mark or fill in the first 6-mm portion, as it is not encoded to do anything. Next, start measuring from the breadboard end of the potentiometer. Mark each note on the keyboard. It is easiest to start in the key of C and label the eight keys C, D, E, F, G, A, B, C.

The keyboard is now complete! Constructing a box to enclose the project is optional, but if doing so, go to the next step. If not using a box, skip to step 7.

(optional housing box steps 5-6; see Figure 5) Have students use loops of tape (or other adhesive) to secure the breadboard to one side inside the box and the potentiometer to the inside bottom of the box. If using the cut breadboards, attach the smaller breadboard with the speaker opposite the potentiometer. Use a loop of tape on the back of the RedBoard is to secure it between the potentiometer and speaker.

If the housing boxes have lids, direct students to use scissors to remove them. Cut a notch on the right side of the box for the power cord to feed into the RedBoard. Also cut a larger notch on the sidewall along the potentiometer to give better access to the keys (see Figure 6).

Depending on the programming skill of your students, either have them write the code from scratch or give them the provided code handout. With the code in the editor, upload it to the RedBoard. After the code is uploaded, have students try pressing along the potentiometer to make the speaker produce a tone. If no sound is produced, suggest that students double-check their wiring to make sure everything is plugged in. Since many of the components are small, this is often required.

After the keyboard is working, tell students to try playing Twinkle, Twinkle, Little Star (or another simple song of your choice). Then, if time allows, have students modify the code so that different keys, or a different number of notes can be played.

Attachments

Troubleshooting Tips

If no sounds are produced, double-check the wiring. Several of the components are small and misplaced wires prevent sound from being produced.

Assessment

Pre-Activity Assessment

Brainstorming: As a lead-in to the activity and to gauge what students know about the topic, ask the class a few questions to get them to think about what’s happening “behind the scenes” in many of the beeping and buzzing objects in our everyday lives. Ask the students:

How do electric keyboards and other electrical instruments work?

How do button-based sounds work? For example, the beeps you hear when pressing microwave buttons.

Can you think of any other examples?

Activity Embedded Assessment

Play a Song! Once keyboards are assembled and work, have students play songs using their keyboards. Something simple like Twinkle, Twinkle, Little Star is a good choice. Other songs and specific notes can be found online if students cannot figure out the notes by ear.

Post-Activity Assessment

Bigger and More Complicated Things! Have students think about more complex coding projects that they could carry out using Arduino-capable boards. Either make this a creative, hypothetical exercise, or if good and feasible ideas arise, turn this into an in-class project to be completed later. Students’ ideas reveal their depth of comprehension of the activity content.

Activity Extensions

The SIK Keyboard Code is for C major and eight keys. To extend the project, have students modify the code or the spacing of the potentiometer. Or have them change the assigned frequency to potentiometer values to produce notes in different scales. See http://www.phy.mtu.edu/~suits/notefreqs.html as a good resource for mapping frequency to notes. Another idea is to have students make finer divisions along the potentiometer, and for example, produce 12 notes instead of eight.

Activity Scaling

For higher grades, do not give students the code unless they are really struggling. Or give hints about which commands to use, but let students come up with the code on their own. Challenge students to program a different number of keys or program the keyboard in a key other than C major.