ECE434 Spotify Box

Team members: Aman Bajaj and Eric Kirby

Grading Template
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

(Inline Comment)

Executive Summary
This project is making a device using the Beaglebone which can stream music through spotify. The final result displays a mopidy interface on an LCD screen that can be controlled using buttons as GPIO into the Beaglebone. This is done using Mopidy, specifically the Mopidy-spotify, Mopidy-touchscreen and Mopidy-GPIO extensions. In order to adapt the existing code to our project, we created our own mopidy extension and tailored the code so that it works the way we want it to. The output audio is controlled using PulseAudio and comes out from the USB port through a USB-AUX adapter.

Timeline

 * 10/29 - Order Parts
 * 11/3 - Receive Parts
 * 11/5 - Install necessary packages on Bone
 * 11/6 - Play music from Spotify
 * 11/9 - Display Pygame on the LCD
 * 11/13 - Create an interface for the LCD
 * 11/18 - Finish documentation

Packaging


Attached is a Fritzing diagram of the circuit that was built. There are also pictures attached of the packaging that we made for the Spotify Box

Installation Instructions
LCD Screen: https://www.amazon.com/HiLetgo-Display-ILI9341-240X320-Arduino/dp/B0722DPHN6/ref=sr_1_3?dchild=1&keywords=2.4+TFT+SPI&qid=1605676187&sr=8-3 USB Audio Dongle: https://www.amazon.com/Sabrent-External-Adapter-Windows-AU-MMSA/dp/B00IRVQ0F8/ref=sr_1_4?dchild=1&keywords=usb+audio+dongle&qid=1605676280&sr=8-4#customerReviews USB Hub: https://www.amazon.com/Anker-Extended-MacBook-Surface-Notebook/dp/B07L32B9C2/ref=sxts_sxwds-bia-wc-nc-drs1_0?cv_ct_cx=usb+hub+anker&dchild=1&keywords=usb+hub+anker&pd_rd_i=B07L32B9C2&pd_rd_r=952e66e8-cc6a-4ddc-8254-09adff1a3b00&pd_rd_w=WPNFb&pd_rd_wg=7eF1T&pf_rd_p=84ce0865-d9ca-42e3-87ed-168be8f93162&pf_rd_r=DCG6C5PJ1Z0F44GDVG61&psc=1&qid=1605676299&sr=1-1-88388c6d-14b8-4f70-90f6-05ac39e80cc0

https://github.com/kirbyes/ECE434/tree/master/final-project

1) Clone this git repository git clone https://github.com/kirbyes/ECE434.git

2) Run install.sh. This only needs to be run the first time that you are running the program. chmod +x install.sh ./install.sh

3) Edit the config file with your Spotify credentials. cd ~/.config/mopidy nano mopidy.conf Copy the mopidy.conf file from this repository and paste it into yours Add your own credentials to the lines. To get the client_id and the client_secret visit Spotify Credentials

username =

password =

client_id =

client_secret =

4) Change directory to the spotify-box folder and install our revised version of mopidy-touchscreen. cd spotify-box sudo python setup.py install cd ..

5) Run setup.sh. This needs to be run everytime before you want to run the program. chmod +x setup.sh ./setup.sh

6) Run the program. sudo mopidy

User Instructions
First, make sure that a speaker or headphones are plugged in to the aux port of the USB-AUX adapter. Plug in the beaglebone, upon startup it should run the program. Use the buttons to navigate around the touch screen (up, left, down, right and enter are the buttons). Once you find the song that you want, you can play it and it should come out of the speaker/headphones!

Highlights
https://www.youtube.com/watch?v=D__H-ThP1A8&feature=youtu.be&ab_channel=EricKirby

Theory of Operation
The user interacts with the LCD touchscreen, which uses the Mopidy-Touchscreen extension that has already been written. When the user selects a song, a request is sent to spotify using the Mopidy-Spotify extension. Once the data returns, the song begins to play, and the audio output is handled using the PulseAudio package. There are several different screens in the UI that shows up on the LCD. One option given is to search songs, another is to look up the top songs/artists/albums, and another is to look at the song that is currently playing and gives you the ability to pause or skip it as well as check how much of it is left. There is also a page with settings, which allows you to exit out of mopidy, which will return the beaglebone to normal operation, or to turn off the beaglebone altogether.

Work Breakdown
Get Mopidy to run - Aman

Get music playback to work with Mopidy - Aman and Eric

Get LCD Screen to display UI - Eric

Get GPIO to work with UI - Aman and Eric

Documentation - Aman and Eric

Future Work
One really cool thing that could be done is adding a voice recognition component to the project so that it works similar to Alexa where a user can speak to it and request a song. This could be done using the Mopidy-Headless extension and adapting it with open source voice recognition. A more immediate action however would be to get the system working with a wifi dongle so that it doesn't have to be plugged into the laptop and can be simply plugged into the wall and have the system run.

Conclusions
A lot of this project was adapting previous work that had been done, which made it rather smooth. It would have been interesting to create our own user interface, but we didn't really see the point in doing so as it is much easier to adapt work that has been done (yay open source!). As mentioned in the future work section, it would be really cool to adapt the project to use voice recognition, and even cooler if we could get it to work with playlists (a feature that Mopidy doesn't support). The more immediate concern would be to get the spotify working with the wifi dongle, which shouldn't be too large of a step to take from the system that we currently have.

In terms of learning, we gained a lot from this project. One of the biggest areas of learning was contributing to an existing project - as we contributed our own Mopidy extension. This is a very common practice in open source systems and we were glad to have the opportunity to do it. One other area of learning was regarding where certain packages get stored and how to make sure that we are installing them in the right manner. We learned that sudo pip3 install and pip3 install place packages in different locations and that we need to use the right one for the project that we are working on. We also learned not to create conflicts between pip3 install and apt install, as this gave us issues with certain extensions thinking we were running Mopidy 2 and others thinking it was Mopidy 3.