BREAKING NEWS

28 October 2015

24-hour Animal Crossing Clock Using Arduino


For those that don't know, the game series Animal Crossing, which first began on the Nintendo GameCube in America, stakes its innovation around a 24-hour gameplay mechanic. Even when the player isn't playing the game, events are still going on. The game changes lighting based on time, and even changes the seasons based on the time of the year. Shops open and close, bugs and fish appear and disappear, and villagers wake up and go to sleep. These events are all based around a real-world 24-hour clock.
One way that Animal Crossing immerses the player in this 24-hour concept is by having a full-day cycle of music, with one looped song playing per hour. This aspect of the game is what inspired this project. I enjoy the GameCube version of Animal Crossing's soundtrack greatly, and I thought it would be cool to have that music constantly playing in my house without needing my laptop indefinitely. If you would rather use your laptop for playing Animal Crossing music throughout your day, just visit http://tane.us/ac/

Step 1: Gather the Parts

For this project, I used:
  • ARDUINO Uno and ARDUINO 1.0.6
  • Breadboard with plenty of spare wires
  • ARDUINO SD Shield (Seeed Studio version)
  • 4GB Micro SD Card
  • 1Watt 8Ohm speaker
  • 1 Transistor P2N2222AE12 (obtained from the ARDUINO starter kit)
  • Animal Crossing GameCube Soundtrack*
  • Audacity
  • TMRpcm ARDIUNO library properly installed
*note: You can use any files you'd like and loop them for as long as you'd like. I only chose Animal Crossing because I enjoy the game's music.

Step 2: Assemble the hardware

Make sure the SD Shield is properly attached to the ARDUINO. There are test files to ensure that it works included with the ARDUINO program on the PC. Set up the transistor facing frontwards on the breadboard and plug the positive end of the speaker into the right end of the transistor. The negative end goes into a ground on the ARDUINO. The middle port of the transistor plugs into the '9' port. the leftmost port of the transistor plugs into the 5V port on the ARDUINO. Make sure to hook up the ARDUINO to a PC as well.

Step 3: Make the Sound File

Use Audacity to make your own file. I made mine 24 hours long, and you can loop yours as short or long as you'd like. If you're pursuing an Animal Crossing theme like me, you'll want to cut and loop each individual hour's theme for an hour's length. I added a simple fade effect for the final 15 seconds of the hour to make the transitions smoother. After putting all of the sound files into one large file, I made sure the Project Rate was at 16000 Hertz, the tracks were mixed down into mono, and the file was exported as an 8-bit WAV file. Make sure to name your file with eight characters or less, or else the ARDUINO won't work with the file. Put the file onto your SD card.

Step 4: Setting Up the Program

You can use this program as a guide, but make sure to change the file name to what you used. Some notes: As stated in the "parts needed" section, make sure you download and properly install the TMRpcm library. The speaker will not work otherwise. Also, the delay function used in this program is 24 hours in milliseconds. This was implemented to make the sound file loop after 24 hours as was originally intended. If you wish to loop your sound for a different amount of time, change the milliseconds accordingly.
#include
#define SDPIN 4
#include
File myFile;
TMRpcm tmrpcm;
char mychar;
void setup() {
Serial.begin(9600);
tmrpcm.speakerPin = 9;
tmrpcm.setVolume(5);
}
void loop() {
if(!SD.begin(SDPIN)) {
tmrpcm.play("24HRLOOP.WAV");
delay(86400000);
}
}

Step 5: Using Your Device!

I started my loop at the 9AM theme, so that's when I start my clock. After starting it once, as long as I have it plugged in, it'll never stop! Enjoy the slow insanity that will ensue while you listen to your loop day on and day off.

Share this:

Post a Comment

 
Back To Top
Distributed By Blogger Templates | Designed By OddThemes