0% found this document useful (0 votes)
253 views

Happy Birthday Song Using Arduino Uno: Step 1: Material Required

This document describes how to build a circuit using an Arduino Uno and buzzer to play the "Happy Birthday" song. It provides instructions on the required materials, circuit diagram, Arduino code, and testing. The code uses notes and beats arrays to control the buzzer playback. Connecting the buzzer to pin 8 on the Arduino, the code loops through each note, playing the corresponding tone for the specified duration.

Uploaded by

Jonny Hayashi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
253 views

Happy Birthday Song Using Arduino Uno: Step 1: Material Required

This document describes how to build a circuit using an Arduino Uno and buzzer to play the "Happy Birthday" song. It provides instructions on the required materials, circuit diagram, Arduino code, and testing. The code uses notes and beats arrays to control the buzzer playback. Connecting the buzzer to pin 8 on the Arduino, the code loops through each note, playing the corresponding tone for the specified duration.

Uploaded by

Jonny Hayashi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

instructables

Happy Birthday Song Using Arduino Uno

by Technoesolution2020

Hello friends welcome back to "Techno-E-solution" in | YOUTUBE | INSTAGRAM | FACEBOOK | INSTRUCTABLES |


todays article I'll show "How to play Happy Birthday DAILYMOTION | HACKSTER |
Song Using Arduino & Buzzer" in few steps. Most of the
peoples are from technical background so I decide to
wish that peoples means my besties in techy style so If you like this project subscribe us on Youtube, So
build this project. This is a beginners level project so let's without wasting time Let's get started..............
make it.

Follow Me On :-

Step 1: MATERIAL REQUIRED

To make this project we need some components (Best Buy Link Provided):-

1. Arduino Uno X 1
2. Buzzzer X 1

[ Above link are a liated if you buy from above link, We got some bonus from it. ]

Happy Birthday Song Using Arduino Uno: Page 1


Step 2: CIRCUIT DIAGRAM

Follow the circuit diagram to make the connection. double-check your engineering les.

Arduino >>> Buzzer NextPCB is certi ed by IATF16949, ISO9001, ISO14001,


UL, CQC, RoHS and REACH; more importantly, we handle
D8 >>> +ve the whole process including the PCB prototype, PCB
manufacturing, PCB assembly, testing, and nal
GND >>> -ve shipment. We are capable of assembling BGA, Micro-
BGA, QFN, and other leadless package parts. We also
Next PCB have an online parts shop, you can choose any parts you
need.

NextPCB is a high-quality PCB Manufacturer. With If you want a Printed circuit board go through the NEXT
professional PCB manufacturing capabilities, our PCB PCB
engineers with more than 10 years of experience will

Happy Birthday Song Using Arduino Uno: Page 2


Step 3: ARDUINO CODE

/*
Hello Friends Welcome to Techno-E-Solution
Here is the Code For Happy Birthday Song
*/

int speakerPin = 8;
int length = 28; // the number of notes
char notes[] = "GGAGcB GGAGdc GGxecBA yyecdc";
int beats[] = { 2, 2, 8, 8, 8, 16, 1, 2, 2, 8, 8,8, 16, 1, 2,2,8,8,8,8,16, 1,2,2,8,8,8,16 };
int tempo = 150;
void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tone);
digitalWrite(speakerPin, LOW);
delayMicroseconds(tone);
}
}
void playNote(char note, int duration) {
char names[] = {'C', 'D', 'E', 'F', 'G', 'A', 'B',

'c', 'd', 'e', 'f', 'g', 'a', 'b',

'x', 'y' };

int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014,

956, 834, 765, 593, 468, 346, 224,

655 , 715 };

int SPEE = 5;
// play the tone corresponding to the note name
for (int i = 0; i < 17; i++) {
if (names[i] == note) {
int newduration = duration/SPEE;
playTone(tones[i], newduration);

}
}
}

void setup() {
pinMode(speakerPin, OUTPUT);
}
void loop() {
for (int i = 0; i < length; i++) {
if (notes[i] == ' ') {
delay(beats[i] * tempo); // rest
} else {
playNote(notes[i], beats[i] * tempo);
}
// pause between notes
delay(tempo);
}
}

Happy Birthday Song Using Arduino Uno: Page 3


Step 4: DEMO & TESTING

If you like this project subscribe us on youtube for more interesting projects :-

https://www.youtube.com/embed/D8FZCPmeKzs

Step 5: NEXT PCB

NEXTPCB PCB MANUFACTURER COMPANY the speed of PCB and assembly manufacturing with
e cient collaboration and quality assurance.
NextPCB was founded in 2004 and has since established
itself as a turnkey PCB manufacturing and assembly NextPCB provides a variety of PCBs with optimistic
factory for prototype quantities as well as small-volume capabilities. Starting from the single-layer they provide
to big-volume production. PCB services up to 20 layers, with a board thickness of
0.6mm to 2.5mm with a tolerance of 10% and much
Why NEXTPCB? more capabilities. Check out the manufacturing
capabilities of NextPCB for better production of your
NextPCB provides one-stop services for PCB with PCB.
professional PCB manufacturing practices ful lling the
advanced design requirements. The company provides

Happy Birthday Song Using Arduino Uno: Page 4

You might also like