Amazon Alexa Controlled 433mHz Remote Smart Outlets With ESP8266

2,462

13

3

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!

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.

Share

    Recommendations

    • DIY Summer Camp Contest

      DIY Summer Camp Contest
    • Classroom Science Contest

      Classroom Science Contest
    • Sew Tough Challenge

      Sew Tough Challenge

    3 Discussions

    0
    None
    DominiqueL23

    Question 2 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
    None
    MichaelB1308

    4 months ago

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

    0
    None
    tomatoskins

    1 year ago

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