Jingle Bells with a Buzzer and Arduino
How to make your Arduino play Jingle Bells with a little buzzer and a 220ohm resistor.
Christmas is coming and everyone is about to put wonderful colored trees in their houses. This year we bought a new tree but we didn’t change all the decorating parts like balls and lights. We also had a little red and white box shaped like Santa Claus’ head that used to play Christmas jingles with some sort of a buzzer (so monotone sounds were produced). But the problem is that it broke down since it was probably too old.
Since I had an Arduino UNO at hand, I built a similar thing with it.
Here you can find the Github repo for the code.
Parts
- Arduino Uno (or whatever version you might already have)
- A buzzer
- A 220Ω resistor (but you don’t need it if you want to destroy your buzzer!)
- A case, wires, and a little breadboard
Wiring
Let’s get dirty
I started developing it with the buzzer and the resistor on the breadboard. (as you can see from the photo I thought to use a potentiometer to adjust the volume, but the one that I have is 50K and it’s just. too much for the buzzer)
I took a case and made two holes in it (one for the wirings and another for the 5v power supply) and I put the Arduino inside it and the breadboard outside.
On Github’s readme, you can find two other ideas I left there if you’re keen to improve this project.
The code
This isn’t the first time that I have made something like this. The first time I used a buzzer, I translated the imperial march of Star Wars notes to frequencies in an Arduino sketch, calculating manually the pauses and adding them line by line. I lost that piece of code and now I coded this song in a cleaner way using cycles and arrays.
Take a look:
And that is all
I hope that if you did or will do something along the lines of this little thing, you’ll link it to me through social networks, but most importantly I wish you a Merry Christmas!
Enjoy 🎅🎄