Making a "musical" swing with an accelerometer

Hi all,

I am currently working on a project for school and I’m experiencing some difficulties.

I attached some speakers to a swing, used an MP3 shield to play music and attached this to an Arduino. The idea is that, when the swing goes faster, the music changes (the rhythm goes faster/slower according to how fast you’re going). I am using an accelerometer to measure the angles of the swing (my teachers recommended me to use this sensor) but when I tested this, I noticed that the music constantly changes (which is pretty obvious, since the angles keep changing).

I’m looking around for solutions on the web (maybe using another sensor or change something in the code), but I can’t seem to find any.

Can anyone think of a creative way to fix this problem?

Thanks!

You aren't measuring angles with an accelerometer. Think about putting a cup of water on the swing. Let it swing freely. What is the angle of the surface of the water relative to the seat?

Now put a scale under the cup. What does the apparent weight of the cup do when it swings? You can measure that with an accelerometer.