Introduction: Arduino Tone Generator

The best way to learn about the Arduino is to play with the basic examples in the Arduino IDE. In this instructable I'm going to show you how to generate a melody from an Arduino. The Arduino might not have enough ram to stream music but it has sufficient ram to generate some common melody.

Note- An Arduino is not capable handling a speaker on its own, so an external amplifier is required.

So lets get started....

Step 1: Tools and Components

All that you need for this instructable is -

  • Arduino UNO
  • A Speaker with an amplifier
  • Alligator clips
  • Jumper wires

Step 2: Circuit

Well, there is not much of a circuit all you need is to clip the alligator clips as shown in the picture and connect one of the clips to Arduino ground and the other to Digital pin 8, with the help of some jumper wires. Make sure you do not touch the 3.5mm wire when the speaker is ON.

Step 3: Code

The code for a test melody can be found in the Arduino IDE under examples => digital => tone melody. The tone will only stream once you can run it again by hitting the reset button.

Or just copy the code below and paste it in the IDE.

Comments

author
R Jordan Kreindler (author)2016-07-11

Thanks for this post. I will give it a try as it seems very "straight forward".

author
YuriSantosTeixeira made it! (author)2015-09-11

Tried with and without an amplifier with both an earphone and a small speaker, everything worked fine. Hint: copy/paste the FOR in the SETUP to the LOOP and add a "delay(500);" so it keeps playing forever.

20150912_000132.jpg
author
sspence (author)2015-09-09

The Arduino can drive a speak all on it's own, very easily. It's got quite a bit of volume.

About This Instructable

12,777views

93favorites

License:

Bio: Hi, I just launched an Indigogo campaign support my projects by backing it. https://www.indiegogo.com/projects/tinker-usb-a-wifi-based-badusb#/
More by ThisIsSteve:Linkit One Text to SpeechLinkit One Kitchen TimerIntel Edison Talks to Linkit One
Add instructable to: