top of page

A Musical Arduino Project

  • Writer: Harry
    Harry
  • Dec 5, 2025
  • 3 min read

Updated: Dec 9, 2025

In this project you will use an Arduino to create a little musical instrument that can play 3 notes with the ability to move up or down an octave or a scale of 9 notes where you move between 3 at a time. The project is simple and easy to follow, you don’t need to know how to code or how to do electronics, I have taken care of all that for you. Simply follow the steps and enjoy your own creation.


What You Need


First of all, let’s make sure you have the right kit, for this project you need:


  • 1x Ardunio Uno R3 (or any Ardunio with a PWM pin)

  • 1x Breadboard

  • 1x Piezo electric buzzer

  • 5x Push buttons

  • 5x 10K Ohm resistors

  • 1x 220 Ohm resistor (optional)

  • Some jumper wires

  • A USB cable for your Arduino

  • A laptop/PC


These components are fairly basic and will likely come with any starter kit you get with a dev board.


In terms of software, you will need to download the Arduino IDE if you have not already, it can be downloaded here if you do not have it.


Building the Electronics


Let us begin with the hardware, you can arrange your buttons and buzzer however you want but make sure your resistors and jumper wires are the same as in this diagram otherwise it will not work properly.


This is how you need to arrange your components:



This might look complicated, but I will break it down for you. Also, all the buttons are the same so once you have done one you know how to do them all.


Power and Ground


First place a jumper cable from the 3.3v and GND pin to the ground and power rails on your breadboard like this.



Buttons


Next place a button, jumper wire, and a 10k Ohm resistor like this.



Then repeat that arrangement again to make a set of 3 buttons and a set of 2, make sure to separate them enough so you have room to press one at a time with your finger.



Buzzer


Now place your buzzer and the 220 Ohm resistor connected to ground.



The 220 Ohm resistor is optional. I use one to lower the volume of the buzzer, you might want it to be louder or quieter so just use a smaller or larger resistor to adjust the volume. Or, if you are feeling jazzy you can use a variable resistor to control the volume dynamically.


Jumper Wires


Finally add the jumper wires. This step is important so make sure each wire goes to the correct pin. The buttons should be wired up so that each button goes into pin 2, 3, 5, 6, and 7 from left to right.



The buzzer wire should run from its positive terminal to pin 9.



You should have a breadboard full of buttons and a buzzer that looks like this.



All that is left is to program the Arduino and you will have your own music player!


Programming the Arduino


If you do not have the Arduino IDE installed, you should do it now using the link at the top of this page.



Open the IDE to a new sketch and delete all the code that appears by default, then copy and paste the code from the above text document into the blank sketch.


Connect your Arduino to your laptop or PC and press the upload button in the IDE.


If you did everything correctly, you should be able to play music using the 3 buttons on the right of your breadboard!


There are two ways to play your Arduino instrument, one way is to play all the notes in one octave (which is the default setting) or by making a slight change to the code you can play 3 notes and move them up or down an octave.

The three buttons on the right play the notes, the two on the left move up or down the scale/octave.



To change to the octave version all you need to do is comment out the second freqs[] array and un-comment the first within the Arduino IDE.


If you want to change which 3 musical notes can be played in octave mode just change the notes in this part of the code.



Enjoy your Creation


Congratulations! You have made a musical instrument using an Arduino.


If you are wondering what to play, I have made a special music sheet that only works with your Arduino keyboard: the dots represent the buttons on the board, on each line press the buttons that are coloured for the number of times denoted by the number to the right of the dots.


For example, in the music sheet below, the first line says you need to press the middle most button of the three on the right seven times.


Now try and see if you can play jingle bells!



Comments


A black and orange logo that says Mari Onyx, the name of the website’s company

Contact Email:

harry@marionyx.co.uk

Contact Number:

+44 (0)7503 190502

  • LinkedIn

MariOnyx may collect personal data such as your name and email address but will not do so automatically, only when submitting forms on this website. We collect your name and email only so we can contact you if you reach out to us. MariOnyx may also collect details necessary to collect payment for services offered on our website, such details include your debit/credit card details, phone number, and address. This information is for billing purposes only and collected in accordance with Wix Payments Terms of Service. We will not share your data with any other person or organisation without your permission. MariOnyx will store your data in accordance with UK GDPR law. MariOnyx will delete any or all of your stored personal data upon request.

 

 

© 2025 MariOnyx, all rights reserved. 

 

bottom of page