Maria Tapia
Published

Lane Tech HS- Home Automation with a Speaker

Have a sibling that always wakes up late? You can wake them up with a push of a button from the comfort of your bed.

BeginnerFull instructions provided3 hours26
Lane Tech HS- Home Automation with a Speaker

Things used in this project

Hardware components

Argon
Particle Argon
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Blynk
Blynk
Particle Build Web IDE
Particle Build Web IDE

Story

Read more

Schematics

Servo Wiring

Code

Servo Home Automation

C/C++
// This #include statement was automatically added by the Particle IDE.
#include <blynk.h>
Servo myservo;


char auth[] = "SHp26VYNHYH56OY2VBF_fU9JafXIbp-W";  // given by blynk

int led = D7;

int test = 1;
void setup() {
    
    Blynk.begin(auth);
    
    pinMode(led,OUTPUT);
    
    myservo.attach(D4);
    
    Time.zone(7);  // setting time zone
   
   

}

void loop() {
    Blynk.run();
    //prints out the date and time in year-month-day-hour-minute- number of hours difference from the UTC 
    Serial.println(Time.format(TIME_FORMAT_ISO8601_FULL));
    //prints out the time based off the central time zone
    Serial.println(Time.hour() );
    //prints out the minutes based off the central time zone
    Serial.println(Time.minute());
    
  
    //the statement that willl trigger the servo  (can be done manually or automatically at specified time)
    if (digitalRead(led) == HIGH || Time.hour() == 7 && Time.minute() == 45  && Time.isAM()==1)  
  // the isAM is based of the UTC time so I just calculated what time be 
  // it would be in UTC time when it's 7:45 am in central time. 
    {
        myservo.write(180);
        delay(700);
        myservo.write(5);
        delay(750);
        
        Serial.println("The servo was triggered");
    }
    
    //this statement lets you know when the servo has stopped "opening and closing" 
    
    if (digitalRead(led) == LOW)
    {
        Serial.println("The button is off");
        
    }
    

}

Credits

Maria Tapia

Maria Tapia

2 projects • 0 followers

Comments

Add projectSign up / Login