The arduino is surely the little micro controller that could. you can do so much with it! We at instructables have been having so much fun with our arduinos, we wanted to show the instructables community how to do some of the basics!

This first tutorial will go over how to make your arduino make simple sounds, and turn your arduino into mini tone generator.

Step 1: Supplies

For this tutorial you will need the following

1 small 8 ohm speaker
1 arduino board
1 push button
1 10 k resistor
some solid core wire

For my purposes, i used the adafruit protoshield to help me lay it out my stuff!
<p>Would it be better if we use the piano key frequency formula -&gt; f(n) = 2 ^ (n - 49/12) * 440 Hz, instead of defining all tones?</p>
If you put a capacitor in series with the speaker it will be much louder.
<p>what type of capacitor?</p><p>how to set up it?</p><p>thanks..</p>
<p>OK - piece of cake and very very cool ... but one thing TOTALLY escapes me... How do you 'jam out' so 'radically'!?!? The hood, the matching glasses... the rockin mouth poses! Please add instructable on this as well please, otherwise this tutorial is just not complete. :)</p>
<p>I think you can &quot;jam out&quot; with this: http://www.translocal.jp/radio/micro/simplestTX00.jpg</p>
Where did you get the 8 ohm speaker? Thanks.
consider me tuned !
Can two tones be played at the same time, and what does the resistor do? Would like to be using square waves somehow.
Yes they can,kinda choppy,and I still don't know bout the resistor, this is what iv made with the tone function, will write it up soon, ordered some relay shields the other day ,but now iv used the board, doh.
having a problem with the Pitches.h file. i can get it to work when i use the absolute path, but i can't get the relative path to work. i put the Pitches.h in the same folder as the .ino and i'm using a windows machine. anyone know why the relative path isn't working?
Well cool !&nbsp;<br> I had to assign a path in the h include. But's that prob just because I'm a noob.<br> <br> <br> #include &quot;./Pitches.h&quot;<br> <br> // notes in the melody:<br> int melody[] = { NOTE_C4, NOTE_G3,NOTE_G3, NOTE_A3, NOTE_G3,0, NOTE_B3, NOTE_C4 };<br> <br> // note durations: 4 = quarter note, 8 = eighth note, etc.:<br> int noteDurations[] = { 4, 8, 8, 4,4,4,4,4 };<br> <br> void setup() {<br> &nbsp; int speakerPin = 8;<br> &nbsp;<br> &nbsp; // iterate over the notes of the melody:<br> &nbsp; for ( int thisNote = 0; thisNote &lt; 8; thisNote++) {<br> <br> &nbsp;&nbsp;&nbsp; // to calculate the note duration, take one second<br> &nbsp;&nbsp;&nbsp; // divided by the note type.<br> &nbsp;&nbsp;&nbsp; //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.<br> &nbsp;&nbsp;&nbsp; int noteDuration = 700/noteDurations[thisNote];<br> &nbsp;&nbsp;&nbsp; tone( speakerPin, melody[thisNote], noteDuration );<br> <br> &nbsp;&nbsp;&nbsp; // to distinguish the notes, set a minimum time between them.<br> &nbsp;&nbsp;&nbsp; // the note's duration + 30% seems to work well:<br> &nbsp;&nbsp;&nbsp; int pauseBetweenNotes = noteDuration * 1.30;<br> &nbsp;&nbsp;&nbsp; delay( pauseBetweenNotes );<br> &nbsp;&nbsp;&nbsp; // stop the tone playing:<br> &nbsp;&nbsp;&nbsp; noTone( speakerPin );<br> &nbsp; }<br> }<br> <br> void loop() {<br> // no need to repeat the melody.<br> }
I saved the pitches defines as a .h file in the folder where the sound.ino went. <br>And included the .h file with a relative path. <br> <br>#include &quot;./Pitches.h&quot; <br> <br>That was the only way i could get it to work. <br>Thanks. <br> <br>
Would it be possible to make a sound recording and then have the speaker play the sound recording? I want my garduino to talk when he is hungry hehe.. I have a little 8ohm like the one used in this tutorial. Very cool tutorial.
I don't have any speakers, although i do have some piezo buzzers. Will one of these work instead of the speaker?<br><br>-TheWaddleWaaddle
I got my speaker from an old tv at goodwill. The TV cost 99cents and I got 2 speakers!
Yes, they will
We need some videos about this project !!!!
Yeah, we wanna hear!
Can this Arduino make sounds ala chiptunes using a fairly common SN76489? Thanks in advance
What waveform is the tone generated by the arduino?
sweet pics, dude. are those 3-D glasses?
no they r wayfarer(spicoli) shades. u can buy em in a mall at like zumiez. they r like $10
No they are 4D
Cool I'ble! I get the feeling that even I can do this. Thanks!
These pictures are too awesome!!
Thanks, this helped me out a lot!

About This Instructable


180 favorites


Bio: Freelance Lanceman
More by frenzy: Cómo hacer una placa iluminada con teclas de un teclado Una funda para tu dispositivo, hecha de un traje de buceo Dead Drop inalámbrico
Add instructable to: