6
\$\begingroup\$

I am working on a project that will digitize an audio signal from a standard RCA jack and transmit that signal using Bluetooth to a receiver and then convert it back to an analog signal which I will output to a speaker.

I know that I will need 2 microcontrollers that will handle Bluetooth as a receiver and transmitter. However, I'm not sure about what microcontroller will let me do this.

Would an Arduino BT (transmitter) allow me to send an audio signal wireless via Bluetooth to another Arduino BT that acts as a receiver? I'm not quite sure about the sampling rate or transfer bit rate that allows me to do this.

\$\endgroup\$
  • 2
    \$\begingroup\$ To know the transfer bit rate, you have to know approximately the quality of the audio output that you want: it's harder to send a 320kbps, 44100Hz mp3 than a 128kbps, maybe at a lower sampling rate (e.g. 22050Hz). And take into account that it will introduce a delay, and maybe can cause gaps, in case the signal is poor. \$\endgroup\$ – clabacchio Feb 6 '12 at 8:03
  • \$\begingroup\$ Then you can think about a protocol, but you want absolutely to use Bluetooth? \$\endgroup\$ – clabacchio Feb 6 '12 at 22:55
  • 1
    \$\begingroup\$ @xsari3x it is great that you are putting a bounty on this question. But Joby has already linked to a question that seems to cover most of this question. Clabacchio has also asked some questions that haven't been answered yet. Those will need to be answered before this question can get any good answers. All that you are asking for in your bounty description is far too broad of a scope for a single question. \$\endgroup\$ – Kellenjb Feb 9 '12 at 23:57
  • \$\begingroup\$ @Kellenjb MMMM SO I lost my points :S \$\endgroup\$ – xsari3x Feb 10 '12 at 1:39
  • \$\begingroup\$ @xsari3x - No, you still have the bounty - You just need to put down some basic specifications. EEStudent should have done the same, but didn't - Go ahead and get research some 'standard' specs and edit them into the question. \$\endgroup\$ – Kevin Vermeer Feb 10 '12 at 17:27
9
+50
\$\begingroup\$

Bluetooth is a term that covers a protocol stack and the hardware specification required to implement radio based links between two or more devices in a standardised way. The aim is to allow consumers to be able to purchase "Bluetooth" capable devices from any vendor and that those products should function with each other without issue. Thus your Nokia mobile phone should function with a Motorola head-set or the hands-free car kit in your BMW without any issues or problems.

Allowing "anything" to connect to "anything" via the Bluetooth protocol does not always make practical sense, neither is it always worthwhile. For example, does it make sense that a Bluetooth enabled printer can connect to a Bluetooth headset? Additionally, the type of data you wish to transfer over the Bluetooth link is important to know. For example, if I wish to print something out via Bluetooth, I am more concerned that my letter is printed without error rather than how long it takes (within reason). For audio, I am more concerned that I have a stream of continuous audio without breaks, pops or crackles but if a millisecond or two of audio is lost occasionally or the signal is not 100% accurately reproduced upon arrival, I probably won't hear this. (Hence, if you are an audiophile, Bluetooth is not a choice you would consider!)

Thus, depending on what type of data and functionality is desired, the Bluetooth SIG (they write the specification) have defined different "profiles" to cover them. For a plain vanilla data connection to provide a wireless alternative to a COM/RS-232 type connected, you have the "Serial Port Profile" or SPP. For high-quality audio transfer you have the "Advanced Audio Distribution Profile" or H2DP. For low-quality telephony audio for head-sets you have the "Head Set Profile" or HSP. (see http://en.wikipedia.org/wiki/Bluetooth_profile)

So, to the Arduino BT module. Looking at the brief overview it seems to be targeted at serial data transfer and I am probably not far wrong in saying that it uses primarily the SPP profile. Thus the data rate on offer will vary wildly depending on factors such as distance, interference etc. Not an issue perhaps for wireless data, but no good for wireless audio where a 'as good as electronically possible' minimum data rate needs to be guaranteed.

Thus you need to look for a Bluetooth module that supports the A2DP profile, of which there are many (randomly found product is here http://kcwirefree.com/audio.html)

A system build up for an audio link via Bluetooth could look as follows:

Audio In/Out <-> Audio CODEC (hardware) <-> Microcontroller <-> BT Module <-> Antenna

or

Audio In/Out <-> Audio CODEC (hardware) <-> BT Module <-> Antenna
                                  ^          ^
                                  |          |
                                 Microcontroller

Note that there are some BT modules that have all the necessary support and only require the external Audio CODEC and no microcontroller at all.

The audio CODEC is a hardware chip that converts analogue audio signals into a digital bit stream, as well as doing the reverse, which has a interface functioning similar to SPI except the clock runs continuously. Such an interface is often call I2S. They also have a real SPI interface that is used to configure the CODEC (sample rate, amplification of signals etc.) An example from Wolfson is here: http://www.wolfsonmicro.com/products/codecs/WM8731/

The microcontroller performance depends on how much of the Bluetooth protocol is implemented in the Bluetooth module. The Bluetooth protocol stack splits fairly neatly in two; below HCI and above HCI, where HCI stands for Host Controller Interface. Bluetooth implementations for PCs (as an example) use Bluetooth modules/chipsets where only HCI and below is implemented, and then rely on the the PC operating system to run the HCI and above portion of the software stack. The upper half of the stack requires a decent performance processor (own experience says 16-bit and 16MHz or better considering you probably want to run your own application too!) Many Bluetooth modules have the whole stack and much more running on them and then offer some sort of proprietary protocol over a serial interface (USART, I2C or SPI) allowing you to interact with the Bluetooth module. This protocol allows you to choose the profiles you want to use, set up a PIN code, create and destroy connections etc. In this case a simple 8-bit microcontroller with a few kBytes flash and a few hundred bytes of RAM should suffice for implementing an audio link.

Bluetooth is not a simple protocol to implement. Even the big consumer electronics manufacturers have challenges to get it right (although they have more at stake if it doesn't work perfectly all the time!)

It may seem like a cop-out/taking the easy path but I would seriously recommend using a module solution that is designed to support audio over Bluetooth such as the link already mentioned (http://kcwirefree.com/audio.html) Your chances of success are much higher and you will be able to concentrate of some other cool features you may want to implement rather than struggling to make the Bluetooth link work.

Please note: I am in no way related to any of the companies I mentioned here - they are simply the most relevant links that appeared highest on Google when I looked.

Hope this fills some knowledge holes. Feel free to add any corrections you see necessary!

Best regards, Stuart

\$\endgroup\$
  • \$\begingroup\$ Thank you , your answer is great :))) & full of lot of info \$\endgroup\$ – xsari3x Feb 10 '12 at 22:46
  • 2
    \$\begingroup\$ You're welcome. I spent a couple of years working on Bluetooth, and I am afraid it is not that simple. The massive number of modules available in the market simplifies things a lot, but even then you'll still need persistence to get everything working as you desire if you have little or no previous background. Good luck to anyone who gives it a go - despite the negative slant of my replies, getting this up and running will be very rewarding and an excellent learning experience! \$\endgroup\$ – Stuart Cording Feb 13 '12 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.