ECE497 Project - Andriod App to Speaker
Embedded Linux Class by Mark A. Yoder
I'm using the following template to grade. Each slot is 10 points. 0 = Missing, 5=OK, 10=Wow!
00 Executive Summary 00 Installation Instructions 00 User Instructions 00 Highlights 00 Theory of Operation 00 Work Breakdown 00 Future Work 00 Conclusions 00 Demo 00 Late Comments: I'm looking forward to seeing this. Score: 10/100
The goal of this project is to interface a simple android application with the BeagleBone. Songs will be able to be chosen/downloaded and controlled from the Android App and played through a speaker connected to the bone either via a USB dongle or through Bluetooth. We are working to support possibly having the option to choose either through the dongle or through a Bluetooth speaker. Another feature that would be neat to include is playing songs through YouTube so you can have a wider range of options to play.
During the project, we have run in various roadblocks. The first roadblock was trying to get a Bluetooth speaker to connect. This is a problem we are still investigating. The Bluetooth dongle will connect once to the speaker but after that, it will 'connect' for a second then disconnect. Another roadblock we encounter was the music playback was choppy and skipped at some points. This was solved by manually setting the sampling rate.
If you have hardware, consider Small Build, Big Execuition for ideas on the final packaging.
Give step by step instructions on how to install your project.
- Link to GitHub project: https://github.com/boxetham/EmbeddedLinuxMusicAppProject.
- If bluetoothctl gives you waiting to connect to bluetoothd:
- sudo modprobe btusb
- sudo systemctl start bluetooth
- To get the app you will need to:
- Have an Android device
- Enable applications from unknown sources on that device (this can be done in the settings - settings -> applications -> enable unknown sources)
- Navigate to the 'AppToSpeaker' directory of our project
- Get the 'app-debug.apk' file from the PC onto the device, either through direct transfer or email
- Once the app is on the device, in the file system navigate to the folder containing the .apk file, click on it, and hit 'install'
- The app will then be downloaded installed on the device
- USB Audio Dongle to connect the speaker to the bone
- Bluetooth module to connect to the Bluetooth speaker
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.
Everything in this program is controlled from the Android device. Insert the USB Audio Dongle into one of the USB ports on the BeagleBone. Connect a speaker to the dongle using an auxiliary cable. The Bluetooth on the BeagleBone should be set to discoverable mode. To do this, in the command line input "bluetoothctl", then "discoverable yes", then "quit." The BeagleBone must be discoverable for the phone to find it. The BeagleBone should be running the perky_blue.py (may have to run as root, 'sudo ./perky_blue.py') program found in the Git repo under the AppToSpeaker folder. Open the Android app. Start by selecting "discover" and then selecting your BeagleBone device to Bluetooth connect to. Select the song to play once the BeagleBone is connected to the device. You can also manually input a file to play that is not one of the songs listed. To do this, hit the "Play Custom Song" button, then enter the file name without the extension and press enter. If entered correctly, the song should begin playing and can be controlled from the app. If you want to download a new song onto the bone to play, press the "Download Song" button and enter the link to download the mp3 file. The bone must have an internet connection for this feature to work properly. Once the song is downloaded, you can use the "Play Custom Song" button to input the file name and play the song. Once songs are playing, they can be controlled by the buttons at the bottom of the application. From left to right, the buttons are: Pause, Play, Stop, Volume Down, and Volume Up. Closing the Android Application will end the program on the bone.
Our project lets you control music on the Bone from your phone. This uses a Bluetooth connect to send commands to the Beagle from your phone. You have all the commands of a basic stereo with the additional ability to choose new music to download.
Include a YouTube demo the audio description.
Theory of Operation
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.
The basic structure of our program is an Android app sends instructions to an application running on the BeagleBone. The app first 'discovers' the BeagleBone and connects to it via Bluetooth. Then, the user can select to play, pause, resume, or stop playing different songs. The BeagleBone controls the music according to the command using mplayer. The audio output plays through the Bluetooth speaker or a headset, whichever one is currently selected by the mplayer audio driver. Below you can see a diagram on the interaction of different parts of the system.
- Phone connect to bone through app via Bluetooth- Trey
- Wrote App - Trey
- Using mplayer to play, pause, resume, and stop music, in python script - Anne
- Ability to download music from online - Trey
- Using mplayer to play music from online - team effort (in progress)
- Connecting beaglebone black to bluetooth speaker - Anne (in progress)
- Solving choppyness of mplayer when playing music - mostly Trey, little help from Anne
- Documentation - Anne, little help from Trey (in progress)
Here are some ideas that could be neat to implement in the future:
- Add newly downloaded music to the list in the app
- Play music on multiple audio outputs at the same time
- Have a display change with the music playing
This project presented some interesting challenges. Using mplayer in the Python application cause the output of the audio to initially skip at some points. We tried many different things to solve this but ultimately the issue was the sampling rate used during playback. Overriding this setting caused the audio to sound a lot better. Another issue we had was getting the Bluetooth set up. Initially, we didn't know that we needed to use a Bluetooth dongle, so it was a lot of work before finally realizing we needed to purchase that. After getting the dongle, the work we did initially worked to connect to the speaker. Then, the BeagleBone stopped connecting to the speaker after turning off the Beagle and turning it back on. We tried a different dongle and installing different packages to monitor Bluetooth, but so far no luck.
Besides these two hiccups, creation of the app to outputting sound went smoothly. The project allowed us to experiment with different peripherals that we thought could make an interesting project. Some things that would be interesting to pursue is sending the music files to the BeagleBone so that you could play any song that you had on your phone. There might also be a way to get the music from other apps to play on the Beagle (basically just use the Beagle as the audio out for the phone). Overall, while there were some difficult parts, we are happy with the outcome of the system as it presented us new ways to connect to and use the BeagleBone.
Embedded Linux Class by Mark A. Yoder