LEGO Mindstorms EV3 Audio Streamed via Bluetooth Audio

PDF24    Send article as PDF   
Whilst displaying my Robots at a major Exhibition, I got to thinking that it would be great to pipe the EV3’s Audio to a Bluetooth Speaker, so my robot can be heard among the noise of a crowd.
Here are my notes so far on getting started with Connecting a LEGO Mindstorms EV3 Brick to a Bluetooth Audio Speaker:

  • Debian jessie is using BlueZ 5 and PluseAudio 5, which are fairly new. There were major breaking changes in these versions, so most stuff you find on the Internet will be for BlueZ 4/PulseAudio 4, so it does not work at all, so watch out.
  • BlueZ 5 dropped support for alsa [1], so the solution for now (until someone updates some bluez-alsa project for BlueZ 5) is to use PulseAudio.
  • PulseAudio 5 only supports the A2DP profile and not HSP/HFP [2] (although it his under development [3]).

Lets Start:

IMPORTANT:

This tutorial uses the EV3dev Linux Distribution for the LEGO Mindstorms EV3 Brick.

  • How to get PulseAudio working with Bluetooth (all this should be done as root): sudo su

    • apt-get install --no-install-recommends pulseaudio pulseaudio-module-bluetooth

    • Create a systemd service for running pulseaudio as the pulse user. Save this file as /etc/systemd/system/pulseaudio.service and reload systemd with systemctl daemon-reload

    • Give the pulse user permission to use Bluetooth. Save this file to /etc/dbus-1/system.d/pulseaudio-bluetooth.conf

    • Paste the following lines to the end of /etc/pulse/system.pa:

    • Next, sudo mkdir -p /var/run/pulse/.config/pulse

    • Next, sudo chown -R pulse:pulse /var/run/pulse

    • Start the systemd service. systemctl start pulseaudio.service

    • Run bluetoothctl to connect the device. You only need to do the pairing stuff once. Here are the commands. Be sure to substitute the MAC Address of the actual device your are connecting to:

    • Now, you should be able to play sound from a remote device on your EV3 without any further configuration.

  • To play sound from the EV3 on a remote device, there are a few more steps.

    • add root and your non-root user(s) to the audio and pulse-access groups: usermod -a -G pulse-access,audio root.

    • Run pactl list. The end of the output should look something like this:

    • The active profile probably doesn’t say a2dp so set it by running:

    • Now you can play sound using aplay. Example:

    • Text-To-Speech

Thank you to David Lechner, Jorge Pereira, and Ralph Hempel for their help with this article.

Previous Post
EV3Lights

RGB LED Strip Controller for LEGO Mindstorms EV3 or NXT

Some may have seen my article, "Using WS2812B Addressable RGB LED Strips with Arduinos", back in September? As can be seen in that article, controlling Addressable LEDs is pretty straight forward with ... Read more

Next Post

Powering the LEGO Mindstorms Brick from a 9v Plugpack

I have been asked a number of times too how I power my Stationary and Development Robots from a 9 Volt, 5 Amp D.C. Plugpack connected to the Mains Power ... Read more

Short URL: http://tinyurl.com/mhqol2f

Leave a Reply

Your email address will not be published. Required fields are marked *



Do NOT follow this link or you will be banned from the site!
error: Content is protected !!