Musical Exercise: Workout Shirt MP3 Player Powered by Exercise using Arduino

People love listening to music while exercising. Music provides the motivation needed for individuals to keep exerting energy and get in shape. So, because people enjoy listening to music while exercising, what if an MP3 player only played an individual’s music while they are active? Using music as an incentive to continue exercising would encourage individuals to work harder and remain motivated in order to listen to their music.

This workout shirt utilizes a LilyPad MP3 player and an accelerometer in order to detect whether or not the wearer is moving, and if so, it plays his or her music. The goal of the system is to promote an active lifestyle for wearers. Follow the instructions to create your own workout shirt MP3 player that is powered by exercise!

Musical Exercise - Workout Shirt MP3 Player Powered by Exercise using Arduino

The price of our system ranges between $60 and $100 based on parts used, the cost of the shirt, etc. It is affordable, easy to understand and create, and will help promote healthiness and physical activity in society!

The Arduino IDE must be downloaded (free at in order to run our code.

Our code can be downloaded here:

Check out the working system here:

Step 1: Acquire Parts

The following are required parts to create the system:

-Workout shirt
-LilyPad MP3 player (
-LilyPad accelerometer (
-RGB rotary encoder (
-3.7V Lipo (lithium ion) battery (
-Micro SD card
-Headphones or speakers
-Conductive thread and a sewing needle (
-Soldering iron
-Solder coil
-Alligator clips (for testing the circuitry before sewing)

The following are optional components that can be used to expand the system:

-Rainbow LEDs (for enhanced visualization)
-Vibration board (for adding a physical aspect of the system to the visual aspect of the system)
-Button (for manual calibration)
-On/off switch (for extra control of the system)
-Extra fabric and card stock (for integrating the system with the shirt using an easier, more durable setup)

Step 2: Safety and Preparation

Before beginning the construction of your own workout shirt MP3 player, it is important to understand a few safety and preparation tips:

1. Stay safe! While soldering, be sure to wear protective eye-wear and avoid touching the hot soldering iron. Understand the different components of the system and how to make sure they are used properly. For example, the LilyPad MP3 player should not be connected to speakers while plugged into a laptop via USB; it can only be plugged into speakers when the system is being ran on a battery. Otherwise, parts of the device could be damaged and become increasingly hot and dangerous.

2. Acknowledge your abilities. While the setup of the system is easy to understand, the code is somewhat lengthy and jumps around from one function to the next. For inexperienced coders, simply copying the code will suffice, whereas for experienced Arduino programmers, there are several modifications that can be made to the system. Everyone is challenged to make our system even better!

Step 3: System Explanation

The LilyPad MP3 has I/O pins in the center that are specifically designed to house the RGB rotary encoder. The encoder should be placed there (it only fits in one way) and soldered down to make sure that all the I/O pins are in contact with the rotary encoder pins. The solder will also hold the encoder in place.

The LilyPad also has 5 different I/O pins that can be used with other components on the exterior (T1, T2, T3, T4, T5). However, T4 and T5 disable the serial monitor from being used when they’re active, so we can’t use them. It also has a ground pin, as will as a 3.5-6V power out. It also has a receiver for the 3.7V Lipo battery to be plugged in.

The 3.7V Lipo battery should be plugged in to the LilyPad MP3. The LilyPad has an on/off switch that will use the battery as power when activated. When it is plugged into the computer, the switch should be off, and it will charge the battery.

The accelerometer sends data on 3 different axes (x, y, and z), and it has 5 connections.  The + will be the part receiving power.  That should be wired (with the conductive thread) to the 3.5-6V-power output on the MP3.  The – (ground) connection on the accelerometer should be wired to the GND (ground) connector on the LilyPad MP3.

On the LilyPad MP3, The T1 connection will act as an analog pin (A0), T2 is analog pin A4, and T3 is analog pin A5.  The ‘X’ connection on the accelerometer should be wired to T3 (A5), The ‘Y’ pin should be wired to T2 (A4), and the ‘Z’ connector on the accelerometer should be wired to T1 (A0).  These will send data from the accelerometer to the LilyPad MP3 so we can tell how the accelerometer is being moved, or more importantly for this project – IF it is moving.

The Micro SD card is placed in a slot on top of the LilyPad MP3 that is specifically designed for the card.  As mentioned before, the mp3 files being played should be stored in the root directory of the card. TIP: The rotary encoder will blink red if there is an error with the Micro SD card (either missing, damaged, unreadable, etc.). If you notice red blinking, be sure to focus your attention to the Micro SD card.

Our system uses the accelerometer to sense motion, and it then communicates the detected motion (or lack thereof) to the MP3 player. The MP3 player then runs the corresponding function(s) based on the values it receives from the accelerometer. The RGB rotary encoder is used as a visual that displays different colors (blue or green) based on what function is being executed (between track and volume, which will be further explained shortly).

Step 4: Setting up the Circuitry

TIP: Before using conductive thread to set up our system, we recommend using alligator clips in order to test the system and make sure that it works properly. The most important components of the system are the LilyPad MP3 player and the LilyPad accelerometer. These should be connected through five different connections (power, ground, x, y, and z).

In order to account for users of different sizes, as well as different positioning of the accelerometer, our system calibrates in order to provide accurate readings. Using a button, an optional component for the system, the user can manually calibrate. For our system, we ultimately did not use a button but instead set our system to automatically calibrate if the user remained in the same position over a short period of time. If used, the button should also be attached to the system.

LEDs are also optional components of the system. The RGB rotary encoder is a LED itself, but additional LEDs can be used in order to display progress, distance, time elapsed, etc. Any used LEDs should also be connected to the system.

NOTE: As previously mentioned, the LilyPad MP3 has a limited number of pins, so if your desired system includes a button and LEDs, the LilyPad MP3 must be connected to the LilyPad Arduino, which has many extra pins for input/output components.

The pins are as follows:

xpin (of accelerometer) = A5 (T3)
ypin (of accelerometer) = A4 (T2)
zpin (of accelerometer) = A0 (T1)
+ (power of accelerometer) = 3.5-6V pin
– (ground of accelerometer) = GND pin

Step 5: Setting up the Circuitry

The image shows a diagram of the circuit. Unfortunately, as the LilyPad MP3 player is a fairly new product, Fritzing does not include a LilyPad MP3 player. For the sake of the setup, we used a regular LilyPad Arduino board. The pins of the rotary encoder are stretched to indicate where they would be placed on the LilyPad MP3 player board. The 3.7V Lipo battery is also seen in the diagram connected to two pins; however, in the actual system, there is a slot specifically for the battery to be attached.

Also, whereas the LilyPad Arduino board seen in the image shows the various analog pins, the LilyPad MP3 player uses T1-T5 pins, as previously mentioned. Make sure to match the T1-T5 pins to their corresponding analog pins for the system to work properly.

Lastly, whereas in the diagram, the power is being connected to the + pin, the LilyPad MP3 player does not include a + pin but instead a 3.5-6V pin, which is used to connect the power pin from the accelerometer to the MP3 player.

Step 6: Soldering the RGB Rotary Encoder to the LilyPad MP3

Musical Exercise - Workout Shirt MP3 Player Powered by Exercise using Arduino circuit
In order to use the rotary encoder, which is used to start/stop the music, and change tracks and volume, it must be soldered to the LilyPad MP3 board. Conveniently, the LilyPad MP3 is designed with pins specifically for a rotary encoder.

NOTE: Make sure that when soldering, the solder on each pin does not touch any other pin’s solder. If any of the pins are connected, the system will not work properly. Be careful!

Leave a Comment

= 5 + 9

(Spamcheck Enabled)

Read previous post:

While the field of robotics is continuously expanding at a remarkable rate and better performing robots are created every year,...

Scroll to top