Home automation using rtc and blutooth module.(using arduino)

HOME AUTOMATION VIA BLUETOOTH USING THE ARDUINO
UNO MICRO CONTROLLER
Home automation systems have gained popularity in recent years, paralleling the advances in the concept of the Internet of Things. The current project presents the implementation of an inexpensive home automation system, within the framework of assertive technology. The system implementation is based on the Arduino microcontroller, with Bluetooth communications capability, and it is designed for use by the elderly and people with disabilities. The system is user-friendly, with an intuitive interface implemented on an Android based smart phone. Demonstrations show that the system facilitates control of home appliances, lights, heating, cooling systems and security devices by the intended users.

Arduino
Arduino is open source physical processing which is based on a microcontroller board and an incorporated development environment for the board to be programmed. Arduino gains a few inputs, for example, switches or sensors and control a few multiple outputs, for example, lights, engine and others. Arduino program can run on Windows, Macintosh and Linux operating systems (OS) opposite to most microcontrollers’ frameworks which run only on Windows. Arduino programming is easy to learn and apply to beginners and amateurs. Arduino is an instrument used to build a better version of a computer which can control, interact and sense more than a normal desktop computer. It's an open-source physical processing stage focused around a straightforward microcontroller board, and an environment for composing programs for the board. Arduino can be utilized to create interactive items, taking inputs from a diverse collection of switches or sensors, and controlling an assortment of lights, engines, and other physical outputs. Arduino activities can be remaining solitary, or they can be associated with programs running on your machine (e.g. Flash, Processing and Maxmsp.) The board can be amassed by hand or bought preassembled; the open-source IDE can be downloaded free of charge. Focused around the Processing media programming environment, the Arduino programming language is an execution of Wiring, a comparative physical computing platform.
Image result for arduino
Bluetooth
Bluetooth Technology
Bluetooth is a standard utilized as a part of connections of radio of short extension, bound to substitute connections which use wires between electronic gadgets like personal digital assistants (PDA), cell phones, personal computers (PC), Laptops, and numerous different gadgets. Bluetooth technology can be utilized at homes, offices, schools, hospitals and in cars. Users can get instantaneous connections with several kinds of devices through this technology continuously. The method for transmission utilized guarantees security against external interference and well-being in sending out data. Between the essential qualities, these must be mentioned; the strength, low cost, small consume of energy low complexity and the ease of use. The Bluetooth is a little microchip that works in a band of accessible recurrence all through the world. Correspondences can acknowledge point to point and point to multipoint.
How Bluetooth work
Each gadget must have a microchip installed in it that receive and transmits the frequency of 2.4 GHz that is accessible throughout the whole world (with a few varieties of transmission Bandwidth in diverse nations). Other than the data, three channels of voice are accessible. The data can be traded to speeds of up to 1 megabit per second (2 megabits for second in the Second Generation of this Technology). A plan of "frequency hop" (hops of frequencies) permits to the gadgets to get connected comprehensive in territories where an incredible electromagnetic interference exists. Other than that is given plans of encryption and check.
What it is used for
Bluetooth remote innovation is designed into billions of devices, from cars and cell phones to medical gadgets and computers/Laptops and even headset and toothbrushes. Bluetooth innovation permits the user to impart voice, texts, music, pictures, and other data remotely between combined gadgets.
Its importance to create a home automation system
Bluetooth technology has been one of the critical innovations to home automation system or Smart Living. It is a remote technology created to take the place of wired devices to wireless one which links gadgets like cell phones and PCs (Laptops/desktops). Albeit "link substitution" could make a point-to-point connection, Bluetooth permits remote gadgets to have the ability to connect with one another inside reach. The system of a set of Bluetooth gadgets is called "piconet", which is anideal technology to system a brilliant advanced home.
Bluetooth Module

Arduino-Uno board doesn’t support Bluetooth connection on its own, which makes the idea of connecting it wirelessly to an Android device impossible. So a medium between the Arduino-Uno board and android device is needed and in this project it is a Bluetooth module specifically the HC-06 Bluetooth module. The HC-06 is a user friendly need only basic knowledge and it is programmable using the AT commands. It comes only in one fixed mode either master or slave. In this project the slave module was used.Image result for bluetooth module
Real Time Clock (RTC) Module
The DS1307 Serial Real-Time Clock is a low-power, full binary-coded decimal (BCD) clock/calendar plus 56 bytes of NV SRAM. Address and data are transferred serially via a 2-wire, bi-directional bus. The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. The end of the month date is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The clock operates in either the 24-hour or 12-hour format with AM/PM indicator. The DS1307 has a built-in power sense circuit that detects power failures and automatically switches to the battery supply
Before using RTC code you need to add RTClib.Image result for rtc ds1307
for rtc library
https://www.arduinolibraries.info/libraries/rt-clib







CODE FOR ARDUINO UNO
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;
void setup () {
  Serial.begin(9600);
  pinMode(9, OUTPUT); // put your setup code here, to run once:
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  Wire.begin();
  RTC.begin();
  //   lcd.begin(20, 4);
  pinMode(7, OUTPUT);
  //pinMode(6,OUTPUT);
  // following line sets the RTC to the date & time this sketch was compiled
  // RTC.adjust(DateTime(yyyy, mm,dd, h, m, s));
  RTC.adjust(DateTime(2017, 11, 1, 10, 38, 00));
void loop () {
 // while (1)
  //{
    DateTime now = RTC.now();
    Serial.print(now.day(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.year(), DEC);
    //if (now.hour()<10)
    Serial.print("  ");
    Serial.print("  ");
    Serial.print(now.hour(), DEC);
    // if (now.minute()<10)
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    //if (now.second()<10)
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();
    if ( /*( now.hour() == 12 ) && */( now.second() == 20 ) )
    {
      digitalWrite(7, HIGH);
    }
    else if ( now.second() == 30 )
    {
      digitalWrite(7, LOW);
    }
    /* if ( ( now.hour() == 12 ) && ( now.minute() > 20 )&& ( now.minute() <= 25 ) )
      {
        digitalWrite(6,HIGH);
        //lcd.setCursor(0, 3);
       //lcd.print("TM :12:20 LAMP IS ON");
      }
      else
      {
       digitalWrite(6,LOW);
       //lcd.setCursor(0, 3);
       //lcd.print("LAMP TM 12:20-12:25");
      }*/  // put your main code here, to run repeatedly:
    if (Serial.available() > 0)
    {
      char data = Serial.read(); // reading the data received from the bluetooth module
      switch (data)
      {
        case '0': digitalWrite(9, HIGH);
          break;
        case '1': digitalWrite(9, LOW);
          break;
        case '2': digitalWrite(10, HIGH);
          break;
        case '3': digitalWrite(10, LOW);
          break;
        case '4': digitalWrite(11, HIGH);
          break;
        case '5': digitalWrite(11, LOW);
          break;
        case '6': digitalWrite(12, HIGH);
          break;
        case '7': digitalWrite(12, LOW);
          break;
        case '8': digitalWrite(9, LOW);
          digitalWrite(10, LOW);
          digitalWrite(11, LOW);
          digitalWrite(12, LOW);
          break;
        case '9' : digitalWrite(9, HIGH);
          digitalWrite(10, HIGH);
          digitalWrite(11, HIGH);
          digitalWrite(12, HIGH);
          break;
      }
      Serial.println(data);
    }
   delay(1000);

  }

Comments