Amazon Alexa Controlled 433mHz Remote Smart Outlets With ESP8266

3,397

13

4

Introduction: Amazon Alexa Controlled 433mHz Remote Smart Outlets With ESP8266

About: Arduino stuff | 3D printing | Amazon Echo

In this instructable I will show you how to make your Amazon Echo control 433mHz remote controlled outlets with the help of the ESP8266.

What you need:

Let's begin!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Wire Everything Up

You just have to follow the little diagram. Should not be a big deal.

Step 2: Hookup the ESP to Your PC

After you have installed the arduino software, you have to open the preferences and paste this URL into “Additional Board Manager URLs”:

http://arduino.esp8266.com/stable/package_esp8266c...

After you hit "ok", you have to navigate to Tools > Boards > Boards Manager and install the ESP8266 board package. Now you can select your board under tools.

For this sketch you also need two extra libraries:

Just add those to the libraries folder.

Step 3: Upload the Sketch

Now you can download this sketch from Dropbox and open the .ino file with the Arduino software. I changed this sketch from github slightly. At this point you have to enter your wifi's SSID and password as well as the codes of the remote outlets. You can also add more devices just by copy and pasting the lines. If that is done you can plug in your board and upload the sketch. That can take a while.

Step 4: Search for Devices

That is pretty much it! You just have to tell your Amazon Echo to search for new devices and then you can toggle the devices with the Alexa App or by simply saying: "Alexa, turn off the living room light" or something like that.

You're done! If this instructable helped you, please let me know.

Be the First to Share

    Recommendations

    • Magnets Challenge

      Magnets Challenge
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest

    4 Discussions

    0
    cmusic
    cmusic

    2 months ago

    First of all thanks to you for the great description. I replaced my old implementation with this one as Alexa was not working any more with my 433Mhz Plugs for a few months now.

    Unfortunately, this remains the same with this script. So I was wondering if the basic idea still works for you (Alexa finding devices & and being able to switch them on or off by voice command). My Alexa is discovering the (virtual nodemcu board) devices but cannot communicate with them. So calling "Alexa, turn on" returns " not found" although it is shown in the Alexa app list.

    Is this a general problem with the newest firmware or something I can fix somehow?

    0
    DominiqueL23
    DominiqueL23

    Question 8 months ago on Step 3

    Hi
    Sorry, my English is very limited
    Therefore I used google translator:-)

    This is my first introduction to arduino.
    I try your design, Amazon Alexa Controlled 433 MHz Remote Smart Outlets With ESP8266.

    Can you tell me on which lines I need to enter the codes of the lamps?

    Decimal: 1509312 (24 bit) Binary: 000101110000011111000000 Tri-State: 0FF100F11000:247 microseconds PulseLength Protocol: 1
    and
    Decimal: 1509168 (24 bit) Binary: 000101110000011100110000 Tri-State: 0FF100F10100:248 microseconds PulseLength Protocol: 1

    To make it easier I put the code there.

    Thank you.


    #include <ESP8266WiFi.h>
    #include "WemoSwitch.h"
    #include "WemoManager.h"
    #include "CallbackFunction.h"

    // prototypes
    boolean connectWifi();

    //on/off callbacks
    void lightOn();
    void lightOff();
    void secondOn();
    void secondOff();

    //------- Replace the following! ------
    char ssid[] = "SSID=OK"; // your network SSID (name)
    char password[] = "password=OK"; // your network key

    WemoManager wemoManager;
    WemoSwitch *light = NULL;
    WemoSwitch *second = NULL;

    const int ledPin = BUILTIN_LED;

    void setup()
    {
    Serial.begin(115200);

    // Set WiFi to station mode and disconnect from an AP if it was Previously
    // connected
    WiFi.mode(WIFI_STA);
    WiFi.disconnect();
    delay(100);

    // Attempt to connect to Wifi network:
    Serial.print("Connecting Wifi: ");
    Serial.println(ssid);
    WiFi.begin(ssid, password);
    while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(500);
    }
    Serial.println("");
    Serial.println("WiFi connected");
    Serial.println("IP address: ");
    IPAddress ip = WiFi.localIP();
    Serial.println(ip);

    wemoManager.begin();
    // Format: Alexa invocation name, local port no, on callback, off callback
    light = new WemoSwitch("test lights", 80, lightOn, lightOff);
    second = new WemoSwitch("second lights", 81, secondOn, secondOff);
    wemoManager.addDevice(*light);
    wemoManager.addDevice(*second);

    pinMode(ledPin, OUTPUT); // initialize digital ledPin as an output.
    delay(10);
    digitalWrite(ledPin, HIGH); // Wemos BUILTIN_LED is active Low, so high is off
    }

    void loop()
    {
    wemoManager.serverLoop();
    }

    void lightOn() {
    Serial.print("Switch 1 turn on ...");
    digitalWrite(ledPin, LOW);
    }

    void lightOff() {
    Serial.print("Switch 1 turn off ...");
    digitalWrite(ledPin, HIGH);
    }

    void secondOn() {
    Serial.print("Switch 2 turn on ...");
    digitalWrite(ledPin, LOW);
    }

    void secondOff() {
    Serial.print("Switch 2 turn off ...");
    digitalWrite(ledPin, HIGH);
    }

    0
    MichaelB1308
    MichaelB1308

    10 months ago

    Alexa found the Plug, when I try to switch the server don't run

    0
    tomatoskins
    tomatoskins

    1 year ago

    Cool! I'd love to see your finished project!