Shawn hymel
Published © CC BY

Echo Kill Switch

Use Amazon Alexa to trigger an IFTTT applet that causes a Particle Photon to remove power from an Echo.

BeginnerFull instructions provided2 hours12,087
Echo Kill Switch

Things used in this project

Hardware components

Photon
Particle Photon
×1
Echo Dot
Amazon Alexa Echo Dot
×1
Breadboard (generic)
Breadboard (generic)
×1
N-Channel MOSFET
×1
Pushbutton 12mm
×1
LED (generic)
LED (generic)
×1
Resistor 1M ohm
Resistor 1M ohm
×1
Resistor 100 ohm
Resistor 100 ohm
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Resistor 1k ohm
Resistor 1k ohm
×1
Jumper wires (generic)
Jumper wires (generic)
×1
SparkFun microB USB Breakout
SparkFun microB USB Breakout
×1
USB Type A Female Breakout
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×2

Software apps and online services

Amazon Alexa service
IFTTT Amazon Alexa service

Story

Read more

Schematics

Echo Kill Switch Schematic

Code

Echo Kill Switch Particle Code

Arduino
Copy this into the Particle IDE
// Kill switch for Amazon Echo

int kill_switch = D5;
int button = D6;
int btn_prev_state = HIGH;

void setup() {
    
    // Switch is output, button is input
    pinMode(kill_switch, OUTPUT);
    pinMode(button, INPUT);
    
    // Initialize kill switch as default low
    digitalWrite(kill_switch, LOW);
    
    // Register a cloud function
    Particle.function("killSwitch", killSwitch);
}

void loop() {
    
    // If button is pushed, toggle kill switch
    int btn_state = digitalRead(button);
    if ( (btn_state == LOW) && (btn_prev_state == HIGH) ) {
        digitalWrite(kill_switch, !digitalRead(kill_switch));
    }
    btn_prev_state = btn_state;
}

int killSwitch(String state) {
    
    // Set pin state based on given parameters
    if ( state == "on" ) {
        digitalWrite(kill_switch, HIGH);
    } else if ( state == "off" ) {
        digitalWrite(kill_switch, LOW);
    } else {
        return -1;
    }
    
    return 0;
}

Credits

Shawn hymel

Shawn hymel

10 projects • 116 followers
Engineering Superhero at SparkFun Electronics.

Comments