Keith Mitchell
Published © GPL3+

Controlling my Desktop Computer with IFTTT and Photon

I wanted to keep my desktop computer out of the way, but have an easy way to turn it on. The solution? IFTTT and the Photon

BeginnerFull instructions provided6,649
Controlling my Desktop Computer with IFTTT and Photon

Things used in this project

Hardware components

Photon
Particle Photon
×1
Resistor 1k ohm
Resistor 1k ohm
×1
General Purpose Transistor NPN
General Purpose Transistor NPN
×1
Male-Header 36 Position 1 Row- Long (0.1")
Male-Header 36 Position 1 Row- Long (0.1")
×1
Female Header 8 Position 1 Row (0.1")
Female Header 8 Position 1 Row (0.1")
×1
Jumper wires (generic)
Jumper wires (generic)
×1
SparkFun Snappable Protoboard
SparkFun Snappable Protoboard
×1

Software apps and online services

IFTTT

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Circuit

Code

Photon Code

C/C++
This listens for the "start_computer" event. Flash it to your Photon from build.particle.io
//The pin you want to control, in this case I'm using digital pin 7
int led = D7;

//This function is called after the Photon has started 
void setup(){
    //We set the pin mode to output
    pinMode(led, OUTPUT);
    //We "Subscribe" to our event called "start_computer" so that we get the events for it 
    Particle.subscribe("start_computer", myHandler);
}

//The program loop, not sure if this has to be here for the program to run or not
void loop() {}

//The function that handles the event from IFTTT
void myHandler(const char *event, const char *data){
    // We'll turn the pin on
    digitalWrite(led, HIGH);
    
    // We'll leave it on for 500 milliseconds...
    // If it's left on too long, it will trigger a hard reset
    // and it it's too little, the computer won't register it
    // I found 500 milliseconds to work well
    delay(500);
    
    // Then we'll turn it off...
    digitalWrite(led, LOW);
}

Credits

Keith Mitchell

Keith Mitchell

10 projects • 43 followers
Canadian DevOps Engineer and hobbyist technology enthusiast

Comments