Orchestra in a Box


The MusicBox is a project using metal circles along with analog & digital inputs and outputs to produce unexpected “Tinkle” sounds, which are played in relation to a standard tone originating from a piezo buzzer. It shows how ‘real-world’ sound is different from the “digital” aspect of an electronic device as the buzzer.


A servo attached to pin 3 moves to certain angles so that it will touch the metal circles hanged in the box, producing a tempo. I defined two positions of the servo and two waiting times (one longer and one shorter) which I use to create the tempos.

We used the following materials:

  • 1x potentiometer
  • LEDs
  • push buttons
  • 10KΩ resistors
  • jump wires
  • 1x Piezo buzzer
  • Arduino UNO board
  • USB cable
  • A cardboard box
  • A wood board

Code for the Servo


Code for the Buttons

In Action


  • The music from the Servo mechanism and the speaker didn’t synchronize like we wanted them to. This can be resolved by writing the code for the Servo, in terms of its delays (AKA the rhythm), in accordance with the tempo of the music.
  • I originally wanted to use 3 buttons that would play 3 different songs when pressed (as with the 2 in the code), but what actually occurred was that when one of the buttons was pressed, both songs would combine and the play and nothing would play when the other was pressed.

One thought on “Orchestra in a Box

Leave a Reply

Your email address will not be published. Required fields are marked *