Going Further

The basic circuitry can be reused in a number of costume ideas:
  • For the December holidays, a seasonal tune may accompany a blue light for Hanukkah or a twinkling star for the top of a Christmas tree.
  • The electronics fits easily fits in a moderate or larger size hat.
As far as music and sound, this project just loops one MP3. You can have additional music tracks (track002.mp3, track003.mp3 and so forth) and play them either sequentially, or my favorite: trigger different sound tracks based on different buttons pressed on the remote control.

To use your own remote and differentiate buttons:
  1. Ensure the serial commands are printing to the Arduino IDE serial console.
  2. When a sound is playing and you press a button, the hexadecimal number for the key press will be displayed.
  3. Write that down. Find the others you want the same way.
  4. Generate code similar to that below (assuming the two hex values represent the codes you wrote down earlier):
Download: file
char track_name[13];
...
if(results.value == 0xDEADBEEF) {  // code was found to be the "1" key
  track_name="track001.mp3";
} else if(results.value == 0xFEED1234) { // code was found to be the "2" key
  track_name="track002.mp3";
}
Your key values will vary. These codes are examples only and do not match any particular remote.

Then to play the correct file, replace
Download: file
musicPlayer.startPlayingFile("track001.mp3")
   with
musicPlayer.startPlayingFile(track_name)
If you want to simplify the project, you can remove the Neopixel and code and/or remove the IR receiver and code. If you do not have a way to mute the sound, it could be annoying after a while listening to the same tune.
This guide was first published on Oct 24, 2013. It was last updated on Oct 24, 2013.
This page (Going Further) was last updated on Jan 15, 2020.