Introduction: Friday the 13th Musical Cabin

About: Me? Oh, I like bunny rabbits with floppy ears and chestnut fur.

Friday the 13th (NES)

Friday the 13th is still my favorite game to play on the Nintendo Entertainment System (NES). It was developed by Atlus, source code copy written, and game published by LJN in 1989, and NES 8-bit logo copy written by Paramount Pictures in 1988.

It is considered, by some, to be one of the worst video games in history. The criticism focuses on how it is a bad adaptation of the films, not scary enough as a horror game, and too hard to complete. Unfortunately, reviewers don't seem to consider the fact that the Entertainment Software Rating Board (ESRB) did not exist back in 1989. The game doesn't follow the movies exactly, probably to access a wider audience; it can be played by adults or children. And, let's face it, if watched straight through, the series is very graphic and has many inconsistencies itself! Added zombies into the mix? Why not? Zombies are extremely popular now in our culture and media. It's kind of creepy to think about all those dead counselors coming back from the dead via the same curse that afflicts Jason himself!

Also, there are different types of of horror for us to experience. For example, to name just two, there's a creepy scary and a surprise! scary. This game seems to cover those pretty well since you are wondering around the woods, caves, and lake and a seemingly abandoned camp fighting zombies and racing time (it literally changes from day to dusk to night, making it even creepier) to save kids in cabins from the antagonist Jason Voorhees. The surprise factor comes from simply walking around in a cabin and (a very strong and quick) Jason Voorhees jumping out and fighting you!

One thing I really love and will always remember about the game was the awesome music played in the cabins and on the map screen. It is very melodic, yet maintains a creepy, dark, haunting theme. The original instrument that was used while writing the song was a pipe organ, as later stated by the author Hirohiko Takayama He programmed the song in Assembly using a sound driver written by Tsukasa Masuko. But in this tutorial, we are going to be programming it ourselves in C++ for Arduino!

In this tutorial, we will be painting a birdhouse cabin, writing C++ code using the Tone library of the Arduino, and putting it all together to make a musical tribute to my favorite NES game, Friday the 13th.

Required Hardware

  1. Wooden birdhouse cabin
  2. Arduino UNO/Micro
    1. 1/8" Stereo audio jack
    2. Momentary push button
    3. Wires
    4. Speaker with 1/8" stereo plug
    5. 10k and 1k Ohm resistor
  3. Blue paint, brown paint & black Sharpie marker
  4. Small battery-powered tea-light candle

Required Software

  1. Arduino IDE and the Tone library

Step 1: Hardware Schematic


The schematic for this project is very simple since we only have three parts, the Arduino, push button (to start playback), and the speaker.


It's okay to shunt the pins 12 and 13 on the UNO for dual sound output to the same speaker. A potentiometer can be put in place of the 1K Ohm resistor for volume control.

Push Button

The momentary push button switch goes to pin 2 (specifically for my code, you can update the code and use any output pin you'd like). When the button is pressed, the song will begin playing and play as many times as we specify in the code.


This project can be battery powered, powered via the DC power connector, or simply USB B connector on the Arduino UNO itself. I recommend at least using a on/off toggle switch inline with the battery is being powered by battery.

Step 2: The Wooden Cabin

The Cabin

The cabin I used in the pictures and videos is the Artminds™ Log Cabin Birdhouse purchased from Michael's craft store, item #10385254 It comes in raw wood, so it will need decorated to look like that of the cabins in Friday the 13th. For this I used the Craft Smart® Outdoor Acrylic Paint (also purchased from Michael's craft store) in standard Blue. This blue is pretty close to the blue color used in the games for the cabins at night.

It's a nice cabin replica, since it actually replicates not only the smaller cabins, but the larger cabins also, by having the vertical lines on the roof. I accented each line using a black Sharpie marker after painting the cabin.


The electronic no-flame tea light is used to replicate the famous fireplaces in the large cabins of the game. It works quite well and adds a unique mood to the cabin when turned on and placed inside.

Inside the Cabin

To fix the Arduino into the cabin, I cut a piece of solid cardboard slightly larger than the width of the cabin, placed the Arduino onto the cardboard and shoved it up into the roof area of the inside of the cabin. This required me to break off the bottom panel (floor) which was helpful for painting the blue and brown ground.

Step 3: Source Code

The full listing of the source code can be obtained from my profile, here. I will cover a few key concepts of the code for those new to Arduino development.

Tone Library

The tone library can be obtained on Google-Code from here. This library is incredibly simple to use. Once we have the zip file extracted to the libraries directory in our Arduino IDE installation root directory, we can begin playing tones. This library is actually perfect for this project since it produces, like many electronic devices, square sound waves which is what was also produced in the original NES hardware. Let's take a look at a quick example. Since we have pins 12 and 13 going directly into the speaker, we need to initialize them using two Tone objects as,

Tone tone1;<br>Tone tone2;

next, in our setup() loop, we initialize them for sound output with the following two lines of code,


Now, we can simply call the play() method on each of the Tone objects as,,900);

which in the above case, would play a 440 (the musical note: A4) for 900 milliseconds (ms). To play two tones simultaneously is easy. As of the writing of this tutorial, the play() method take an integer as a frequency value, so frequencies with fractions in them, such as B4 which is actually 493.883hz, will need to be rounded up or down. The play() method forks, and the workflow continues to the next line of code. For example the code,,900);,900);<br>delay(900);<br>,900);<br>,900);<br>delay(900);

will play the tones 440hz and 122hz simultaneously for 900ms and while doing so the Arduino pauses using the delay() function for 900ms. Immediately after, the tones 622hz, and 784hz are played simultaneously for 900ms and the Arduino pauses, again, for 900ms while playing the tones.

The delay() is important to remember as the play() method forks. One good example is during a for() loop. If we want to play a tone several times in a row and don't pause the Arduino with delay(), it will sound as if it plays the tone we specify only once!

Also remember that there are many references that can be easily found online with a search engine to find approximate frequencies of notes played on a piano that can be referenced while making projects that play songs. For our song we don't have to worry about figuring them out since I have already done that for us and put them into the C++ code. To show a small example though, we use the following frequencies for the verse section.

int part1[] = {740,494,587}; // 740hz (F#5), 494hz (B4), 587hz (D5)
int part2[] = {659,466,554}; // 659hz (E5), 466hz (A#4), 554hz (C#5)

The bass frequencies (there are only two) are 122hz (~B2) and 116hz (A#2). The bass lasts 3 notes, so to play them simultaneously, we use the custom defined playSection() function in the C++ code.

Push Button Code

The push button code uses a simple digitalRead() function to check for voltage coming through on the pin specified. In our case it's pin 2. It doesn't require a special third-party library to use.

In our setup() function, we need to initialize the pin for input and use the following line of code to do so,

pinMode(2, INPUT);

Now in our loop() event-handling looping function, we can simply take a reading of the voltage using the digitalRead() function, as,


If the returned value is equal to the constant for HIGH voltage (1), then we begin playback of the music. Otherwise it should return as LOW (0).

Step 4: Video Demonstration and Further Reading


Video demonstration of unpainted cabin box, here:

Video demonstration of updated song output here:

Playing the (lower octave) Cabin Theme from the Arduino here:

Further Reading

My walk-through on the subject of how to beat Friday the 13th for NES, and in 10 or 15 minutes:


Wikipedia - Friday the 13th (NES)

Video Game Music Preservation Foundation

Thank you for reading!

Halloween Decor Contest

Participated in the
Halloween Decor Contest

Microcontroller Contest

Participated in the
Microcontroller Contest

Tech Contest

Participated in the
Tech Contest