Project tutorial
Light control with clock

Light control with clock © MIT

Control your home lights when it's ON or OFF using 1Sheeld.

  • 2,947 views
  • 0 comments
  • 17 respects

Components and supplies

About this project

You can turn on and/or off all the lights in your home using 1Sheeld.

Code

Untitled fileArduino
/*

Clock Shield Example

This example shows an application on 1Sheeld's clock shield.

By using this example, you can send an SMS to a friend on his
birthday and update your status on Facebook when the phone's
time reaches a certain time you specify.

OPTIONAL:
To reduce the library compiled size and limit its memory usage, you
can specify which shields you want to include in your sketch by
defining CUSTOM_SETTINGS and the shields respective INCLUDE_ define. 

*/

#define CUSTOM_SETTINGS
#define INCLUDE_CLOCK_SHIELD
#define INCLUDE_SMS_SHIELD
#define INCLUDE_FACEBOOK_SHIELD

/* Include 1Sheeld library. */
#include <OneSheeld.h>

/* Define some variables for the date and time. */
int hour, minute, second, day, month, year;
int relayPin = 13;

void setup()
{
  /* Start communication. */
  OneSheeld.begin();
  /* Start the clock shield. */
  Clock.queryDateAndTime();
  pinMode(relayPin,OUTPUT);
  digitalWrite(relayPin,LOW);
}

void loop() 
{
  /* Always get the date and time. */
  hour = Clock.getHours();
  minute = Clock.getMinutes();
  second = Clock.getSeconds();
  day = Clock.getDay();
  month = Clock.getMonth();
  year = Clock.getYear();
  
  /* If the date is my friends's birthday date send me 
     SMS at 3 pm that day and post on Facebook. */
  if(hour == 18 && minute == 18 && second == 30 && day == 10 && month == 9 && year == 2015)
  {
    digitalWrite(relayPin,HIGH);
  }
} 
Light control with clock Code
Change the time in this line of code if(hour == 18 && minute == 18 && second == 30 && day == 10 && month == 9 && year == 2015) you can make multiple if conditions for trigger events also you can have more than "relaypin"

Schematics

Light control with clock Circuit
you only need one relay for each lamp.
Clock%20shield%20with%20lamp bb

Comments

Similar projects you might like

Control your light system with your voice

Project tutorial by Maha Raafat

  • 33,110 views
  • 22 comments
  • 147 respects

Controlling LED light intensity using smartphone light senso

Project tutorial by Nikola Travis

  • 2,461 views
  • 0 comments
  • 3 respects

Control your Light System Using Smart Phone

Project tutorial by Ahmed Yassin

  • 35,264 views
  • 4 comments
  • 55 respects

How to control your light switch from your smartphone?

Project in progress by Mahmoud Ahmed

  • 22,609 views
  • 3 comments
  • 15 respects

Universal Remote Control

Project tutorial by Ashraf Nabil

  • 3,305 views
  • 0 comments
  • 12 respects

Control a RGB Led using Arduino and a smartphone's camera

Project tutorial by Mr robot Maker

  • 2,982 views
  • 0 comments
  • 8 respects
Add projectSign up / Login