Raspberry PI Home Hub & Spotify Cast Device
by joejoebinks693 in Circuits > Raspberry Pi
47 Views, 0 Favorites, 0 Comments
Raspberry PI Home Hub & Spotify Cast Device
My project is a Raspberry Pi based home control hub, that also functions as a Spotify casting device.
I was inspired by the google nest hub, and since I was assembling it I added a few extra features, such as, Power over ethernet and also making it Home Assistant compatible.
Supplies
Soldering iron, solder, safety glasses and fume extractor
22awg stranded hookup wire this much is not needed for this project, but it will be a good thing to keep stock of.
3d prints
One Back Enclosure print
One Front print
Two Copies of Speaker grill
Parts
Raspberry Pi 4 Model B/4GB ( i bought mine with the SD card pre-made, but you can also make your own see step 3)
Raspberry Pi PoE+ HAT for Pi 3B+ & Pi 4B
10.4inch QLED Quantum Dot Display
Speaker - 3" Diameter - 4 Ohm 3 Watt x2
Stereo 3.7W Class D Audio Amplifier - MAX98306
Assemble Screen and Raspberry Pi Together
Following the instructions for the screen, place the Raspberry Pi on the back of the screen, install the screws and use the PCB connectors for USB and HDMI to connect your Pi
The screen will receive power and transmit touch data to the Raspberry Pi through the USB, and the HDMI connector will transmit the display data.
Place POE Hat on Raspberry Pi and Screen Assembly
Place your chosen POE hat on top of the Raspberry Pi, making sure all the pins lineup.
Pluging a POE powered supply device (Such as a network switch or standanlone POE injector) will now power the whole setup and provide a wired network conenction.
Install Rasbian OS
Insert your pre-made SD card or make your own and install it.
For the most recent instructions on how to make your own Raspberry Pi OS SD card, you can visit the official Site.
Prepare Audio Amplifer Module
To power the amplifier with 5V from the Raspberry Pi, connect the audio amplifier to a USB-A male end, this can be achieved by cutting the end off an old USB cable and soldering red to the "VDD" pin and black to the "GND" pin of the amplifier module.
Connect the audio amplifier to the audio output of the screen by cutting an aux (3.5mm TRS) cable in half, and stripping the wires on one end, white will go to "L+" on the amplifier module, black will need to go to both the "L-" and "R-" spots on the board. lastly Solder the remaining red wire to the "R+" spot on the amplifier module, this spot is marked in orange on the photo so that it is not confused with the red 5V line.
Prepare the Enclosure
3D Print the enclosure for the speaker, on my Bambu X1C I must split the front into two prints and split the rear into two prints.
to glue the parts together, I lined them up, applied superglue and put masking tape on the joints to hold them together while the superglue cures.
Install the Screen in the Enclosure
Set the screen face down on a piece of foam that it came packaged in (or another soft, and clean surface) to prevent scratches.
Place the front case over the screen, Pi and POE hat assembly. Making sure that the HDMI side of the PI and Screen is on the "top" side of the front.
Using the screens included screws, insert them into the outer 4 mounting holes and tighten them.
Connect the Speakers
Solder wires onto your two speakers, each speaker will need two wires soldered on, for cleanliness you can choose to twist two wires together with a drill before you solder them.
Install the speakers in the enclosure with 4 M3x10 screws each, if you color coded the wires soldered on the speakers make sure you place them on the correct sides.
Now, checking polarity on the speakers, use the screw terminals on the amplifier modules to connect the speakers follow the polarity embossed on the speakers and make sure your left speaker goes to "LOUT" and your right speaker goes to "ROUT"
Connect the Amplifer Module
plug in the 3.5mm TRS plug into the screen (not the Pi, the audio output device will automatically be the screen)
plug in the USB connector to the Raspberry Pi
Mount the Amplifer Module
Using double sided foam tape, mount the amplifier module to the back of the screen
Close Up the Case
Frist plug in the ethernet cable to the Raspberry Pi, and feed it through the rear case hole push the front onto the back, making sure it is fully lined up.
Press the back enclosure into the front, for ease of building it simply friction fits together.
Install Raspotify
Raspotify is what will allow us to select the Raspberry Pi from any Spotify Client (Phone, or computer) to control what's playing, and the volume.
the Raspotify GitHub is the best place for current info on how to install it
Note: Raspotify mentions configuration, for my needs I did not configure anything.
Open Home Assistant
Open one of your Home Assistant dashboards on the Pi, generally scaling will be good but I made my own dashboard for this size screen, to make sure no scrolling was required to use any features. The image of this step shows how my dashboard is configured.
Kiosk Mode Home Assistant
For my install I did not want to see anything on the screen besides the Home Assistant dash board, to enable a "kiosk" mode in Home Assistant I installed "Fully Kiosk Browser" as a Home Assistant integration. The picture of this step shows you what your Pi screen will look like with no Kiosk mode.
Navigate to the dashboard you want to use on your Pi and add "?kiosk" to the end of the URL, for example my URL on my Pi is http://192.168.1.31:8123/lovelace/pi-dashboard/?kiosk
(pi-dashboard is the name of my dashboard designed for the pi)
Pump Some Tunes
Make sure your phone (or other spotify client device) is connected to the same network as the PI, open your spotify app and select "raspotify" in the Casting menu, volume will be controlled from your casting device.
the spotify intergation in Homeassistant is the best way ive found to control the music with the touch screen, the interface I used in home assistant for spotify was simply the built in media-control card