Jesse PetersonAdam SnellingsMcKye Marrs
Published © GPL3+

Agron Powered Motorized Blinds

Have you ever had plants die cause you forgot to roll up the blinds? These motorized blinds will roll up and down for optimal sunlight!

IntermediateShowcase (no instructions)Over 3 days220
Agron Powered Motorized Blinds

Things used in this project

Hardware components

Argon
Particle Argon
Project required use of 3 separate argons all communicating bi-laterally
×3
Rotary Encoder with Push-Button
Rotary Encoder with Push-Button
×1
DC motor (generic)
×1
Anker Battery
5V, 2.1 Amp, 20,000 mah battery
×1
Photo resistor
Photo resistor
×1
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Bearing Holder

The 3d printed housing to seat the bearing into the blinds, this is press fit.

Motor Hold

This is for holding the motor to the blind assembly. Uses m2.5 machine screws for holes

Circuit Box

Left off from actual build as ran out of time and had to use multiple argons, but this was built to hold the argon setup, photoresistor, and dc booster to allow for a sleak hidden look

Box Top

Box Top

Schematics

Circuit Diagram

Code

The Main Argon Code

Arduino
This code operates is the hub for the system. The project required use of 3 separate argons so this code communicate between the two of them and then this operates the photoresistor and motor.
//Down = 1
//up = 0

int photoresistor = A0;
int Up = A4;
int Down = A5;
int Counter;
int led = D7;
int Tick;

void setup() {
    
  pinMode(photoresistor,INPUT);  // Our photoresistor pin is input (reading the photoresistor)
  pinMode(Up,OUTPUT); // Motor is Output
  pinMode(Down,OUTPUT);
  pinMode(led,OUTPUT);
  Particle.subscribe("TriggerBlinds", ButtonTrigger,"e00fce689def9ddd66e93ac0");
  Particle.subscribe("EncoderReading",encoderReading,"e00fce68e379de1c253ecfe7");
  
}

void loop() {             
    Tick++;
    if(Tick ==1)  //this tick++ then if statement is to set counter equal to zero on first run of loop
    {
  Counter = 0;
  String SendCounter = String(Counter);   //converting to string to send via publish
  Particle.publish("CounterDigit", SendCounter); //publish to cloud
    }
  delay(60000);
  String photoCellReading = String(analogRead(photoresistor)); //converting to string to send via publish
  Particle.publish("PhotoResistor", photoCellReading);    //Publish for Graphing
  if(analogRead(photoresistor)<800 && Counter==1) //measured ~800 in dawn for best time to put shades up in morning will stay below 800 all day, after checking if up or down
  {
        analogWrite(Up,4095); //wind up
        //need to add stop for motor
        delay(10000); //Run for 10 sec
        analogWrite(Up,0); // Motor off
        Counter--;
        String SendCounter = String(Counter);  // send to other devices
        Particle.publish("CounterDigit", SendCounter);
  }
  else if(analogRead(photoresistor)>1000 && Counter==0) // When it ticks over 1000 that means starting to get dark and drops blinds after checking if up or down
  {
        analogWrite(Down,4095); //wind down
            delay(10000); //run for 10 sec
        analogWrite(Down,0); // Motor off
        Counter++;
        String SendCounter = String(Counter);
        Particle.publish("CounterDigit", SendCounter);
        Particle.publish("ResetRotary", "Reset");
  }
  else
  {
  analogWrite(Up,0); // keeps motor off while the conditions are not met
   analogWrite(Down,0);

  }
  
}


void ButtonTrigger(const char *event, const char *data)    //function for the subscription to button Argon Device
{
 if (strcmp(data,"0")==0) {   //checking if data = 0
  digitalWrite(led,HIGH);     //turn on LED for signal
  analogWrite(Up,4095); //wind Up
  delay(10000);
        analogWrite(Up,0);
        Counter = 0;
        String SendCounter = String(Counter);
        Particle.publish("CounterDigit", SendCounter);
          digitalWrite(led,LOW);    //Turn off LED
  }
  
  else if (strcmp(data,"1")==0) {     //checking if data = 1
        digitalWrite(led,HIGH);          //turn on LED for signal
        analogWrite(Down, 4095);                //wind Down
        delay(10000);
        analogWrite(Down,0);
        Counter = 1;
        String SendCounter = String(Counter);  // send to other devices
        Particle.publish("CounterDigit", SendCounter);
          digitalWrite(led,LOW);       //Turn off LED
    }
    
  else {
    }
  }
  
  void encoderReading(const char *event, const char *data)    //function for the subscription to Encoder Argon Device
{
 if (strcmp(data,"-918")==0 || strcmp(data,"918") == 0) {   //checking if encoder = x amount of turns
  analogWrite(Up,0); //stop
  analogWrite(Down,0);
    }
  }
  

Button Argon Code

Arduino
This is one of the sub argons of the system. This monitors the button press wirelessly and can act as a remote for the system.
int Button = D8;
int Counter;

void setup() {
pinMode(Button,INPUT);
Particle.subscribe("CounterDigit",CounterFunc,"e00fce685afcbe5b8acf2777");
}

void loop() {
    
    if(digitalRead(Button) == HIGH && Counter == 0)
    {
    Counter++;
    String SendCounter = String(Counter);
    Particle.publish("TriggerBlinds",SendCounter);
    }
    
    else if(digitalRead(Button) == HIGH && Counter == 1)
    {
    Counter--;
    String SendCounter = String(Counter);
    Particle.publish("TriggerBlinds",SendCounter);
    }

}

void CounterFunc(const char *event, const char *data)
{
 if (strcmp(data,"0")==0) {
    Counter = 0;
  }
  else if (strcmp(data,"1")==0) {
    Counter = 1; 
    }
  else {

  }
}

Rotary Argon Code

Arduino
This Code operates the sub argon for the rotary encoder, THis reads the encoder data and send it to the main argon then after a full raise or lower is complete it receives a reset signal from the main argon
int Counter;
int ChannelA = D8;
int ChannelB = D6;
int encoderPos;
int encoderLast = LOW;
int n;


void setup() {
pinMode(ChannelA, INPUT);
pinMode(ChannelB, INPUT);
Particle.subscribe("ResetRotary",Reset,"e00fce685afcbe5b8acf2777");

}

void loop() {

n = digitalRead(ChannelA);
if(encoderLast == LOW && n == HIGH)
{
    if(digitalRead(ChannelB) == LOW)
    {
        encoderPos--;
    }
    else
    {
        encoderPos++;
    }
    String sendEncoder = String(encoderPos);
    Particle.publish("EncoderReading",sendEncoder);
}
encoderLast = n;
}


void Reset(const char *event, const char *data)
{
encoderPos = 0;
}

Credits

Jesse Peterson
1 project • 0 followers
Contact
Adam Snellings
1 project • 1 follower
Contact
McKye Marrs
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.