Arduino Nano — 4-Note Mini Piano
Four buttons, four notes, one tiny piano that fits in your pocket
Arduino
Nano
tone()
Button
Music
What you will learn
- How tone(pin, frequency, duration) works — frequency is in Hz (cycles per second), and a higher Hz = a higher-pitched note
- Why we need to call noTone() when the button is released (otherwise the note keeps playing)
- How to wire multiple buttons in parallel using INPUT_PULLUP — each button pulls its own digital pin LOW when pressed
What you will need
| Component |
|---|
| 1× Arduino Nano |
| 1× passive buzzer (piezo speaker) |
| 4× button |
| 1× breadboard |
| 5× jumper wires |
Step by step
Take it further
- Add 4 more buttons to play an entire octave (C, D, E, F, G, A, B, C).
- Hold two buttons at once to play a chord (C + E = C major).
- Map the piano to a melody: when button 1 is pressed, play a song using the other 3 buttons as the melody notes.
Practise it before you build it
Wire this circuit in the ThinkEdge Learn simulator first. The simulator runs a real Arduino sketch against a modified-nodal-analysis solver, so the LED on screen actually lights when the current is right — no hardware, no burnt components, and a class can try it in a browser.
Related projects
Arduino Nano — Reaction Timer GameHow fast can you press the button? Built in a tiny form factor.
Arduino — Potentiometer Tone ControlTurn the knob, hear the pitch change in real time
Arduino Nano — Parking Sensor4 distance zones — 1 slow low beep far, 2 fast high-pitch beeps close (like a real car reversing buzzer)
Arduino — Two-Player Reaction BattleTwo players, two buttons — fastest finger wins
Arduino — Button + Buzzer DoorbellPress the button, hear a tone. The classic Arduino starter.
Arduino — Music BoxPress the button, hear a complete melody. Arrays + delays = music.
Where this project sits
It is also part of these lists, which is how a class usually finds it.
Arduino push button projects for beginners14 projects in this list
Arduino buzzer and tone projects19 projects in this list
Try the full simulator with your class
103 guided circuit projects, 21 lessons and an in-browser Arduino simulator. The first 15 projects are free, no account needed. One licence covers a whole school.