Copy of Final Project - Bluetooth MP3 Player


A lot of people study at their desks listening to music. The solution for that use case is pretty good--just plug in some speakers to a laptop and listen away! However, people don't always want to study right at their desks, in front of their computer, but like to move around. Maybe they head to their bed, the floor, who knows? The problem is, once the laptop is removed from arm distance, changing the song / controlling the music becomes a HUGE issue. My mp3 player aims to solve that problem. It can be controlled via any Bluetooth enabled device. To make communication easy I created an Android app to send Bluetooth commands and display the mp3 player's status.

 

Parts

 

Issues Faced

Bluetooth

     - Default baud rate at 115200bps. Teensy clocked at 8Mhz cannot handle it. 

     - Line Endings

          - Entering CMD mode to configure bluesmirf module requires "No line ending".

          - Setting commands requires CL ending

     - Teensy has two Serial modes of communication (USB and the BT). Need Uart.println() for BT

Transferring data

     - Needed to develop a MAC protocol to determine end of transmission

     - Needed a way to send data in an organized manner (chose JSON, wrote a class for teensy -> android)

     - Android sample code doesn't handle larger message lengths. Needed to modify to buffer chars

     - Updating app with song information when action not prompted by app (e.g. advance track after finishing one, updating seekbar)

          -Solved by rearranging JSON code into it's own class     

 

Images (Initial plans, diagrams, photos, and screenshots)

Note: some descriptions are cut off due to the embedding. If you'd like to see the full gallery w/descriptions click here.

 

 

Code

Libraries

Arduino sketchbook

Android app

 

Video

 

Next Steps

1) Send all id3 data to remote when connection established to have a scrollable list of songs.

2) Encapsulate mp3 player in a case.

3) Iterate app UI/UX