Build it step by step
0 of 7 doneWire the four buttons
D2 to D5, each to GND.
Wire the passive buzzer
Plus to D8, minus to GND.
Upload and open the serial monitor at 9600
A prompt appears.
Hold button 1
Three notes of C major play in turn.
Hold button 2
C minor, with a lower middle note.
Try buttons 3 and 4
G major and A minor.
Change NOTE_MS
Speed up or slow down the arpeggio.
How do you build a chord arpeggio trainer?
Four buttons each play the notes of a different chord one after another on a small passive buzzer, so you hear the difference between a major and a minor chord and learn which notes make them. You need Arduino Nano, Tactile push button 6 mm × 4, Passive buzzer, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 7 steps and about 60 minutes.
- Level
- Beginner
- Time
- About 60 min
- Parts
- 5
Parts list
- Development BoardsBuyArduino Nano × 1
- SwitchesBuy
- Motors & ActuatorsBuyPassive buzzer × 1
- PrototypingBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Button 1 (C major) | Nano D2 and GND | Pressing joins D2 to ground |
| Button 2 (C minor) | Nano D3 and GND | Pressing joins D3 to ground |
| Button 3 (G major) | Nano D4 and GND | Pressing joins D4 to ground |
| Button 4 (A minor) | Nano D5 and GND | Pressing joins D5 to ground |
| Passive buzzer + | Nano D8 | Tone output |
| Passive buzzer - | Nano GND | Return path |
Code
A chord is three or more notes that sound well together. A major chord has a bright sound and a minor chord has a darker one, and the difference is only one note: the middle note of a minor chord is a little lower. The sketch holds four chords, each as three frequencies in hertz, and plays them one after another, an arpeggio, while a button is held. Play C major and then C minor and listen to just the middle note changing. Then try G major and A minor. A passive buzzer plays whatever frequency the Nano sends with tone, but it is not a very musical instrument, and it can be loud, so keep it a hand-span from your ear. Once it works, add a fifth chord of your own by looking up the three note frequencies, or change NOTE_MS to speed up and slow down the arpeggio.
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
const uint8_t BUTTON_PINS[4] = {2, 3, 4, 5};
const uint8_t BUZZER_PIN = 8;
const char* NAMES[4] = {"C major", "C minor", "G major", "A minor"};
// three notes per chord, in hertz
const int CHORDS[4][3] = {
{262, 330, 392}, // C4 E4 G4 C major
{262, 311, 392}, // C4 Eb4 G4 C minor (the middle note drops a little)
{196, 247, 294}, // G3 B3 D4 G major
{220, 262, 330} // A3 C4 E4 A minor
};
const unsigned long NOTE_MS = 250;
int lastChord = -1;
int step = 0;
unsigned long lastStep = 0;
void setup() {
for (int i = 0; i < 4; i++) pinMode(BUTTON_PINS[i], INPUT_PULLUP);
pinMode(BUZZER_PIN, OUTPUT);
Serial.begin(9600);
Serial.println("Hold a button to hear its chord, one note at a time.");
}
void loop() {
int chord = -1;
for (int i = 0; i < 4; i++) {
if (digitalRead(BUTTON_PINS[i]) == LOW) { chord = i; break; }
}
if (chord < 0) {
noTone(BUZZER_PIN);
lastChord = -1;
return;
}
if (chord != lastChord) {
lastChord = chord;
step = 0;
lastStep = 0;
Serial.println(NAMES[chord]);
}
if (millis() - lastStep >= NOTE_MS) {
lastStep = millis();
tone(BUZZER_PIN, CHORDS[chord][step]);
step = (step + 1) % 3;
}
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
Hold a button to hear its chord, one note at a time.
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Button 1 | C, E, G repeating |
| Button 2 | C, E-flat, G, a darker sound |
| Release | The sound stops at once |
| Serial monitor | Prints the chord name when it changes |
| Two buttons together | The lower numbered chord plays |
If it does not work
No sound
Check you have a passive buzzer, not an active one, and the pin is D8.
Constant buzz
An active buzzer ignores the pitch, swap in a passive one.
One chord never plays
Check its button wiring to GND.
Notes sound the same
Listen for the middle note moving, it is a small change.
Upload fails
Choose the Old Bootloader option.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the chord arpeggio trainer?
Arduino Nano, Tactile push button 6 mm × 4, Passive buzzer, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).
How long does the chord arpeggio trainer take to build?
About 60 minutes for a beginner maker, in 7 steps.
How do I know the chord arpeggio trainer works?
Button 1: C, E, G repeating. Button 2: C, E-flat, G, a darker sound. Release: The sound stops at once.
No sound: what should I check?
Check you have a passive buzzer, not an active one, and the pin is D8.
Constant buzz: what should I check?
An active buzzer ignores the pitch, swap in a passive one.
One chord never plays: what should I check?
Check its button wiring to GND.
Notes sound the same: what should I check?
Listen for the middle note moving, it is a small change.
