I am trying to use Amazon Echo as an speaker with Raspberry PI3. While it mostly works and I am able to pair and play audio files, the bluetooth connection gets dropped after 4-5 hours.

I am thinking if - I can connect to Amazon Echo via script then I can check for connectivity and fix it - when connection is dropped.

I am already able to do this from GUI and I have made some progress via command line using bluetoothctl command as well. The problem is - when I connect to Echo via bluetoothctl command, although connection is successful - it doesn't play media files successfully.

To connect to Echo from CLI, I am simply using bluetoothctl connect command.

  • How did you pair it? I am able to pair but I can not play audio. The echo connects as sink and source at the same time. – Thorsten Mar 2 '17 at 10:19

Try also bluetoothctl pair and bluetoothctl trust maybe it will solve your problem.


This script worked for me to automate pairing an Amazon Echo with a Pi 4 running Raspbian Buster.

Is this the most elegant way to automate connecting an Amazon Echo speaker? I would suspect not. bluetoothctl is not very script-friendly, so this is best-efforts basis folks. However, I think it's a great starting point to fix a problem I can see at least 3,000 other geeks are interested in solving at the time of me writing this.

Basically, the way I attacked the problem was to filter the MAC address of the Echo speaker and then operate on it as a variable. Again, this script could probably do with a big tidy-up, so if anybody has ideas on improving it, they're welcome folks.


# Add some audio and Bluetooth packages
apt-get install blueman pulseaudio pavucontrol pulseaudio-module-bluetooth
read -p 'Say "ALEXA PAIR" and then press ENTER to continue'

# Capture Mac Address of Alexa Speaker by grepping for the string "Echo" from the bluetoothctl scan:
ALEXAMACADDRESS=$(sudo timeout 10s bluetoothctl scan on >> /home/pi/scan-output.txt | cat /home/pi/scan-output.txt | grep -m1 '.*Echo.*' | awk '{print $3}')

bluetoothctl pair $ALEXAMACADDRESS
bluetoothctl connect $ALEXAMACADDRESS
bluetoothctl trust $ALEXAMACADDRESS

Please note that once paired, it's down to you to set the Echo as the audio output where required- T

protected by Community Mar 2 '17 at 11:35

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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