SlideShare a Scribd company logo
67
PROJECT 7 : Musical Notes
What we are making
In this project, we’ll see how to generate musical tones in Arduino
with a simple buzzer !
So, lets make some music - aka noise :)
PARTS :
+ This section lists the parts you
will need to complete the project.
JUMPER
WIRES
x 2 x 1
PIEZO
BUZZER
Parts Required:
PROJECT 7
68Step 1:
PROJECT 7 : MUSICAL NOTES
Connect a Black jumper wire: UNO GND pin <-------> 30-a on Breadboard
Connect a Red jumper wire: UNO pin 8 <-------> 30-j on Breadboard.
Note that the color of the jumper wires do not matter.
Red and Black jumper wires are used as convention for positive
and negative terminals respectively.
69Step 2:
PROJECT 7 : MUSICAL NOTES
Connect the longer-leg of a Piezo Buzzer to 30-f.
Connect the other end to 30-e.
This completes our circuit !
70Step 3:
Open Arduino software (IDE) on your computer and write below code in it:
Now press the upload button in Arduino software.
BINGO !!
Your Arduino should be playing Sa-Re-Ga-Ma-Pa-Dha-Ni-Sa now !
71
Explanation:
In our code, we declare 2 variables:
int wait - This variable is used to store the value 500 which is
repeatedly passed to the tone method later on.
int pin - This is the pin number to which our Piezo Buzzer is connected
(via the jumper wire). In the setup() method, we set pin 8 as OUTPUT so
that we can output avoltage on this pin later on.
Question:
PROJECT 7 : MUSICAL NOTES
A Piezo buzzer typically does exactly as its name suggests. You put a
voltage across its terminals and you get a beeping sound/noise.
But there is more to it. If you feed it with a pulse, instead of a DC voltage,
it will sound at the frequency of that pulse and thus can play a note / tone!
Thankfully there is an in-built tone() function which takes the pin number,
frequency and the duration as parameters.
Remember that each note of Sa, Re, Ga, Ma, Pa, Dha, Ni, Sa has a
different frequency. We pass this frequency to the tone() function
to get the corresponding sound.
72
Answer: Try it before reading further.
The resistor will take limit the current flowing to the Piezo Buzzer.
Thus the sound will be of lower volume.
What will happen if we put a resistor in the circuit ?

More Related Content

PDF
Project 8: Make Your Own Piano
PPTX
KEYBOARD INSTRUMENT
PPTX
PDF
Maker Education : Bob the Robot
DOCX
Vs ti sound effects task 8
PPTX
Robotics Session day 1
PDF
Build cool stuff with arduino for sci camp 16 dec13
ODP
Auberon lol ministry_fix
Project 8: Make Your Own Piano
KEYBOARD INSTRUMENT
Maker Education : Bob the Robot
Vs ti sound effects task 8
Robotics Session day 1
Build cool stuff with arduino for sci camp 16 dec13
Auberon lol ministry_fix

Similar to Project 7: Musical Notes (20)

DOCX
Lab Activity
PDF
295889096 music-reactive-multicolor-led-lights
PDF
Build a Singing Justin Bieber Cutout
PDF
PDF
[Best]Chromatic Tuner Project Final Report
PPTX
Electronz_Chapter_15.pptx
PDF
iPhone 6 has no external sound whe playing films
DOCX
Neno Project.docx
PPTX
Smart Blind stick by using arduino uno and sensor
PPTX
2012 1 arduino_rs232
PPTX
Session3
PDF
Arduino
PDF
Electronic musician by letruongan
PPTX
837452553-Arduino-PPT used for projects for UG Students
PPTX
Project 1 Tutorial 1a rev 2.pptx
PPTX
Electronz_Chapter_7.pptx
PDF
Polyanna manual
PDF
snake game
PDF
PORTABLE WIRELESS AMPLIFIER BLUETOOTH - 5 Core
Lab Activity
295889096 music-reactive-multicolor-led-lights
Build a Singing Justin Bieber Cutout
[Best]Chromatic Tuner Project Final Report
Electronz_Chapter_15.pptx
iPhone 6 has no external sound whe playing films
Neno Project.docx
Smart Blind stick by using arduino uno and sensor
2012 1 arduino_rs232
Session3
Arduino
Electronic musician by letruongan
837452553-Arduino-PPT used for projects for UG Students
Project 1 Tutorial 1a rev 2.pptx
Electronz_Chapter_7.pptx
Polyanna manual
snake game
PORTABLE WIRELESS AMPLIFIER BLUETOOTH - 5 Core
Ad

Recently uploaded (20)

PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
RMMM.pdf make it easy to upload and study
PDF
Computing-Curriculum for Schools in Ghana
PDF
SOIL: Factor, Horizon, Process, Classification, Degradation, Conservation
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Empowerment Technology for Senior High School Guide
PDF
IGGE1 Understanding the Self1234567891011
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
UNIT III MENTAL HEALTH NURSING ASSESSMENT
PDF
Hazard Identification & Risk Assessment .pdf
PPTX
Introduction to Building Materials
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Orientation - ARALprogram of Deped to the Parents.pptx
RMMM.pdf make it easy to upload and study
Computing-Curriculum for Schools in Ghana
SOIL: Factor, Horizon, Process, Classification, Degradation, Conservation
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Empowerment Technology for Senior High School Guide
IGGE1 Understanding the Self1234567891011
Final Presentation General Medicine 03-08-2024.pptx
UNIT III MENTAL HEALTH NURSING ASSESSMENT
Hazard Identification & Risk Assessment .pdf
Introduction to Building Materials
Practical Manual AGRO-233 Principles and Practices of Natural Farming
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
What if we spent less time fighting change, and more time building what’s rig...
Supply Chain Operations Speaking Notes -ICLT Program
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Ad

Project 7: Musical Notes

  • 1. 67 PROJECT 7 : Musical Notes What we are making In this project, we’ll see how to generate musical tones in Arduino with a simple buzzer ! So, lets make some music - aka noise :) PARTS : + This section lists the parts you will need to complete the project. JUMPER WIRES x 2 x 1 PIEZO BUZZER Parts Required: PROJECT 7
  • 2. 68Step 1: PROJECT 7 : MUSICAL NOTES Connect a Black jumper wire: UNO GND pin <-------> 30-a on Breadboard Connect a Red jumper wire: UNO pin 8 <-------> 30-j on Breadboard. Note that the color of the jumper wires do not matter. Red and Black jumper wires are used as convention for positive and negative terminals respectively.
  • 3. 69Step 2: PROJECT 7 : MUSICAL NOTES Connect the longer-leg of a Piezo Buzzer to 30-f. Connect the other end to 30-e. This completes our circuit !
  • 4. 70Step 3: Open Arduino software (IDE) on your computer and write below code in it: Now press the upload button in Arduino software.
  • 5. BINGO !! Your Arduino should be playing Sa-Re-Ga-Ma-Pa-Dha-Ni-Sa now ! 71 Explanation: In our code, we declare 2 variables: int wait - This variable is used to store the value 500 which is repeatedly passed to the tone method later on. int pin - This is the pin number to which our Piezo Buzzer is connected (via the jumper wire). In the setup() method, we set pin 8 as OUTPUT so that we can output avoltage on this pin later on.
  • 6. Question: PROJECT 7 : MUSICAL NOTES A Piezo buzzer typically does exactly as its name suggests. You put a voltage across its terminals and you get a beeping sound/noise. But there is more to it. If you feed it with a pulse, instead of a DC voltage, it will sound at the frequency of that pulse and thus can play a note / tone! Thankfully there is an in-built tone() function which takes the pin number, frequency and the duration as parameters. Remember that each note of Sa, Re, Ga, Ma, Pa, Dha, Ni, Sa has a different frequency. We pass this frequency to the tone() function to get the corresponding sound. 72 Answer: Try it before reading further. The resistor will take limit the current flowing to the Piezo Buzzer. Thus the sound will be of lower volume. What will happen if we put a resistor in the circuit ?