Shawn hymel
Published © CC BY

Hack Your Home Part 2: IFTTT

Set your appliance to turn on at sunset or control it using the IFTTT Do Button app.

BeginnerFull instructions provided1 hour2,948
Hack Your Home Part 2: IFTTT

Things used in this project

Hardware components

Photon
Particle Photon
×1
PowerSwitch Tail II
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
USB microB Cable
×1
Wall Adapter - 5V USB
×1
Resistor 1k Ohm
×1
Transistor - NPN
×1
SPDT Mini Power Switch
×1

Software apps and online services

IFTTT

Hand tools and fabrication machines

Screwdriver - Flat

Story

Read more

Schematics

IFTTT-On-Off Fritzing Diagram

Code

IFTTT-On-Off

Arduino
Paste this into a build.particle.io app.
int pst = D6;

void setup() {
    
    // I/O as output
    pinMode(pst, OUTPUT);
    
    // Register a cloud function
    Particle.function("switch", pinSwitch);
}

void loop() {
    
}

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

Credits

Shawn hymel

Shawn hymel

10 projects • 116 followers
Engineering Superhero at SparkFun Electronics.

Comments