Sophie's Music Box, Light Show and Jewelry Box




I'm a retired computer programmer, hardware designer and musician.
I just finished building a music box / light show / jewelry box for my friend Sophie. An Arduino compatible microcontroller is used to generate the music box sound and to control the lights. The Arduino code emulates the sound of an old mechanical box which used a rotating drum with tabs that plucked tune metal tines to produce the note. The code is capable of three note polyphony. This is very easy to build for anyone who can read a schematic. Pictures of the build and links to the Arduino sketch can be had at the link below.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Arduino Challenge

Participated in the
Arduino Challenge

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    19 Discussions


    6 years ago on Introduction

    Thanks! Also, I have another question; how does the tilt switch work? I just noticed that you glued on a gold cylinder onto the lid of the box. Is that a special material I need to buy? Sorry to bug you with these questions. I'm a total beginner at this.

    1 reply

    The tilt switch is just a switch. In one orientation it is off and in another it is on. There is nothing special to buy except the tilt switch itself. When the music box is opened the switch turns on and the arduino see this and starts the music.

    The switch is available at:


    6 years ago on Introduction

    Hi, I love your project :) I'm actually trying to recreate this, and use different songs in the music box. Where did you get the to generate the values of the notes?

    1 reply



    All the support files are contained in a jar file available here:

    Note this jar is not executable; it is just an archive of all of the support programs. Unjar this file to get at its contents.

    Good luck,

    Craig Lindley


    7 years ago on Introduction

    great project! I would like to do something similar using an Arduino Uno. I am having trouble compiling your code, though; I am getting errors about some of the variables not being "declared in this scope," such as OCR48. Do you know how to fix this?

    7 replies

    The problem is the Arduino I used has a different processor than that used on the UNO which has different instructions. The UNO doesn't have fast enough PWM to allow the music box to sound its best. The code can be made to run on the UNO but it would be some work. If you want to see the types of changes required you should download my code from the April Issue of Nuts and Volts magazine.

    Good Luck,

    Craig Lindley

    Cool, I'll check out your article. For anyone else that's interested, here's a link:

    Sorry to ping you again, but it seems like the musixboxsupport.jar file on the Nuts and Volts site doesn't work. Do you have an updated version?

    The jar file is not meant to be executable. It is just an archive of the various java programs that make up the music box support code. Unjar the jar file to get to the different programs.

    Thanks for your help. I've started to work on a programmable music box that is based on your code. Here's a video of a prototype:

    I designed my own custom Arduino and am still learning about microcontrollers, but I found that the response of my Arduino is slower than an Uno; when I upload your code to my Arduino, the songs play almost twice as slow as on an Uno. I'm using an external 8MHz crystal on my board; do you think adding a 16MHz crystal like the Uno would get rid of this problem?

    Thanks for your help!

    The crystal is definitely the issue. The timers used in the music box code are driven directly from the system clock which is half as fast as required. Changing the crystal to 16 MHz will solve your problem.


    7 years ago on Introduction

    this looks awesome! :O

    but i don't understand nothing of this kind of stuff (electronics and such things...)

    but i think i'm gonna try, a friend of mine wishes she had a music box, as i can't find one and the ones i do are too expensive, i'd try this :) and it's better when it's made from us as a gift :)

    i looked up for the Pro-Micro Arduino microcontroller you used in the site you mentioned, they have two, you used the 5V/16MHz one right?

    could you somehow provide me/us a step-by-step for the electronic part? i mean, how do you set up the chip to play the musics you want? :x

    2 replies

    Reply 7 years ago on Introduction

    The 5 volt Pro Micro part is the one you want.

    At the present time the music box plays the three songs that I picked. To make it play other songs you will need to download the music box support jar file from the nuts and volts magazine ( website for the April 2012 issue where I wrote about how the music box works.

    The jar file you download is not executable. You must unjar this file to get to the various programs inside. The midi parser is the file you will need to run on a midi file of the song you want the music box to play. The data spit out by the java code must be copied and pasted into the Arduino code and the code recompiled.

    Hope this helps.


    Reply 7 years ago on Introduction

    Got it! I'll have get the hang on those programs xP but thanks :D as soon as i've time i'll put my mind into this

    thanks alot!

    (in time, i'll probably be back with more questions :P)


    7 years ago on Introduction

    A nice display. 

    I'm a little confused by your schematic.  Where is the power input?  (I think I see it now... it is powered from the USB port?)

    Can you explain the RC network between the 'RAW' pin and the Grounds? (Is it some kind of power conditioning for the LPD8806's?)


    3 replies

    Reply 7 years ago on Introduction

    The RC filter forms a circuit which prevents the electronic PWM noise of the LPD8806s from being feedback to the microcontroller and being audible in the speaker. Without this filter when the LED strip's PWM circuitry is hard at work you will hear a high frequency whine that is very annoying. The noise is greatest when mixing colors as some of the color components are dimmed in relation to others. This filter eliminates this noise almost completely making the music box sound much better. Hope this makes sense.