GeorgiaAndrew Lanier
Published

Photon Automatic Blinds

A Photon that uses a light sensor to control a motor to open and close the blinds when the light is shining in.

EasyFull instructions provided3 hours149
Photon Automatic Blinds

Things used in this project

Hardware components

Photon
Particle Photon
×2
Americal MG-360M Robotic Supply
×1
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×2
Resister 220 Ohms
×1
Popsicle Sticks
×2
Super Glue
×1
Anker Powercore
×2
Wires
×3
Blinds
×1
Custom Spool Component
×1

Software apps and online services

Particle Pi
Particle Pi
Maker service
IFTTT Maker service

Hand tools and fabrication machines

Exacto Blade
Sharpie

Story

Read more

Custom parts and enclosures

Spool

Schematics

Photo Resistor

Photoresistor qrat0huyto

Servo

Servo opm1lfd5mk

Code

Servo Code

C/C++
Servo myservo;

int position = 0;
void setup() {
  

Particle.subscribe("BlindVal", myHandler);


}

void myHandler(const char *event, const char *data)
{


 if (strcmp(data,"Night")==0) {
   
    
     myservo.attach(D0);
     
 
myservo.write(120);

delay(500);

 
myservo.detach();


Particle.publish("Respond", "ON", 60, PUBLIC);
}


else if (strcmp(data,"Day")==0) {
  
  
myservo.attach(D0);

 
myservo.write(60);


delay(500);

 
myservo.detach();


Particle.publish("Respond", "ON", 60, PUBLIC);
}


else{}
}

Photo Resistor Code

C/C++
int power = A5; 
int BlindVal = A0; 
int light_intake = 100; 
int temp = 0; 
int analogvalue=0; 
void setup() {

    pinMode(BlindVal,INPUT); 
    pinMode(power,OUTPUT);
    digitalWrite(power,HIGH);

    Particle.variable("analogvalue", &analogvalue, INT); 
   Particle.subscribe("Respond", myHandler);
   
}
void loop() {
    temp = analogvalue; 
    analogvalue = analogRead(BlindVal); 
   if (analogRead(A0) >= light_intake & temp < light_intake){
       Particle.publish("BlindVal", "Day", 60, PUBLIC);
       }
   if (analogRead(A0) < light_intake & temp>= light_intake){
   Particle.publish("BlindVal", "Night", 60, PUBLIC);
   }
    delay(1000); 
}
void myHandler(const char *event, const char *data){
 if (strcmp(data,"ON")==0) {
     digitalWrite(D7,HIGH);
     delay(1000);
     digitalWrite(D7,LOW);
     
 }
}

Credits

Georgia

Georgia

1 project • 0 followers
Andrew Lanier

Andrew Lanier

1 project • 0 followers

Comments

Add projectSign up / Login