Automatically Switch Between Amazon Echo Dot Internal Speaker and Bluetooth
April 18, 2018Solving the Amazon Echo Bluetooth vs Internal Speaker Problem
One common annoyance of the amazon echo dot is the inability to automatically switch between the internal dot speaker and Bluetooth connected speakers. Today on the hookup we’re going to check out a relatively simple way to solve this problem for under $10 with a microcontroller.
To start out, lets take a quick look at the problem. My home stereo receiver switches inputs between the cable box, the roku, the chromecast, and the cd input which has this Bluetooth receiver plugged into it for my echo dot. When I am playing music through my echo dot and the stereo is set to the CD input all is well and I can hear anything alexa says through my speakers. The problem comes when I’m on any other stereo input, and the echo stays connected to the Bluetooth receiver… in this case the echo’s responses get send to the Bluetooth receiver, but won’t be played out of the speakers, which means no one gets to hear her wonderfully crafted responses.
The ideal solution for this is for the Bluetooth to automatically connect and disconnect when the stereo is on different inputs, a function that is not built into the amazon echo. To accomplish this task I use an Arduino nano to intercept the infrared commands sent to the receiver, and power the Bluetooth receiver on and off accordingly.
In order to complete this project you’ll need an Arduino nano, an infrared receiver diode, an NPN transistor, a Bluetooth receiver, and of course an amazon echo of some kind. Optionally you can get some prototype boards and some screw terminals if you want to make it easier to connect and disconnect.
The basic circuit looks like this.
We will utilize the 1 amp 5v power supply from our Bluetooth receiver to power both the Arduino nano and the Bluetooth receiver. In my case I hooked the positive wire from the adapter into the 5V pin of the nano, I did this because the power supply itself was regulated, but if you were using a power supply with a voltage other than 5v you’d want to hook it into the V-in pin.
We hook up the VCC pin of the IR receiver to 5v, the ground pin to ground, and the output pin is connected to D2 on my Arduino nano. I’ve got the base pin of my NPN transistor attached to D3 on my Arduino, the collector connected to the negative wire on the Bluetooth receiver and the emitter connected to ground.
The basic idea is that the base pin on this transistor controls whether current will be able to flow from the collector to the emitter, which means it will act as a switch for the negative wire on our Bluetooth receiver’s power supply. Hooking up a transistor in this fashion is called a low side switch. When we receive specific commands from the IR receiver on pin 2 we will write pin 3 high to allow current to flow through the transistor and turn the Bluetooth receiver on, or low to block the current flow and turn the Bluetooth receiver off.
After you’ve got it all soldered up you should have something that looks like this, and you’re ready for programming.
We’re going to utilize a library in Arduino to read the IR commands. I’ll put the link to the library I used down in the description. To load the library go to the sketch menu, include library, add zip library and point it to the file you downloaded from the description. Next load up the Arduino sketch that I’ve linked below and flash it to your Arduino nano.
Once we’ve got the sketch loaded we can start figuring out which commands are being sent to the receiver. Open up your serial monitor and point your remote control at the IR receiver. Press each button for your receiver input control and take note of the IR code that is received. It’s a good idea to check each button multiple times to make sure that the code sent is the same every time and you’re not getting any interference.
Copy the IR codes to the sketch replacing the ones from my example. It’s not crucial that you update the serial print parts, but I would recommend doing it because it will make it easier to come back to your code and change it if you update components in your home theater. Once you’ve got your codes in, you just need to decide which ones should turn your Bluetooth on, and which ones should turn it off. In my case I wanted the Bluetooth to turn off for every instance except for the CD in, because that is the input that my Bluetooth receiver is hooked to. If you want to turn the Bluetooth receiver on, you’ll use digital write high, if you want to turn it off you’ll use digital write low.
If you hooked this up right now, it would work exactly the way we want it to, but I had one final hack for my purposes. I use a Logitech harmony hub to control my home theater and I wanted the echo to play through my stereo speakers when all devices were powered off. To do this I set a custom power off routine for my receiver and told it to change inputs to the CD input whenever the off command was issued. This means that alexa will always answer me through the stereo speakers unless the TV is on, in which case she will use the built in speaker on the echo dot.
This was my personal solution to this problem, but I can’t guarantee that it was the best one. If you solved this problem a different way I’d love to hear about it in the comments. If you enjoyed this video please consider subscribing! As always, thanks for watching the hook up.
Links:
Amazon Links:
Arduino Nano: https://amzn.to/2qHI1BZ
Infrared Receiver: https://amzn.to/2HctRUB
NPN Transistor: https://amzn.to/2qHLtfO
Bluetooth Receiver: https://amzn.to/2qKppB4
Amazon Echo Dot: https://amzn.to/2HLqFfk
Prototype Boards: https://amzn.to/2qHLyQE
Screw Terminals: https://amzn.to/2qOe975
Harmony Hub: https://amzn.to/2qJmoRO
Arduino IR Library: https://github.com/z3t0/Arduino-IRremote
Arduino Sketch: https://github.com/thehookup/EchoIRControl/blob/master/NanoIR.ino
Support my channel:
Patreon: https://www.patreon.com/thehookup
Music by www.BenSound.com