I got a car recently, and it does have Bluetooth... but only for phone calls (handsfree.) It doesn't do music over the Bluetooth connection. (2010 was a weird year)
It does however, have a AUX IN, basically where you can plug in any 3.5mm audio source. Which is decent, I can just use a 3.5mm <--> Lightning adapter with my iPhone 7 and play music through a wire, but that is inconvenient and I can't charge my phone at the same time.
So I set out to look for a Bluetooth <--> 3.5mm adapter essentially, and there are many of these. One that I was 1 step away from ordering was the Sony RM-X7BT, but I thought it was a bit pricey for what it does.
One alternative that I had at home already, was the Sony SBH20. This is actually a Bluetooth headset, but as you can see in the picture, you can simply just detach the headphones and stick in any 3.5mm speakers you want.
I tried doing this and it worked great. The only flaw with it is that it has a battery, and so it stays on when I turn off my car.
The battery issue was something I discovered alot of these alternatives had.
On eBay you can find a ton of these cheap things, which seem great, but they also have a battery for some dumb reason.
Another thing I could do is that I could rip out my head unit and put in a new one, maybe one with Apple CarPlay, but for now I didn't wanna buy anything and I just wanted to use what I had around.
So I saw my Raspberry Pi sitting in a drawer, and it occured to me that it has a 3.5mm output, it is USB-powered, and I am sure I could make it be a Bluetooth receiver somehow, and after some googling and messing around, it turns out you can!
2017-07-05-raspbian-jessie-lite. Future versions may or may not work.
_DEVICE.txtand in it, put your preferred device's (your phone?) Bluetooth MAC-adress, and nothing else.
sudo raspi-config. Go into Interfacing Options and enable SSH. Also go to Boot Options, and disable "Wait for Network at Boot"
sudo apt-get install git omxplayer
git clone https://github.com/BaReinhard/Super-Simple-Raspberry-Pi-Audio-Receiver-Install.git && cd Super-Simple-Raspberry-Pi-Audio-Receiver-Install
#!/bin/bash # read preferred mac adress from the _DEVICE.txt file macadr=$(cat /boot/_DEVICE.txt) sleep 6 # change this if you want echo -e "connect $macadr\nquit" | bluetoothctl amixer set Master 50% # sound effect doesnt need to be 100% loud omxplayer /home/pi/mac.mp3 amixer set Master 100% # set pi volume to 100%, change volume with your car stereo instead
sudo chmod +x reconnect.sh
sudo crontab -e(use any editor you want)
@reboot bash /home/pi/reconnect.sh-- this will make the script run everytime you reboot (start your car)
sudo reboot now). You should see that your phone has disconnected from the device, and once your Pi is back on again, your phone should be connected again (after you hear the optional sound effect.) and you should be able to play music again
reconnect.pyand reboot again
Technically, we are kind of done now and everything works as it should. But to increase the longevity and reliability, we should dramatically decrease the amount of writes we to do the SD-card, so we don't have to worry about turning off our car in the middle of a write, thus corrupting the SD-card.
sudo nano /etc/fstab, and add these lines to the bottom of it:
tmpfs /tmp tmpfs defaults,noatime,nosuid,size=100m 0 0 tmpfs /var/tmp tmpfs defaults,noatime,nosuid,size=30m 0 0 tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=100m 0 0 tmpfs /var/run tmpfs defaults,noatime,nosuid,mode=0755,size=2m 0 0 tmpfs /var/spool/mqueue tmpfs defaults,noatime,nosuid,mode=0700,gid=12,size=30m 0 0
sudo apt-get install busybox-syslogdand
sudo dpkg --purge rsyslog
sudo nano /boot/cmdline.txtand at the very end of the line, add
These commands will essentially make most writes that we need to do happen in memory, instead of on the SD-card. Ideally we would make the entire file system read-only, which I tried, but then audio wouldn't work, as PulseAudio or something else wants to write something.
I haven't been on any long drives with this setup and I have only been messing with it for a day, so I don't know how good it will be in the long run, but I have high hopes.
Please let me know if you try this, and how it works out for you :)