
Using a Piezo Buzzer — SIK Circuit 11
ལམ་སྟོན
Parts & Introduction
Parts & Introduction
A piezo buzzer converts electrical signals into sound. Using Arduino's built-in tone() function, you can play specific musical frequencies. This sketch plays a simple melody using character arrays for notes and integer arrays for timing.
Parts Needed
- 1x Arduino Uno + USB cable
- 1x Breadboard
- 1x Piezo Buzzer
- 3x Jumper Wires
Note Frequency Reference
| Note | Freq |
|---|---|
| c | 262 Hz |
| d | 294 Hz |
| e | 330 Hz |
| f | 349 Hz |
| g | 392 Hz |
| a | 440 Hz |
| b | 494 Hz |
| C | 523 Hz |
གོམ་པ་འདིའི་རྫས་རིགས:
SparkFun Inventors Kit - V3.21 kit
Arduino Uno R31 piece
Breadboard1 piece
Jumper Wires2 piecesལག་ཆས་དགོས་མཁོ:
Hardware Hookup
Hardware Hookup
Wiring Instructions
- Place the piezo buzzer in the breadboard. It has two pins — one marked with "+".
- Connect the positive pin (+) to Arduino Digital Pin 9 (PWM).
- Connect the negative pin to GND.
Tip: If the buzzer doesn't fit easily, try rotating it slightly to align with diagonal breadboard holes.
གོམ་པ་འདིའི་རྫས་རིགས:
Breadboard1 piece
Jumper Wires2 piecesArduino Code
Arduino Code
Open the Arduino IDE and upload the following sketch to your Arduino board.
གོམ་པ་འདིའི་རྫས་རིགས:
Arduino Uno R31 pieceལག་ཆས་དགོས་མཁོ:
Test & Experiment
Test & Experiment
What You Should See
You won't see anything — but you'll hear a melody playing from the buzzer! The song plays once and stops.
Troubleshooting
- No sound: The buzzer pins are easy to misplace on the breadboard. Double-check placement and make sure both pins have good contact.
- Want it to stop: Pull the buzzer out while working on other things, plug it back in to test.
Experiments to Try
- Remove the
while(true){}line to make the song loop continuously. - Write your own melody by changing the
notes[]andbeats[]arrays. - Add more notes by expanding the
frequency()function with sharps and flats. - Use a button (from Circuit 5) to trigger the melody on demand.
རྫས་རིགས
5- $105.00
- 1 pieceས་ཆ་འཛིན
- 1 pieceས་ཆ་འཛིན
- Piezo Buzzer1 piece
You can swap these in
Can't get one of the materials? Swap it for an equivalent — these work just as well.
- Instead of Arduino Uno R3, try:
Prototyping Shield for Arduino Uno (3-Pack)
Arduino Uno R3 Board
Arduino Uno - Instead of Breadboard, try:
Solder-able Breadboard - Instead of Piezo Element, try:
Extruder Screw Element (Replacement)
Recommended for this build
Products makers often use with builds like this one.
Resistor 330 Ohm 1/6 Watt PTH - 20 packUsed together and in similar builds
5mm LED Assortment Kit (300pcs, 5 Colors)Used together and in similar builds
Push Button - 33mmUsed together and in similar builds
Basic 16x2 Character LCD - 5VUsed in similar builds
Resistor 10K Ohm 1/6th Watt PTH - 20 packUsed together and in similar builds
PotentiometerUsed together and in similar builds
Servo MotorFrequently used with this build's materials
LED - RGB Diffused Common Cathode - 5mmFrequently used with this build's materialsRelated blueprints
Other builds that share materials, tools, or techniques with this one.






CC0 སྤྱི་དབང
བིལུ་པིརིན་ཊི་འདི་CC0 འོག་བཀྲམས་ཡོད། ཁྱེད་རང་གིས་ཆོག་མཆན་མ་བཞེས་པར་ཕབ་ལེན་དང་བཟོ་བཅོས། བགོ་བཤའ། དགོས་མཁོ་གང་ལའང་བཀོལ་སྤྱོད་བྱས་ཆོག
བཟོ་མཁན་ལ་རྒྱབ་སྐྱོར་བྱེད་པའི་ཆེད་ཁོང་ཚོའི་བིལུ་པིརིན་ཊི་བརྒྱུད་ཐོན་སྐྱེད་ཉོ། བཟོ་མཁན་གྱིས བཟོ་མཁན་གྱི་ཁེ་ཕོགས ཚོང་པས་གཏན་འཁེལ་བྱས་པ། ཡང་ན་བིལུ་པིརིན་ཊི་འདིའི་པར་གསར་བཟོས་ཏེ་ཁྱེད་རང་གི་བིལུ་པིརིན་ཊི་ནང་མཐུད་སྦྲེལ་བྱས་ཏེ་ཡོང་སྒོ་བགོ་བཤའ་བྱེད།