Things used in this project

Hardware components:
Photon new
Particle Photon
×1
PowerSwitch Tail II
×1
12002 04
Breadboard (generic)
×1
11026 02
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

Schematics

IFTTT-On-Off Fritzing Diagram
Hack Your Home Part 2.fzz

Code

IFTTT-On-OffArduino
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

Engineering superhero
Shawn hymel
5 projects • 58 followers
Engineering Superhero at SparkFun Electronics.
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Add projectSign up / Login