Introduction: Simple Music Player With Buzzer

This is a simple project that will allow you to play music on your arduino using a buzzer and some LEDs. Depending on the frequency, a different LED will light.

For this, you will need:

  • your arduino uno
  • breadboard
  • 4 resistors
  • buzzer
  • 3 LEDs
  • button
  • some connector wires


Step 1: Adding the Button

Step 2: Button and Buzzer

Connect your buzzer to the breadboard with one wire connecting to the GND rail and the other connecting to any pin on your Arduino (13, in this case).

Your button should be connected to ground using a resistor, to the power rail, and then to any pin on the Arduino (in this case, pin 8).

Step 3: Adding LEDs

Add your three LEDs to the breadboard, connecting the long end of each to arduino pins using resistors. The shorter leads will stay connected to the GND rail.

Be sure to connect the power rail and GND rail to the 5v and GND pins on your arduino.

Step 4: Code

The code was largely inspired and pieced together using three main references

this Arduino melody tutorial
this forum post about synching LEDs with lights
this post with the notes needed to play Christmas tunes.

Although it doesn't function to the extent I had initially intended, it does play the song when the button is pressed. The intention was to play different songs depending on how many times the button had been clicked (hence the counter in the code), but I kept encountering issues with placing the notes[] and beats[] inside an if-statement. When it actually would compile, the buzzer would only rattle and the red LED would flash, dim but quick, until the song was over.