mikesoniat
Published

Wi-Fi Controlled Outdoor Christmas Lights Timer

This project uses a Particle Photon 2 to control outdoor Christmas lights from my phone and the cloud via Wi-Fi!

IntermediateFull instructions provided6 hours217
Wi-Fi Controlled Outdoor Christmas Lights Timer

Things used in this project

Hardware components

Photon 2
Particle Photon 2
×1
120 VAC to 5 VDC power supply
×1
1 Channel Relay Module
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
Maker service
IFTTT Maker service

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires

Story

Read more

Schematics

WiFi Controlled Electrical Outlet

Code

WiFi Controlled Electrical Outlet

C/C++
Outdoor electrical outlet powered by Particle Photon 2, and controlled over wifi from IFTTT.
// WiFi controlled electrical outlet
// Requires 10A 120v relay connected to D2 pin
// Relay is triggered on HIGH signal
// Publish functions to turn on and off via web services
// Powered by Photon 2
// Mike Soniat
// 2023

int relay = D2;

int cycleOutletOn(String command)
{
    digitalWrite(relay, HIGH);
    Particle.publish("lights_on");
    return atoi(command);
}

int cycleOutletOff(String command)
{
    digitalWrite(relay, LOW);
    Particle.publish("lights_off");
    return atoi(command);
}

void setup() {
    
    pinMode(relay, OUTPUT);
    digitalWrite(relay, LOW);
    
    Particle.function("LIGHTS_ON", cycleOutletOn);
    Particle.function("LIGHTS_OFF", cycleOutletOff);    

}

void loop() {

}

Credits

mikesoniat

mikesoniat

6 projects • 19 followers
I've been an electronics hobbyist, hacker, maker for as long as I can remember. My current passions are robotics, AI, and machine learning.

Comments