Music box

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

This is a project for a music box. It is not an ordinary music box as it doesn’t play songs but rather plays different musical tones when different sides of it faces up and gets a gentle tap.

Flip-n-shake/tap music box

You are given a well-decorated box, cube, with one musical note on each side,  flip it so that a desirable musical note faces up, shake or tap on the box, that note will play. When playing, the top side of box will glow with a certain color. Since there are 6 sides to a box, 6 notes can be associated with each side. I’ve built the prototype last weekend and managed to play a few simple songs by flipping and tapping on it. I am adding some video later this week. This box needs a lot of artistic touches in order to attract attentions. That is where I need some help. I hope to find some help at the Art Department. I imagine that when finished, two such boxes can be made so a person can pick them up with two hands and shake them to play as many as 12 notes. Many simple songs can be played with these two boxes.

Here is a demo:

This picture tells the inner working of the box prototype, an Arduino, a buzzer, and an accelerometer:

Please don’t mind the writings on the paper. I am looking for a house and I recycle/reuse paper 🙂

Stage 1: prototyping

The following is a video of the prototype. As you can see, the entire box is very ugly and needs a lot of artistic touch. I will post updates when I get more progress on it.

You have to crank your volume all the way up. I need a louder speaker and a lot of holes on the box!

Stage 2: adding light effects

Update: I’ve added some light effect and removed all the paper 🙂

You have to crank your volume all the way up. I need a louder speaker and a lot of holes on the box!

Stage 3: adding intelligence to the box

Now the box has a favorite tune. If you tap in the first 6 notes of this tune, the box will recognize it and plays the tune. In the future, I will purchase an MP3 shield to play high quality sound, like “Ah, that must have been my favorite tune, the XXX. I will play it for you”. Then it plays the tune in hi-def audio. I’ve removed the box top to make sure the sound volume is loud enough.

Stage 4: adding MP3-quality sound to the box

Check back later for this stage!


Stage 5: adding artistic touch to the box

Check back later for this stage!

Stage 6: adding lights to each side of the box

Check back later for this stage!

Stage 6: displaying the box in public place

Check back later for this stage!


Telling tilt orientation with accelerometer

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

Do you ever wonder how your cell phone or tablet knows when you have tilted it? They “have always” known which way is up and act accordingly. Even some cameras will rotate your pictures if you took it with the camera sideways. Well, let’s see what help they got.

In the not so distant past,one can tell orientation with a simple tilt sensor. If you have peeked inside of an old thermostat, you must have seen a springy coil and a glass container with shiny liquid inside it. The liquid is mercury.

Here is an awesome periodic table of elements: http://www.periodictable.com/index.html

Here is mercury: http://www.periodictable.com/Elements/080/index.html

Mercury is a metal and is in its liquid state under room temperature. It is a good conductor for electricity. Mercury is sealed inside of a glass tube. Metal contacts are brought inside of the tube. In the above picture, if you tilt the switch clockwise, mercury will flow to the right, making the two metal prongs connect, and a circuit will be closed (turn on the heat). If you tilt it counterclockwise enough, mercury will flow to the left end of the tube, breaking contact between the two metal prongs and opening the circuit (turn off the heat). If you mount this switch on top of a bi-metal metal coil, you will get a temperature control mechanism to control room temperature.

Another type of tilt sensor is a ball sealed inside of a tube. It is essentially the same as the mercury in a glass tube but is much safer now that people know how bad mercury is.

Some early products that had tilt sensing must have used these. The sensitivity is low and you need to debounce to get a reliable reading.

The tilting sensing capability that our current-day devices have come from accelerometers, micro-machined structures that respond to accelerations in general, gravitation in specific. Imagine a mass suspended below a spring. This is how we weight a product with a spring scale. The weight of an object is proportional to its mass and the spring will stretch proportional to force applied to it. We tell weight from how much stretch we see on the spring. Without the earth gravity, the mass will have zero weight, and won’t stretch the spring. If you take the spring scale and suddenly yank it upwards, the spring stretches even more than when it’s staying still with the mass. If you did the opposite, giving the spring a downward acceleration, the spring stretches less than when it’s still.

Using this mechanism and micro-machining, this spring and mass can be shrunk so much that it fits in a small chip less than the size of your finger tip. As many as three of these structures can be made together to give the chip 3-D sensing on its acceleration.

Here is an image of an accelerometer from sparkfun, which I used in a project. It is able to detect acceleration due to gravity.

When the accelerometer is staying statically, it senses the gravitational acceleration and its projection or components along the board’s x-y-z axes. You need basic vector concept to find out the angle of tilt from the components of acceleration measured by the accelerometer. The most basic information that one could get is, which side is up. Say if you read the accelerometer and your x acceleration is exactly one g, then x axis must be facing downwards, making -x direction facing upwards. The cell phones and tablets can then readjust their display to adapt the rotation.

I have started a project of a music box, which contains an accelerometer. You can tap on the box to play a tone that is written on the top of the box. You want another tone, turn the side of the box with that tone upward and tap, the box plays the tone. I have made a prototype last night and will explore ways to make it good looking and more responsive.

When the accelerometer is accelerating with the object that is attached to it, it measures the combined acceleration of the earth and the apparent motion. An application of this is the Nintendo Wii remote controller. One can swing the controller, shake it or else to swing a sword or else in a video game. You can also measure acceleration of an amusement park ride or a car taking a high way exit or racing on a race track. I plan to post a project that uses the accelerometer in explaining physics, in the near future.

%d bloggers like this: