Raspberry Pi Bluetooth Receiver for your Car Stereo

RasPi Car Audio

The ability to play music in your car over a Bluetooth connection is very handy. You can typically just leave your phone’s Bluetooth module turned on and it will automatically pair to your car. Then all you have to do is load up a music player app and press play. You don’t have to worry about physically tethering your phone to the car every time you get in and out of the vehicle. Unfortunately Bluetooth is not a standard option in many cars, and it can be expensive to buy an aftermarket adapter.

[parkerlreed] built his own solution to this problem using a Raspberry Pi. He first installed arch Linux on his Pi. He also had to install pulseaudio and bluez, which is trivial if you use a package manager. He then modified some of the Linux configuration files to automatically bring the Pi’s Bluetooth adapter online once it is initialized by the kernel.

At the end of the boot sequence, the Pi is configured to automatically log in to a virtual console as [parkerlreed's] user. The user’s bashrc file is then altered to start pulseaudio in daemon mode at the end of the login sequence. This allows the Pi to actually play the audio via the Pi’s sound card. The Pi’s stereo output jack is then plugged into the vehicle’s auxiliary input jack using a standard audio cable.

The Reddit post has all of the configuration details you would need to duplicate this setup. [parkerlreed] also includes some commands you will need to setup the initial pairing of the Raspberry Pi to your smart phone. Be sure to watch the video demonstration below.

[via Reddit]

Comments

  1. Nagy István says:

    This could be also integrated with the RPi FM transmitter project and allow you to directly transmit Bluetooth audio to the car radio. Might be handy for older vehicles.

  2. AnarKIT says:

    So they got pulseaudio to be useful now? Interesting.

    I would comment on the poor audio quality of the pis output, but in a noisy environment like a car, perhaps 11 bit resolution is good enough.

    Good on ya to find interesting solutions.

    I added bluetooth to my car a couple years ago, tore the guts out of a cheap bluetooth speaker from Big Lots. Works well enough for car use, but then I got my tablet and it doesn’t have bluetooth, went back to wired aux :p

    • Greenaum says:

      I assumed the Pi would have 16-bit 44.1K stereo sound. The chip’s intended for media boxes and the like! Is there a quick guide to why the sound’s not up to scratch? I’ve looked, but it’s a big and varied subject, I’d like to get down to brass tacks.

      Is it basically a PWM that’s not running fast enough? So a sound’s frequency and “resolution” depend on each other? Cheap CD players with 1-bit DACs have managed better for decades, at what must be a very slight cost. Seems bizarre they’d design a media chip like that with no proper sound DAC. Or to put it another way, that The Foundation would choose a chip like that.

      I know HDMI is OK, since that’s all digital and designed into hardware. But the chip has no onboard sound, and they’re kludging it with a software driver driving a PWM?

      Anyway… yeah… wierd…

  3. Jeroen says:

    I don’t want to dis [parkerlreed]‘s achievement here at all, but given that I just bought a BlueTooth audio to 3.5-mm jack for my car for EUR3.74 (about $5), perhaps this is a bit of overkill?

  4. denis says:

    if his car has steering controlls he needs to have the pi listen and react to these, then it becomes a good idea to have the pi there. I use a ~£5 bluetooth reciever, arduino and canbus shield to achieve this. Could be done better but for the price of the components im happy to leave them permenantly installed as-is.

    • Shannon says:

      I looked into this as a possibility for my car, but I discovered that it speaks some completely defunct and undocumented protocol. Some people have reverse engineered it for use with commercial adaptors, but they’re not cheap.

      • denis says:

        may be worth checking to see if your car’s buttons are all taken through to the other side of the “clock spring”. Some are, some arnt. if they are, it would allow a microcontroller to pick up button presses the easy way before the car sends them across the network.

        just be carefull of probing, as obviusly the airbag(s) run thro the “clock spring” aswell.

    • fartface says:

      Not gonna happen with a honda civic and a rasPi. the Civic uses Canbus for the controls, so he will need to have a canbus board magically stuffed in that box, and then have a canbus wire connection that I dont see in the photo. Then he will need to read and look for the honda canbus signals for the steering wheel controls and then translate them in software.

      From what I read and see, he is not doing any of that, but simply replicating a $9.00 device you can get at most any gas station.

      • Greenaum says:

        Are cars supporting AVRCP yet? The media-button remote-control Bluetooth format. Most phones support that. And many cars have Bluetooth inputs to the stereo anyway.

        Being able to set up Bluetooth media flows and controls would be one actually useful use of a graphical LCD display in-car, alongside the usual fixed-function ones.

        Windows for cars seems to be sensibly being ignored by manufacturers. I’d wait until they can stop their computers crashing unexpectedly before I’d let them near a car.

        Even then, multi-function ANYTHING takes up lots of concentration, away from driving. That’s a problem a graphical user-interface can make worse or better. Better by providing enough control-space, rather than overloading several functions onto one button or display, as they often do now. Worse, by overloading too much itself and having “modes”. A driver should have the bare minimum of buttons to press and things to do besides driving and singing along. Gods save us from animated lists of our CD collections.

  5. Daniel says:

    Is it a problem that the Pi isn’t being shutdown cleanly?

    • Foobar Bazbot says:

      If it is a problem, he’s doing it wrong. (Although, given the whole automatic login / bashrc approach to running services… I wouldn’t be surprised if he’s doing it wrong.)

      Nothing about this application should require any permanent filesystem to be writable; if some of the software demands write access (e.g. logging) to run, you can direct it to a tmpfs.

  6. Blue Footed Booby says:

    The car’s console looks like it’s screaming. Can’t unsee.

  7. s

    • You don’t have to worry about physically tethering your phone to the car every time you get in and out of the vehicle.

      Sure that is nice, but comes with a downside – your phone battery is drained. While on the other hand if you plug a cable to your phone it is charging :)

  8. rasz_pl says:

    If only there was some magical place that would sell those adapters with free shipping, lets say for $7 ? …

    http://www.ebay.com/itm/Wireless-Bluetooth-V3-0-Music-Receiver-Adapter-A2DP-for-Hifi-Stereo-Audio-G9-/151290420197

    yeah, as for leaving your BT running 24/7 – thats a bad idea, just get one of the NFC tags in the car so that every time you put your phone in the car it touches the tag and turns on BT. NFC smart tags are $0.5 on scambay – just pointing it out before someone makes one using pee and two adruinos.

    • AJ says:

      Anywhoooooo….
      Good job on the hack! There are a thousand ways to accomplish a goal, and hindsight is always 20/19.5 ;)

      I like to imagine that all the negative comments here on HAD are being shouted out in a theatre by those two old muppets, Stadtler and Waldorf (sp?)

      Makes reading here much more enjoyable. ;)

      Peas!

    • Torque says:

      Oh yeah, lets buy a new phone JUST for NFC, bright idea there.

    • Greenaum says:

      I don’t suppose there’s anything stopping him adding phone charging to his device. Or just an ordinary car charger.

      Talking of which my local pound-shop (like a dollar store but 30% more expensive) has started stocking 12V car USB adaptors. On general principles I’d stay away, having seen teardowns of cheap Chinese mains USB adaptors. Then again I suppose a 7805 would do, and costs less than a pound. Is there anything on the web about these? I’ve heard stories of “adaptors” that are just a wire straight through, sending 12V out the USB hole and relying on the more expensive regulator circuits in the phone.

      Bit of an eep situation. Then again, I asked rhetorically, who’d spend 400 quid or more on an Iphone, then plug it into a charger that cost a pound? I asked it rhetorically to a guy who worked there, and astonishingly, he himself did. I know price doesn’t guarantee quality, but the opposite case is often true!

  9. dave says:

    While I applaud his effort, a single phone power/audio cable would be way cleaner than that rat’s nest of wiring he’s got there.

  10. bryan says:

    what you want is a usb dongle by creative ($30 or so) that FULLY encapsulates the bt stack internally and the host (linux, even win7) has no idea its even running bt. the key is that it supports apt-x which is the best quality audio from BT we have today (its not perfect but its the best we have NOW). it requires matching apt-x on the phone, which is not always easy to find and possibly impossible to add later. but if you have matching tx/rx with apt-x, you’ll get sound good enough for car use. and again, no bt stack has to be on the linux side; its just regular old usb-audio !! I have that dongle and love it.

  11. gravatarnonsense says:

    I don’t get why you wouldn’t want to plug your phone in to charge?

    If you are plugging the phone in to charge then the same cable carrying the audio seems the most sensible to me.

    • Greenaum says:

      Will his phone charge while it’s sending audio out through the charger port? Some do, but rely on a certain signal (pair of resistors etc) to switch the USB port into sound-output mode. But do they support charging in that mode? It’s intended to drive 2 earphones, a mic and a button, thru a port that’s often just 5 pins. It COULD be done, but do they tend to? I’ve never seen an adaptor like that, for the phones (like most Samsungs) that only have one 5-pin socket.

  12. garym53 says:

    Strange, I would have thought the one thing you would be less likely to have in your car radio than blue tooth is an auxiliary input…

    Th FM approach is obviously the most generic…

    • Blue Footed Booby says:

      Haha, what? I’ve literally never seen a car stereo that had bluetooth but not aux in. Where do you live? Could this be some sort of regional thing?

  13. JB Stockdale says:

    I have been looking for someone to make a mp3 player FM broadcaster for while now. I use one of the cheap ones from Amazon but the quality is not very good. And by quality I mean build quality and the clarity of the signal is really bad. It gets over-written quite easily. Anyone have any links for a newbie hacker along these lines?

    • BillBrasskey says:

      I don’t have any links for you, but your conclusions are spot on with the wireless adapters. I honestly still use a tape adapter connected to my old beater OG Droid which stores all of the music I need. The wireless options usually (ironically) have more wires involved than a normal system with all of the cig lighter power and mp3 player connections. I will say this as it is not probably fcc compliant in any way shape or form: If one were to crack open one of those adapters, you would find the antenna is merely a crappy line of metal in the ply of board. One could theoretically just lengthen by drilling to the antenna substrate (barring any direct solder points) and solder in a longer piece of wire for better reception. The whole problem is that the signal is trapped in the metal cage to begin with and then the shifting station popularity regionally means re-tuning the antenna broadcaster often. I feel your pain, chief. The wife and I tried several units and configs for her first ipod and then we just went back to basics after I had ebayed the lot of em. It seems like most of the current cars on the market now com equipped with line in so I guess the car companies got the hint. If you have one of the glove box or trunk multi cd players, you can pipe sound into it easier than popping out the dash etc. Hope something in my rambling, incoherent answer helps ya :)

      • Greenaum says:

        A lot of people throw their hands up and go searching for an audio signal somewhere in the radio’s guts, then solder a couple of wires in, off to a jack socket. You could perhaps find suitable pins using a crystal / piezo earpiece, one lead to ground, the other to a probe, and have the stereo tuned in to a radio station.

        For playback, one guy switched to CD mode, and played a CD full of silence he’d recorded on a PC, with his jack-plug signal in parallel.

        There’s also the option of looking for a service manual of some kind.

        If it’s any help, more and more cars are coming with Bluetooth. And many of those actually work the way they’re supposed to! So it’s a dying problem.

    • Willaim says:

      Hey I was in that same boat last year After searching for a good way to do this I was quite disparaged by the options I found Scoche makes a decent one sold at wal but they require maintenance and or replacement, at $30 a pop it adds up over a year..
      End solution the older Sansa clip loaded with rockbox software allows automatic pause and playback on charger and also auto turn off
      Next I made a box with a decent 12v charger with mini UsB cord, I actually used a gps power adaptor as it had nice filtering hooked it up to the antenna power lead on my stereo and now i have a jukebox on my car that auto resumes and takes micro usb cards plus it is robust

      • Greenaum says:

        My local Aldi had on sale a car radio with just a Bluetooth input. Possibly it had an FM radio. But no CD or tape or anything. The whole unit was almost flat, same size as the removable front-ends some car stereos have as an anti-theft measure. In this case the front-end is all there is!

        Depending on the price, and how much you love driving with music, it might be a better idea to get an in-car amplifier. They have RCA line-in sockets. Either use a lead, or one of those cheap Bluetooth receivers. If you do a nice job of the wiring, you can keep the old unit, and swap ‘em back if you sell the car.

        • Willaim says:

          i just used a pair of headphones with the stock radio apart grounded one side and probed the likely connections till i heard the cd being played next i soldered into these connections with a stereo jack and burned a blank audio file the size of the disc — tada I now have line In with the addition of the sansa and a double (male to male) stereo cord or some kind of mixing with the current cd if its not blank

    • rasz_pl says:

      If you are in Europe and want good quality FM transmitter module (even with RDS) and ATmega32 in one package look for Sony Ericsson MMR-70
      those sell for $1 on ebay, 2 euro on amazon

      http://achilikin.blogspot.com/2013/06/sony-ericsson-mmr-70-transmitter-led.html
      http://www.mikrocontroller.net/topic/252124

  14. Bogdan says:

    Ok, so except the fact that this could be replicated by a simple bluetooth audio receiver, he is considering the quality of the audio from the pi satisfactory?

    • parkerlreed says:

      Yes… yes I am. Bluetooth audio is nowhere near as bad as it used to be. Yes A2DP is compressed but for normal listening it doesn’t really matter.

  15. Don’t like Bluetooth Audio something not quiet right about the sound even on the best device.

    • BillBrasskey says:

      I have found it to be a bit laggy too, Dave. There is some intrinsic whoosh from bar to bar when a chorus or break down occurs. It is probably nano second drop frame-esque but I would agree that it seems to compress the signal before clumsily decompressing it on the fly and not oversampling the extraneous bits that lead to ECC mistakes and washy audio when there is a large frequency spectrum present. I would say a blind test of the the units available would be the best bet, but you hit a very interesting point :) I thought I was weird for hearing that but it has that “compressed to mp3″ quality that we are familiar with and probably has more to do with the expected output device (crappy phone speaker, ipod buds, or if you like paying for EQ presets, Beats by Dre lol) I would guess the whole thing would sound a right mess coming thru a Dolby processor or SRSS. Glad I am not the only one who hears these things :)

      • Greenaum says:

        Bluetooth, that is, A2DP, audio is always compressed. There isn’t the bandwidth for full-quality uncompressed music. Often it’s MP3, the receiver and player both negotiate on connection to decide the best codec they’re capable of.

        Note A2DP is an enhanced audio mode, default Bluetooth audio is meant for voice over earpieces, and is mono as well as not very good. Make sure you’re using A2DP if you’re listening over it, it’s not always enabled by default. Earpieces generally don’t support it, stereo headphones, and hifi adaptors, generally do.

      • echodelta says:

        Agreed, another useless interconnect standard.
        It’s amazing what a 3 wires can do. And two more for power.

        The argument about the car being a poor place to hear good audio is bunk. You are close to all speakers and they out do all portable, desk, soundbars and other audio gimmicks out there. The car is where most of us hear good audio. Even with factory sound. Noise floor isn’t a problem, it’s the noise on top of the music (mp3,BT,etc) and the bad studio production that’s louder than any stock car when turned up.

  16. TinkThank says:

    I was going to build something like this a few months ago, but I was going to use a board from Spark Fun to do it. I scoped out all the parts that would be required and I was at almost $90. I ordered everything and then realized there is probably something on the shelf that will do it without me having to do all the work. I know this takes the hacker fun bit out of it, but I paid $40 and it gave me a microphone as well. The only downfall to this was that I could not name the bluetooth device.

  17. Torque says:

    Playing music over bluetooth is actually less rough on the phone battery compared to plugging it in AUX with a 3.5mm jack cable.

    Apparently the internal audio amplifier hooked up to the headset port is much more power hungry than bluetooth audio streaming.

    I don’t even plug in my phone for power, except on really long road trips or when doing double duty as GPS, whereas with good ol’ jack cable that is essential unless i want to battery to be flat quickly.

    Just to give you a hint of the power consumption difference

  18. djsainty says:

    I would like to see Bluetooth connectivity added to rasbmc on the pi. In conjunction with a little 7″ screen you could have a really useful ice system.
    I’ve used it with WiFi and air play in my car, but can eat battery just as quickly as you charge it when streaming media.

    • Greenaum says:

      Surprised you can’t just “mp3player > /dev/bluetooth” or whatever. I paraphrase! I remember being impressed reading about a Silicon Graphics machine that could pipe or redirect it’s video input stream just like any other file. I think the destination was AAlib, back when it came out.

      • Mike Lu says:

        Linux machines with video input work the same way.

        • Greenaum says:

          It’s cool to know that I could write a really terrible PVR system in shell script, if I wanted to! Or maybe start a TV channel broadcasting over IRC. The “devices as files” / redirection model is one of the really clever things about Unix. I’m impressed it goes all the way up to video.

  19. Nova says:

    So freaking weird, as uncommon a name and spelling variant I have the same as this guy and added BT to my truck not long ago. Just snagged a cheap BT to 3.5mm module for $20 and wired it into ACC so when the truck is started the BT connection can be made. Cheap, easy, reliable.

    This version can easily be expanded further upon of course, mine is more of an end-route ‘no-frills’ solution.

    To anyone doing any sort of car audio project that involves a DCDC module somewhere, try to use an audio isolation transformer! ground hum is *very* easy to gain. Not so fun to get rid of otherwise.

    • Blue Footed Booby says:

      He’s a Snatcher working on stealing your life. Destroy him before he comes for you!

    • acidrain says:

      What unit did you use? I got a DF200 from dx.com, and it works great. The only downfall is that I have to hold the button down for 3 seconds to turn it on. I’d prefer something that comes online when the 12v is active.

  20. Chace says:

    I finally got everything working for this project. (A bit harder than simply following the reddit post) I can honestly say that it wasn’t worth it. My pi is sending so much noise over the 3.5mm audio. It makes me wonder why they even decided to stick one on there. Might’ve been cheaper to leave it off since it’s garbage anyways.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 91,326 other followers