Game of Thrones Theme on Arduino




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.


You'll need:


Mini-speaker or buzzer

Infrared Sensor(logic LOW)


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


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.





    • Tiny Home Contest

      Tiny Home Contest
    • Creative Misuse Contest

      Creative Misuse Contest
    • Metalworking Contest

      Metalworking Contest

    10 Discussions

    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,


    int noteDurations[] = {



    Later on there's a little iteration trough the arrays.

    It think this is much easier to edit.

    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.

    1 reply

    Put this:

    if(digitalRead(sensorPin)) return;

    before every tone() or notone() function call.

    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

    This is really cool. I'm going to make something like this for school. ;)