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!
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 http://arduino.cc/en/main/software) in order to run our code.
Our code can be downloaded here: https://iu.box.com/s/vc81v70ifv4ebw68d7qq
Check out the working system here:
Step 1: Acquire Parts
-LilyPad MP3 player (https://www.sparkfun.com/products/11013)
-LilyPad accelerometer (https://www.sparkfun.com/products/9267)
-RGB rotary encoder (https://www.sparkfun.com/products/10982)
-3.7V Lipo (lithium ion) battery (https://www.sparkfun.com/products/341)
-Micro SD card
-Headphones or speakers
-Conductive thread and a sewing needle (https://www.sparkfun.com/products/10867)
-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
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 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
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
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
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!