Arduino Melody

A  very easy tutorial that uses only two components. The Arduino plays a short melody on a loudspeaker. The program to load to the Arduino is one of the programs that is built into the Arduino IDE.

Arduino Melody

Prerequisites

Complete tutorial 3 – Starting with Arduino and its prerequisites before attempting this tutorial.

Components

Besides an Arduino Uno and wire link, you will need:

Qty Part Designator Notes Type
1 100 ohm (brown – black – brown) R1 1/4W, 5% or better Resistors
1 8 ohm loudspeaker SP1 Transducer

The required components are shown in this photo:

Circuit Diagram

Arduino Melody schemetic

The circuit diagram shows that the positive terminal of the speaker is connected through a 100 ohm resistor to pin 8 of the Arduino. The negative terminal of the speaker is connected to one of the Arduino GND pins.

Building the Circuit

Start by connecting the negative speaker terminal (black wire) to a GND pin on the Arduino. Note that it is not necessary to use a breadboard when using a speaker that is taken from an old PC as it has a connector that a single core wire can be plugged into.

Loading the Program

The program to load is one of the built-in Arduino programs. Open it from within the Arduino IDE under:

File → Examples → 2.Digital → toneMelody.

Load the program to the Arduino and the melody will play immediately after loading. To play the melody again, press the reset button on the Arduino.

This project can be found on the Arduino website.

← Go back to Tutorial 6: Rising Pitch Siren

 

For more detail: Arduino Melody

 


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top