Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Maria Tapia
Published

Lane Tech HS- Home Automation with a Speaker

Have a sibling that always wakes up late? Have the speaker automatically turn on at a certain time, and play some tunes.

BeginnerFull instructions provided3 hours131
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

Wiring

Code

Servo Home Automation

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

// Change the pins below to match your Argon set up
#define IN1 2
#define IN2 3
#define IN3 5
#define IN4 6

Stepper myStepper(500, IN1, IN3 , IN2, IN4);
//Set up for servo is created 
Servo myservo;
char auth[] = "SHp26VYNHYH56OY2VBF_fU9JafXIbp-W";
int led = D7;
bool test = true;
int hour= 6;
int minute= 24;
int second = 1;

void setup() {
    Blynk.begin(auth);
    pinMode(led,OUTPUT);
    myservo.attach(D4);
    Time.zone(-5);
   //setting motor speed 
    myStepper.setSpeed(18);
}

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
    

    //the statement that willl trigger the servo  (can be done manually or automatically at specified time)
    if (Time.hour() == hour && Time.minute() == minute && Time.second() == second  ) // && 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);
        
        Serial.println("The servo was triggered");
        
    }
    
    if (Time.hour() == hour && Time.minute() == minute+1  )
        {
       
            myStepper.step(18);
        
            test = false;
        }
        
    if (Time.hour() == hour && Time.minute() ==minute +2  && test== false)
    {
        myservo.write(3);
        myStepper.step(-(13));
    }
    
    if (digitalRead(led) == LOW)
    {
        Serial.println("The button is off");
        
    }
    

}

Credits

Maria Tapia
2 projects • 1 follower
Contact

Comments

Please log in or sign up to comment.