📜 ⬆️ ⬇️

Audio playback on Intel Edison via Bluetooth using the Advanced Audio Distribution Profile (A2DP)

During the implementation of projects on the Intel Edison board, it is sometimes necessary to reproduce sound. Alsa has been added to the latest versions of the Yocto image, and you can use a USB audio card. But greater mobility will give the use of the integrated Bluetooth module. For example, a device based on Intel Edison, which receives audio files over the network, may be stationary in one place in the room. You can listen to music anywhere in the room using conventional wireless headphones. So, let's begin.

image

You will need



Customization


Turn on your Bluetooth device and make it visible. Enter the following commands in the terminal:

rfkill unblock bluetooth bluetoothctl 

Scan available Bluetooth devices:
')
 scan on 

Find your device and join it (substituting its MAC address):

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

Establish a connection if necessary:

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

Close the bluetoothctl program:

 quit 

Check that your A2DP device (in our case, LG headphones) was recognized in pulseaudio as a sink device and its name begins with bluez_sink

 pactl list sinks 



Configure the default sink for use in pulseaudio with the following commands, substituting the parameters of your device:

 pactl set-default-sink bluez_sink.00_25_DB_05_72_F2 

Copy the audio file in wav format to the Intel Edison board using scp (Linux) or pscp.exe (Windows) and play it through mplayer:

 mplayer Intel_bong.wav2 

Use wav files, as there may be some difficulties when playing mp3 files.

Troubleshooting


If you received:

 Failed to pair: org.bluez.Error.AlreadyExists 

Check what device you have connected:

 paired-devices 

Delete the device to which you are connected (substitute the MAC address of your device):

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

Other useful bluetoothctl commands can be obtained as follows:

 help 

Additional Information



From translator


While checking this article I have some problems. The device could not be connected using the connect command, there was no pactl command. The Edison board was right out of the box, so all this was decided by flashing the new version of the Yocto image.

To reflash the board, you can use the following recommendation . I did a little different in Windows.

In the folder with the unpacked Yocto archive on a Windows computer, run flashall.bat. Perhaps you will also need the dfu-util.exe program, which should be placed in the same unpacked folder. The program itself is available by reference .

A discussion of dfu-util under Windows and a flashing of Edison can be found here and here .

See also:

» Workshop« Intel IoT ». Edison - the mighty "crumb"

Source: https://habr.com/ru/post/258157/


All Articles