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
You'll need:
Arduino
Mini-speaker or buzzer
Infrared Sensor(logic LOW)
Wires
Working Brains
Circuit Description:
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
of arduino
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
ENJOY!!! :D
11 Comments
4 years ago
copied and pasted the code into arduino and the system found multiple things wrong with it, basically every line was wrong
8 years ago
As I looked at your code i didn't find it that easy.
My way to melodies on arduino is creating an 1-dimensional array including the notes and another including the note-"value" like this:
int melody[] = {
NOTE_E7, NOTE_E7, 0, 0, NOTE_E7,
0, NOTE_C7, NOTE_E7, 0,
NOTE_G7, 0, 0, 0,
NOTE_G6, 0, 0, 0,
...
};
and
int noteDurations[] = {
12,12,12,12,
12,12,12,12,
12,12,12,12,
12,12,12,12,
...
};
Later on there's a little iteration trough the arrays.
It think this is much easier to edit.
8 years ago on Introduction
Hi There, I'm very thrilled I finally found this! But I want to link it to a LDR. So if the light on the LDR darkens I want the tune to immediately stop. Can you, or anyone, help me with this? Now it continues playing until the tune is ended and only then the LDR reacts.
Reply 8 years ago
Put this:
if(digitalRead(sensorPin)) return;
before every tone() or notone() function call.
8 years ago on Step 2
Hi, I just made this a couple of days ago. I was wondering if you could explain to me how to make/change the songs used in the code? Because I would like to make it so that whenever I go inside my room, the "discovery/puzzle solved" from LoZ would play with this
9 years ago on Introduction
This is really cool. I'm going to make something like this for school. ;)
9 years ago on Introduction
Enjoyed this one!... are you using a speaker or a piezo buzzer?
Reply 9 years ago on Introduction
speaker from an old phone..
9 years ago on Introduction
This is pretty cool....!
Reply 9 years ago on Introduction
Thanks.:)
9 years ago on Introduction
Yeah might have to make this to aggravate the gf.. LMAO