ECE434 Project - Bluetooth 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!
09 Executive Summary 09 Packaging 09 Installation Instructions 09 User Instructions 09 Highlights 09 Theory of Operation 09 Work Breakdown 09 Future Work/Conclusions 09 Hackster.io 09 Demo/Poster 00 Late Comments: Have a good day. Score: 90/100
This project will use a BeagleBone Green Wireless to connect to a Bluetooth speaker. The BeagleBone will then take music (either .mp3s or .wavs) on the computer and send the music to the speaker. There is also a program included that lights up a WS2812b programmable LED strip to respond to the music.
We currently have a BeagleBone Green Wireless and a Bluetooth speaker. We've been able to connect to the Bluetooth Speaker and play .mp3s (using mplayer) and .wavs (using aplay). We've written code to have an LED matrix visually respond to the music being played.
One issue that we consistently run into is with getting the LEDs to start at the same time as the music. We've also only been able to apply the visualizer to .wavs; all other audio formats have to be converted to .wav beforehand.
Picture that summarizes the project.
Give two sentence intro to the project.
Give two sentences telling what works.
Give two sentences telling what isn't working.
End with a two sentence conclusion.
The sentence count is approximate and only to give an idea of the expected length.
If you have hardware, consider Small Build, Big Execuition for ideas on the final packaging.
This project uses a Beaglebone Green Wireless, a WS2812b programmable LED strip, and a Bluetooth speaker (any will work), and any cables required to interface the Beaglebone with a linux device. We recommend using a current-limiting resistor when connecting the WS2812b to the GPIO ports on the Beaglebone.
There are no additional hardware requirements, but feel free to design an enclosure and cover the outside with programmable LEDs.
Give step by step instructions on how to install your project.
- Include your github path as a link like this to the read-only git site: https://github.com/MarkAYoder/gitLearn.
- Be sure your README.md is includes an up-to-date and clear description of your project so that someone who comes across you git repository can quickly learn what you did and how they can reproduce it.
- Include a Makefile for your code if using C.
- Include any additional packages installed via apt. Include install.sh and setup.sh files.
- Include kernel mods.
- If there is extra hardware needed, include links to where it can be obtained.
To install the project, follow the instructions below:
1) Make sure you're connected to the internet. If you want to use wifi, we recommend following the instructions provided on the following site:
2) Ensure you have git installed on your device, and fork the repo linked to the following read-only git site:
In particular, you can run the following command: bone$ git clone https://github.com/wernejm/ECE434_Project
3) Navigate to the project directory. Run ./install.sh in the command line. This will install pexpect, which is a necessary package for the visualizer.
Once you've done the above three steps, you can proceed to the user instructions to learn how to play music and/or run the audio visualizer code.
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.
Consider making it autostart for full credit.
We've outlined the key functions of our project below, as well as instructions on how to use each of them.
1) Ensure you've installed all of the necessary packages (see installation instructions above).
2) The next step is to connect to your bluetooth speaker. It's important to make sure that the Bluetooth Daemon is running on your Beaglebone, so be sure to run "sudo systemctl start bluetooth" if you haven't already.
First, run agent on to turn on the Bluetooth Agent. Next, we will set the speaker to scan mode. While your speaker is searching for a device to connect to, run bluetoothctl into the command line of your BeagleBone, then run scan on. Once you see your device, run scan off and take note of the MAC address associated with your device. Run pair [MAC address] to pair your BeagleBone to the speaker, then run trust [MAC address], then connect [MAC address]. Your speaker should now be connected.
3) Next, we will configure the asound configuration for the alsa device. If you don't have any preferred audio settings configured for your BeagleBone, simply run the following:
bone$ cd ECE434_Project bone$ cp asound.conf /etc
Next, simply replace the "device" and "description" tags throughout the document to match your Bluetooth speaker's address and name, respectively. Note that if you do not wish to alter your asound.conf file, then use our code as a reference and adjust your file as necessary.
4) If you only want to play audio, skip to step 8. If you want to use the visualizer, follow along with the next few steps.
Modify Rpmsg.pru0.c as necessary. If you're using the WS2812b, change the following to configure the GPIOs from the default Pin 30 to whichever pins you wish to use:
#define CHAN_NAME "rpmsg-pru" #define CHAN_DESC "Channel 30" #define CHAN_PORT 30
Our LED matrix is a 10x10 grid. If you have a different number of LEDs, you can modify the string length by changing the following line:
#define STR_LEN 100
From here, your code should be ready to run.
5) Compile the program. Run the following:
bone$ make TARGET=Rpmsg.pru0
This will configure the correct GPIOs and prepare the LED to read values.
6) Select an audio file you'd like to play. First, convert the file to a .wav. We wrote a script to convert mp3s to wavs, which can be run using the following command:
Follow the prompts to convert the file. Remember the name of your output file.
7) Now open visualizer.py. Define "MUSIC" as the name of the .wav audio file you wish to play:
MUSIC = 'mario.wav'
Save and close this file.
8) Run the following to simply play an .mp3 or a .wav file:
bone$ ./playmusic.sh <audio file name>
To run the visualizer, run the following:
Now sit back and enjoy.
Here is where you brag about what your project can do.
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.
List the major tasks in your project and who did what.
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.
Both partners worked together on most of the major tasks. We both worked on getting the BeagleBone to connect to the Bluetooth speaker to play music. James primarily handled mplayer, while Neil focused on aplay. We worked together to display patterns on the programmable LED. We also worked together on applying the FFT to our music, which ultimately led to us being able to develop a real-time equalizer pattern. The project involved a considerable amount of pair programming, so the technical work was shared fairly. For the most part, Neil completed more of the technical work, while James split his time into updating the eLinux and hackster.io pages.
Suggest addition things that could be done with this project.
We were interested in taking this project in several different directions. Below are a few of our suggestions:
- Increasing the number of audio file formats that properly work with our playmusic.sh function
- Work to interface the program with popular streaming services, like Spotify, Youtube Music, and so on
- Make use of the BeagleBone's wireless capabilities and find ways to select/play music on the Bone remotely, perhaps using Flask or other related software
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.
Embedded Linux Class by Mark A. Yoder