How to make music with an Arduino

In this video I explain how you can use an Arduino to make music using just a speaker and a resistor.

Feb 25, 2018

50409 views

22 respects

Components and supplies

1

Speaker: 0.25W, 8 ohms

1

Resistor 221 ohm

1

Arduino UNO

Apps and platforms

1

Arduino IDE

Project description

Code

Downloadable files

Wiring

Connect speaker to GND and pin 12 via a resistor.

Wiring

Comments

Only logged in users can leave comments

waynesparky

2 years ago

Works well thank you

TOD123

2 years ago

this just goes BBB its doesn't even repeat it

Anonymous user

2 years ago

if you use a speaker it plays twinkle twinkle little star

Anonymous user

2 years ago

it's written in the code that it won't repeat

Anonymous user

2 years ago

if you put // Iterate over the notes array for(int i = 0; i < (sizeof(notes) / sizeof(*notes)); i++) { // pass the key number and note type playNote(notes[i][0], notes[i][1]); } in the loop it will run forever

Anonymous user

2 years ago

true

Anonymous user

2 years ago

I made it successfully!!! Thank you for your tutorial and codes!!!

Anonymous user

2 years ago

worked fine but I had to use a 47 ohm, the 220 didn't make any sound for the speaker I found. also, do you have any other songs?

blackpanda856

3 years ago

Yay It Works !!!! But it only repeats 1 time due to the code is written in "void setup() " I didn't use the 221 ohm resistor. Still it works. I liked it :)

Anonymous user

2 years ago

Using no resistor, or a smaller one, can fry your Arduino because of too much power being drawn. See https://github.com/zeekoe/arduino_childrens_organ_synth for another "amplifier" that's a bit safer for the arduino (and perhaps a bit less safe for the speaker; you can add a resistor to mitigate that...)

sevenoutpinball

4 years ago

worked fine but I had to use a 47 ohm, the 220 didn't make any sound for the speaker I found. also, do you have any other songs?

Mingyue_Zhu

5 years ago

I made it successfully!!! Thank you for your tutorial and codes!!!

waynesparky

5 years ago

Works well thank you

TOD123

5 years ago

this just goes BBB its doesn't even repeat it

Anonymous user

2 years ago

if you use a speaker it plays twinkle twinkle little star

Anonymous user

2 years ago

it's written in the code that it won't repeat

Anonymous user

2 years ago

true

sevenoutpinball

2 years ago

if you put // Iterate over the notes array for(int i = 0; i < (sizeof(notes) / sizeof(*notes)); i++) { // pass the key number and note type playNote(notes[i][0], notes[i][1]); } in the loop it will run forever