Upgrade Car Audio With Volumio and a Raspberry Pi!
by Jetmake in Circuits > Audio
4590 Views, 3 Favorites, 0 Comments
Upgrade Car Audio With Volumio and a Raspberry Pi!
I am a CS student and had an unused Pi and storage of music that I wanted to put together to see if I could upgrade my audio system for an older car.
Supplies
What you will need:
- A Raspberry Pi 2 B or more recent model (like the Pi 4)
- An SD card to insert into the Pi
- An SD card reader for the PC
- An SSD drive to hold your music library
- Stereo audio cables
- Mini USB to USB power cord (I used an old phone charging cable)
- A car Aux port
- A TP-Link w823n Wifi dongle (or one compatible with the Pi, but not needed with a Pi 4)
- A smartphone with hotspot capability (I am using an Android for this setup)
- Your choice of any DAC hat, but for this tutorial I am using the HiFiBerry DAC 2 Pro
- You will need to download Volumio on your PC from https://volumio.com/en/get-started/
- 3 to 5 ft. of protective wire wrap you can get from a hardware store
- A 4 amp power supply/switch from https://www.mausberrycircuits.com/collections/car-power-supply-switches/products/4amp-car-supply-switch
- A package of butt splices gauged 14-16
- Fuse taps both 3 amp and 5 amp (*amps may be different depending on which fuses you can tap into for your car)
- 12 gauge grounding pigtail wire
- A screw and nut to keep the ground wire in place
- 2 pieces of extension wire about 6 inches long each
- Electrical tape
- You will need to find your cars fuse box diagram which you can find here https://fuse-box.info/
Tools:
- A wire stripper/crimper/cutting tool
- A screwdriver
- Small wrench or pliers
- Scissors
- A multimeter
- Access to a TV or monitor
- Access to a PC to flash the Volumio OS onto an SD card
- Download the Volumio app for your phone
Volumio Setup
*Note: I suggest getting a Pi 4 for this setup because the Pi 2 B is no longer supported for Volumio, and it should be easier.
Download balena Etcher at https://www.balena.io/etcher/. For my specific setup I used Volumio version 2.9 that I got from the creator. I may be able to provide you this version if you need it.
Once you have your Pi and downloaded Volumio, unzip Volumio into it's own folder and then open up Etcher. Choose "flash from file" and navigate to your Volumio OS file. The file should end in ".iso" Then click on "select target" and make sure your SD card is inserted to the SD card reader. Make sure you select the right SD card drive and then hit "Flash!" Once it finishes remove the drive and plug it into your Pi.
Turning on the Pi and Setup of the Power Supply/switch
Plug in an HDMI TV or monitor to your Pi and a keyboard. You will need to type in some Linux commands. The Volumio logo should appear once it boots (it will take a while on the first boot after a flash) and log in with user: "volumio". password: "volumio". Once you have your 4 amp power supply/switch go to this website and follow the instructions at https://www.mausberrycircuits.com/pages/car-setup. You need to install a script onto the Pi in order for the switch to work. You can skip to the part where it says "Installing the script" and follow these steps:
Installing the script
For RaspBMC/Raspbian/Debian distributions, type the following and hit enter after each line:
1. wget http://files.mausberrycircuits.com/carsetup.sh
2. sudo bash carsetup.sh
3. sudo reboot
I also followed the last steps provided by changing the shutdown delay to 1 minute, but it's not needed.
Also before editing any script or file make sure to create a backup so you can restore to a default state with the following command format: cp file.doc newfile.doc. So for example before you edit the switch file with "sudo nano /etc/switch.sh" you would type: "cp /etc/switch.sh /etc/switch.sh.bak".
Also save the image of the pin layout provided for future use. You will need to connect the blue and white wires to pins 23 and 24. If you are holding the Pi with the pins on the right side, then just count down on the right most row of pins, to pin 8 and 9 from the top. I will go into more detail about that during the wiring steps.
Plug in Ethernet to the Pi
You will need to physically connect to the modem/router before wifi will work. Doing this step will also update files in the Volumio OS that will need to be deleted after because it will default to a physical connection every time after this, and we don't want that. (The file is under /var/run... and I will go over that soon).
You can watch the rest of this 2 min video to see how to set up Volumio with the app. Make sure you have Volumio installed on your phone. Skip the part where he says to type in "volumio.local" in the browser as that didn't work for me on an Android device. https://youtu.be/nn1piVJWtSo?t=185
- You should be taken to a setup screen after opening the app to select your language
- Then type in a name for your device, this is basically setting up a URL that you can type into your browser later
- For my specific DAC (HiFiBerry DAC 2 Pro) Do not select Yes for "I have an I2S DAC" this will keep the DAC from powering on or staying on. Instead just select No, and select the right DAC that you have. For me I chose HiFiBerry DAC+ Pro like the picture above.
- Next you can set up your wifi settings. This is the part where you turn on your phones hotspot. Give it a name, and password if you want, and you should see the network come up on the list. Click on your network and enter your password if it's set and click connect.
- Make sure you have your music SSD connected by USB to your Pi, and select your music drive to add to your library. If you buy a SanDisk SSD it should come with a USB-C to USB adapter you will need this for SSD drives pictured above.
Volumio should now be set up and we will need to edit the supplicant file to ensure the wifi stays connected. (Unless your wifi is working away from your home network at this point then the next 3 steps can be ignored and you are ready to hook it up to the car)
Hotspot Setup
This step will require knowing some Linux commands to see your network status for the Pi. Make sure the TP-Link wifi dongle is plugged in to a USB port on the Pi. Once you turn on the Pi the wifi dongle will blink green a few times (unless you bought a different compatible dongle). This means we should be able to connect to your phone's hotspot. Log in with "volumio" for user and password. Two important commands you need to type are: "ifconfig" and "sudo iwconfig". You may not see anything listed for wlan0 yet, so you just have to add about 5 lines of code to the supplicant file.
Once you are ready to use wifi. Delete the file with the home network info. This is needed because the hotspot network information won't take control if this isn't done. Delete the file with: rm /var/run/wpa_supplicant/wlan0 (replace wlan0 with whatever wlan number you have, it will most likely be wlan0 however). You can then edit the supplicant file to get the OS to update the wifi settings.
Type: Sudo nano /etc/wpa_supplicant/wpa_supplicant.conf. You should see a screen that allows you to edit the text like the picture with SSID and PASSWORD labeled in green and red, or follow the format with the picture above. You can add several wifi hotspots or just your own phone. If you set a password make sure to put that in quotes. Make sure to type: Sudo wpa_cli -i wlan0 reconfigure when you are done, or just save and exit and reboot the Pi. When using "ifconfig" or "sudo iwconfig" look for the labeling of your ports. "eth0" should be your cable connection if you connected directly into your modem/router. You don't need to worry about the one labeled "Lo", and you should have only one wlan device (unless you have a Pi 4, then I'm not sure how it will show up). You can disconnect and re-connect the dongle and use "ifconfig" to see which device gets removed and updated on the list. At this point you should be connected to your phones hotspot. Look for numbers above 0 for RX packets and TX packets. Errors should be 0 and dropped should be pretty low if not 0. In the picture provided below I have: RX packets: 111, TX packets: 185.
Write down or copy the IP address shown for the wlan device. It will be the numbers immediately following the words: "inet addr". You should then be able to open chrome or whatever browser you have on your phone and type that IP address in the search bar. The web based Volumio UI should load.
This is what the supplicant file would look like if you have no password for your phones hotspot (for the Pixel 5 in my case) If you are entering your password in plain text then make sure it is surrounded by quotes: "password".
The two useful commands you need to find out the info you need to connect to volumio through your phone. The ESSID should be the name of your phones hotspot network.
Adding Your Music Library
Go to sources in the web UI. You should have a screen like the one above. Select rescan, and then once it completes select update. This adds your music to the library and you should see the number of songs discovered from your SSD, you will need to do this every time you add new songs to your SSD.
Ready to Wire!
You will need to find fuses you can tap into for the project. I went to https://fuse-box.info/ to find the map of the picture above for my car. The location of my fuse box was underneath the glove box on the right side. I ended up choosing fuse #44 (the accessory fuse) and #38 (for my car horn). It's also very helpful to watch this video https://www.youtube.com/watch?v=24DVHmIb9gs to find out which fuses you need to tap into. First find the always on circuit. Take the multimeter and put your keys in the ignition. Turn your car on but don't start the engine. Take the multimeter and find something like the horn circuit and place one lead on a grounding metal surface and the other on one side of the fuse you want to tap into.
Put together your fuse taps:
I bought these fuse taps at an auto store, and also some 3 amp and 5 amp fuses. Make sure to plug them into the top portion because the fuse won't properly protect without doing this. The bottom fuse slot will be used for the fuse you pull out, and make sure to plug it into the fuse slot you just pulled out.
Locating Tapped Fuses
They fuses have small metal contacts on the top. Make sure you are touching the lead to that point, and see if you read 12 volts. In the picture above I'm actually testing fuse #44 but I circled #38 and you can do the same thing. Once you read 12 volts you found a good fuse. Do the same for fuse #44 (my audio accessory fuse) or whichever fuse is powered by accessory. Put the leads on the fuse when the car is off, and make sure you read 0 volts on the fuse. Then turn the car on and check it again for 12 votls. If you now get 12 volts then you found the right fuse.
Disconnect Battery
I pulled both battery contacts just to make sure the stiff cables didn't fall back down and touch anything while I was working on the electrical. Then I pulled the fuses I wanted to tap into. #38 had a 10 amp in it's place. So unplug it and put that on the bottom part of the fuse tap, then I plugged in the purple 3 amp fuse for my Pi on the top. Do the same for fuse #44. I had a 7.5 amp fuse in it's place, and plugged that on the bottom, with the brown 5 amp fuse on top.
Crimping/Grounding
I cut two wires from an old PC power supply that was given to me from a local PC repair shop since it was a dead power supply the wires were still good. I cut them to about 6 inches, and stripped them on both ends with the 14 gauge cutting slot.
I was lucky to find an unused cutout on my cars frame. The area I circled red is where I put the grounding wire, this is on the passenger side or the right side of the center console island. It was a tight fit but I put a nut behind the cutout and put in a screw. Once I got it fed through I stripped the 12 gauge grounding pigtail started wrapping the it around the screw and tightened it up.
The second to last picture is everything all connected and crimped. I put the extension wires in between the fuse taps and the switch. I used 4 crimps and crimped in 6 spots, because of the two provided with the fuse taps. I bought a pack of 16-14 butt splices. Make sure not to crimp the ground wire, I just wrapped the black ground wire from the switch around the green wire, and taped it up with electrical tape.
I recommend getting Wago 221-412 2-Conductor Compact Splicing Connectors. They are lever action splices that are great for ground wires. I was unable to use them because they wouldn't fit in my wire wrap, so I may address that later.
Final Connections/Wire Wrapping
Once you have everything wired you can go back to the battery and connect it back up. You can test it out here to see if it works and you should see lights on the Pi and a blue light on the switch. Final connections:
Make sure your car is off
- Plug in your SSD drive
- Your stereo cables into the Pi and your car's AUX port
- Wifi dongle
- Plug in the Mini USB to USB cable into the switch and Pi
- Connect the blue switch wire to the "out" pin on the switch
- Connect the white wire to the "in" pin on the switch
- The blue wire will connect to pin 23 or the 8th one down from the top
- White goes to pin 24 or the 9th from the top
*It doesn't matter if blue is used for "out" but just make sure not to cross them from one side to the other. So the "out" pin should connect to pin 23 on the Pi.
- You can then cut the wire wrap to length and cover up all your wires to make it look a little better.
- The picture with the wood block is how everything should look once it's powered on, and there should be a red power light on to the right side of the Pi.
You should now have music controllable with your phone and you can even put your library on shuffle so you don't mess with your phone while your driving!
*Side notes: I use the Volumio web UI, not the app to play my music. It won't work through the app. The first photo with the brown square outline on the side panel is where I plan to mount the the Pi with my 3D printed case.
In the case where your phone changes the IP address of the Pi when you turn on the hotspot, you will have to bring it back inside to your PC and log into your Pi and type in: ifconfig again to see the new IP address and type that in to your phones browser. This is why I recommend getting a display unit for the Pi so you don't have to keep disconnecting it. The displays for the Pi shouldn't bring you over the current limit for this setup, you can also bring a mini keyboard with you to the car so you can look up the new IP easily.
As for the SSD drive make sure to use an SSD or a thumb drive only. HDD's will draw too much power from spinning so your music will never play.
If you need help setting this up with a Pi 4 let me know and I'll see what I can do, Lastly I had to grind down a "U" shape into my fuse box cover to make room for the cables coming out of the fuse box so they wouldn't pinch.
Enjoy your sweet jams!
3D Print a Custom Case to Mount and Hide Your Pi??
This step is still in the works, I will update soon.