Alexa Enabled Remote Control (using WEMO D1 Mini)
by gluckc in Circuits > Assistive Tech
4944 Views, 2 Favorites, 0 Comments
Alexa Enabled Remote Control (using WEMO D1 Mini)
This is an updated version of a previous post:
https://www.instructables.com/id/Voice-Activated-R...
In the previous version, I used a Geetech voice module to control a regular garage door opener type remote. In this instructable I've replaced the voice module with an Amazon Echo. In our house, the remote controls the front door.
Wire Up the Remote
If you follow along in the previous instructable (https://www.instructables.com/id/Voice-Activated-R... , you'll see that I took the case off the garage door remote and soldered the legs of the button together with a small wire. The button is now essentially always pressed. As soon as you connect the battery -- the signal is sent and the front door opens.
In the previous instructable, I used an arduino to control the power to the remote. In this update, I used a WEMO D1 mini. There are some steps to get the WEMO working with the arduino IDE, and you can follow them in this excellent instructable... https://www.instructables.com/id/Wemos-ESP8266-Get...
The reason for the WEMO is that it is WIFI enabled - and, you can use some easily available code to make it behave like a wemo belkin switch. This is an easy way to interface it with the amazon echo.
To connect the remote to the WEMO, follow the diagram given. You can also follow the previous instructable for photos/description of the setup (it's basically the same, but replacing the arduino with the wemo).
This instructable (https://www.instructables.com/id/Alexa-Controlled-Servo/ ) is basically doing the same thing, too, and is the basis for what I used to update my project. In his project he added a capacitor between the 5V and Ground pins. I haven't done that, but if I notice the wemo crashing, I probably will.
Code
First, go to:
https://github.com/kakopappa/arduino-esp8266-alexa...
and download the belkin simulation code. Put this code where all your other arduino projects are located. Then bring up the wemos.ino file in the arduino ide. The only file that needs to be modified is the wemos.ino file.
Basically, all you need to do in this file is:
1. Set your SSID and password to your wifi
2. Define your switch; (Switch *kitchen = NULL;)
3. Initialize your switch; (kitchen = new Switch("kitchen lights", 81, kitchenLightsOn, kitchenLightsOff); upnpBroadcastResponder.addDevice(*kitchen); )
4. Add to Loop section; (kitchen->serverLoop(); )
5. Make your callback for both On and Off and put whatever you want in the callback:
bool kitchenLightsOn() {
Serial.println("Switch 2 turn on ...");
isKitchenLightstsOn = true;
return isKitchenLightstsOn; }
You'll see all this in the sample wemos.ino code. Just replace the Switch-es in that file with whatever you want to make a switch. In my case, I renamed everything "door". My door off callback does nothing. My doorOn() callback changes pin D1 to HIGH. See the code I included as an example.
Downloads
Putting It Together
The first time you compile/upload to the wemo, follow along in the arduino editor console window to see that you successfully connected to wifi.
Once that worked, you can say "Alexa find devices". You should see some activity in the console window, and Alexa should confirm that she has found your switches.
Now, you are all set, all you need to say is "Alexa turn door on". This will activate the callback in your code. In my case, it sets pin D1 to HIGH. This goes to the motor controller, which then connects the 9V battery power to the remote, thus turning it on and opening the door. Voila !! magic.