Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / IoT

Play audio from your Intel® Edison via Bluetooth using Advanced Audio Distribution Profile (A2DP)

5.00/5 (2 votes)
8 May 2015CPOL2 min read 8K  
Play audio from your Intel® Edison via Bluetooth using Advanced Audio Distribution Profile (A2DP)

This article is for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers

Get access to the new Intel® IoT Developer Kit, a complete hardware and software solution that allows developers to create exciting new solutions with the Intel® Galileo and Intel® Edison boards. Visit the Intel® Developer Zone for IoT.

Requirements

  • A Bluetooth* audio device, like a headset or speaker that can play sounds.

  • Connect your Intel® Edison board to a Wi-Fi* network, see Step 3: Get your Board Online.

  • SCP using a host computer connected to the same network (to copy music files over).

  • Establish a terminal to your board either Via Serial port or SSH.

Setup

Make your Bluetooth* audio device discoverable.

Type the following in the terminal to your board.

rfkill unblock bluetooth
bluetoothctl

Scan for devices.

scan on

Find your device and pair to it (replace the MAC address with the MAC address of your device)

pair 00:25:DB:05:72:F2

On some devices you may need to connect as wel

connect 00:25:DB:05:72:F2

Quit the bluetoothctl

quit

Verify that your A2DP device (the LG* headset in this case) is recognized in pulse audio as a sink device and that its sink name starts with bluez_sink.

pactl list sinks

Configure the default sink to use pulse audio server with the following command, replacing with the details of your device.

Image 1

pactl set-default-sink bluez_sink.00_25_DB_05_72_F2 

Copy an audio file (*.wav) to the Intel® Edison device using scp, and play the audio file using mplayer.

mplayer Intel_bong.wav

You may run into issues playing .mp3, stay tuned for updates.

Troubleshooting

If you're getting

Failed to pair: org.bluez.Error.AlreadyExists

then check which devices you are paired with

paired-devices

then remove the device you are paired to (replace the MAC address with the MAC address of your device)

remove 78:24:AF:13:58:B9

-----

For other useful commands inside bluetoothctl

help

More Info

Intel® Developer Zone for IoT

Start inventing today with the Intel® IoT Developer Program which offers knowledge, tools, kits and a community of experts to quickly and easily turn your innovative ideas into IoT Solutions.

Dream it, Build it with the Intel® IoT Developer Kit for Intel® Edison and Intel® Galileo platforms. These kits are versatile, performance-optimized and fully integrated end-to-end IoT solutions supporting a variety of programming environments, tools, security, cloud connectivity and hardware.

For more resources and to learn how the new Intel® IoT Developer Kit v1.0 can help streamline your IoT projects:

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)