Introduction: Game of Thrones Theme on Arduino
Hi everyone, because I'm a big fan of GoT, I decided to make my own version of GoT Theme opening sound track. I know little about notes and beats, by following simple piano tutorial in YouTube, using Arduino pre-built functions with tones, trial and error and patience for 400+ lines code, I came up with full playing GoT theme.
Someone asked me if I can make a device that play when he/she enter his/her room and Star wars theme will play. I'm not a big fan of Star wars, that's why I choose GoT. Because I put an Infrared distance sensor, you can place this project inside your CR while pooping and sitting on you porcelain throne.haha.
Step 1: HARDWARE
Mini-speaker or buzzer
Infrared Sensor(logic LOW)
I will not provide images for the circuit 'cause it so simple
1. Pin 4 of Arduino to buzzer/mini-speaker
2. Other terminal of buzzer/mini-speaker is connected to ground of Arduino
2. Pin 6 as input for you sensor signal pin, and the other two pins is for 5v and ground
3. And add power supply or battery on your Arduino
Step 2: SOFTWARE
I'm going to fix some notes. And for now, I'll provide partial of my code. Open my uploaded txt file and upload the code on your Arduino.
Some useful info.
1. In order to create or mimic notes using microcontroller, you need to oscillate an output with define frequency.
2. Defined frequency has corresponding note, like DO-RE-MI-FA etc.
3. Arduino uses pre-built function("tone( pin# , frequency)"), this function uses timer interrupt to make an oscillating square wave.
4. Beats can apply through delay functions.
5. If some melody are repeating, use for loop.
SUPER SIMPLE project