Close
0%
0%

Spotify Box Light

A device that can stream Spotify

Similar projects worth following
0 followers
inspired by the project of Evan Hailey who built a custom Linux board for his Spotify streaming box, I decided to build myself one, too, but the easier way. Instead of making my own PCB I wanted to use the popular BeagleBone SBC, that is, the smaller variant called PocketBeagle.

inspired by the project of Evan Hailey who built a custom Linux board for his Spotify streaming box, I decided to build myself one, too, but the easier way. Instead of making my own PCB I wanted to use the popular BeagleBone SBC, that is, the smaller variant called PocketBeagle.

The standalone PocketBeagle doesn't have the audio outputs, so I would build my own add-on board with an audio codec and 3.5mm jack. There are some standard parts, like TLV320AIC that are supported in the BeagleBone device tree. By that I mean, there are existing device tree overlays that should "somehow" be invoked and the CPU will recognize the codec it's being connected to. This should make my add-on PCB a standard ALSA sound card. I don't know much about the DTOs, but hopefully, this will be a nice learning process.

The same board would host a USB A-type connector, what should be used for WIFI dongle. This would make my device a way to connect to the Internet. I would also put a 320x240 SPI-based LCD screen for display of the current song artwork.

Finally, the Spotify itself, would be reached via this deamon tool, called spotifyd that is used in the original project. If I get it right, it enables the cast option controlled from my smartphone. This seems like a nice elegant solution, but ,since I'm already having troubles with running it on my VM Ubuntu, I expect some troubles along the way.

So, that's about it. I would like to hear your opinions on the project and where do you see possible pitfalls. I am a hardware designer by profession, so I expect not so many problems on a PCB side. I am, however an less experienced linux user/SW developer, so I'm not sure how to make this spotifyd thing or device tree overlay running smoothly. But, looking forward to trying it out!

The boards are already on their way from the JLC-PCB!

  • Testing Spotifyd on Ubuntu VM

    Pero10/20/2021 at 08:25 0 comments

    Spotifyd is a program that enables streaming Spotify remotely, like you do on  a Chromecast. It can run as a daemon service, or a normal program. After building and installing it on my Ubuntu virtual machine, it is very important to have a configuration file stored in `~/.config/spotifyd/spotifyd.config`. You need a Spotify premium user number, password, and comment out the commands you dont use, like the command that gets executed after the song is skipped. Also, the proxy server should be commented out. 

    It is important to setup the backend option properly, as well. I thought it was "alsa", but it only worked with "pulseaudio". Make sure to check what is allowed by typing `spotifyd --help`.  I was figuring out for days what was wrong when the error about "not being able to write to pulseaudio" was all over the console. 


    If you want to run it as a normal program, for dev purporses, just type `spotifyd --no-daemon`. It should connect succesfully and display:
        ''''
        Loading config from "/home/pero/.config/spotifyd/spotifyd.conf"
        No proxy specified
        Using software volume controller.
        Connecting to AP "gew1-accesspoint-a-h9cf.ap.spotify.com:443"
        Authenticated as "1116304529" !
        Country: "AT"
        ''''
    Now you can check on your smartphone Spotify app if the device is visible and can you connect to it. 

    Funny enough, if I run compiled-by-me version, than it recognize alsa normally. Pre-compiled binary, downloaded from release shelf only works with `pulseaudio`. No idea why is that so. 
    In any case, I managed to bring the strem to work when I commented out these lines in .config file:
        `device = "alsa_audio_device"`,  and 
        `control = "alsa_audio_device"`

    Now spotifyd works both as daemon and a "normal" program. Cool.

  • Audio Cape Design

    Pero10/19/2021 at 07:34 0 comments

    PocketBeagle has a SiP that contains TI AM3358 CPU that has no I2S. Instead, it has the McASP.  From the reference manual: "The multichannel audio serial port (McASP) functions as a general-purpose audio serial port optimized for the needs of multichannel audio applications. The McASP is useful for time-division multiplexed (TDM) stream, Inter-Integrated Sound (I2S) protocols, and intercomponent digital audio interface transmission (DIT)."

    Hopefully, I don't need to write the code for McASP myself. I have found existing PocketBeagle add-on boards that provide audio outputs. There are two capes that kinda support audio outputs via McASP to interface the TLV320AIC audio codec. One is the Bela (on-going art/sound platform with fancy IDE), the other one is BB-BONE-AUDI (that seem to have disappeared from the market). They both have similar/same pin connections to the codec:


    TLV320AIC3104 Connector AM3358
    MCLK P1.29 PRU0.7 - MCASP0-AHCLK
    WCLK P1.33 PRU0.1 - MCASP0-FSX
    BCLK P1.36 PWM0A -  MCASP0-ACLKX
    DIN P2.32 PRU0.2 - MCASP0-AXR0
    DOUT P2.30 PRU0.3 - MCASP0-AHCLKR
    RESET# P2.26 PMICGOOD
    SCL P1.28 I2C2_SCL
    SDA P1.26 I2C2_SDA

    HW Project

    I have modified an existing BelaMini Rev B4 Design, by adding a 3.5mm audio jack. It was a nice trip down the memory lane of using Eagle. 

    I have ordered PCBs from JLC-PCB. Since they also offer a cheap SMT assembly service too, I decided to let them do the soldering. There is a limitation, however, they only work with the components they have on LCSC stock. As you can guess, my chip TLV320AIC3104 is not stocked there. Fortunately, there was an alternative: TLV320AIC3101 - a chip with integrated speaker amplifier. Everything else is the same, and should to the job just as fine. 

View all 2 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates