SMART SWITCHES

1. Touch switches to switch 'ON' and 'OFF' lights and fans of the room. 2. Bluetooth connectivity for android app.

Documentation

This project is a part of Smart Home Project, Click here to see overview and dependencies

Watch Video Here

Smart switches contains 6 switches which can be operated through touch.

Slide up  on the red indicator to switch  'ON'  and  Slide down  on it to switch ' OFF'.

Below is the Overview of the system :

Below is the image showing the switch board used :

​​​​​​

 

The casing used above is of the normal switch board casing with all the  indicators  installed.

The internal components of each indicator is replaced with  two IR detectorsone IR transmitter  and  one LED  as shown in the image above. 

The back of the switch panel is shown in below image with LM538 (op-amp) connected one for each switch :

 

The outputs of the op-amps are given as inputs to  Arduino Uno**  **micro-controller board used in the system.

The Code :-

#include 

SoftwareSerial mySerial(9, 10); // Pin 9 as RX and Pin 10 as TX

void setup() {
 mySerial.begin(9600); // Setting the baud rate of GSM Module  
 Serial.begin(9600); // Setting the baud rate of Serial Monitor (Arduino)
 pinMode ( 2, INPUT);
 pinMode ( 3, INPUT);
 pinMode ( 4, INPUT);
 pinMode ( 5, INPUT);
 pinMode ( 6, INPUT);
 pinMode ( 7, INPUT);
 pinMode ( 8, INPUT);
 pinMode ( 11, INPUT); //Input mode for 4 IR switches
 pinMode ( A0, OUTPUT);
 pinMode ( A1, OUTPUT);
 pinMode ( A2, OUTPUT);
 pinMode ( A3, OUTPUT);
 pinMode ( A4, OUTPUT);
 pinMode ( A5, OUTPUT); // Output for 6 relays and LEDs

}
void loop() 
{
 if ( digitalRead(2)==HIGH)
{
  digitalWrite(A0, HIGH); // Switch 1 'ON' state
}
if ( digitalRead(3)==HIGH)
{
  digitalWrite(A0, LOW); // Switch 1 'OFF' state
}
if ( digitalRead(4)==HIGH)
{
  digitalWrite(A1, HIGH); //Switch 2 'ON' state
}
if ( digitalRead(5)==HIGH)
{
  digitalWrite(A1, LOW); //Switch 2 'OFF' state
}
if ( digitalRead(6)==HIGH)
{
  digitalWrite(A2, HIGH); //Switch 3 'ON' state
}
if ( digitalRead(7)==HIGH)
{
  digitalWrite(A2, LOW); //Switch 3 'OFF' state
}
if ( digitalRead(8)==HIGH)
{
  digitalWrite(A3, HIGH); //Switch 4 'ON' state
}
if ( digitalRead(11)==HIGH)
{
  digitalWrite(A3, LOW); //Switch 4 'OFF' state
}



 if (Serial.available()>0)  
 { char ch = Serial.read(); // Input from bluetooth module
   if(ch=='A')
   {
     digitalWrite(A0, HIGH); // switch 'ON' switch 1
   }
   if(ch=='a')
   {
     digitalWrite(A0, LOW); // switch 'OFF' switch 1
   }


    if(ch=='B')
   {
     digitalWrite(A1, HIGH); // switch 'ON' switch 2
   }
   if(ch=='b')
   {
     digitalWrite(A1, LOW); // switch 'OFF' switch 2
   }


    if(ch=='C')
   {
     digitalWrite(A2, HIGH); // switch 'ON' switch 3
   }
   if(ch=='c')
   {
     digitalWrite(A2, LOW); // switch 'OFF' switch 3
   }


    if(ch=='D')
   {
     digitalWrite(A3, HIGH); // switch 'ON' switch 4
   }
   if(ch=='d')
   {
     digitalWrite(A3, LOW); // switch 'OFF' switch 4
   }


    if(ch=='E')
   {
     digitalWrite(A4, HIGH); // switch 'ON' switch 5
   }
   if(ch=='e')
   {
     digitalWrite(A4, LOW); // switch 'OFF' switch 5
   }


    if(ch=='F')
   {
     digitalWrite(A5, HIGH); // switch 'ON' switch 6
   }
   if(ch=='f')
   {
     digitalWrite(A5, LOW); // switch 'OFF' switch 6
   }


     if(ch=='G')
   {
     mySerial.write('G'); // send a signal to window/curtain controller to open Window
   }
   if(ch=='g')
   {
    mySerial.write('g'); // send a signal to window/curtain controller to close Window
   }


    if(ch=='H')
   {
     mySerial.write('H'); // send a signal to window/curtain controller to open curtain
   }
   if(ch =='h')
   {
    mySerial.write('h'); // send a signal to window/curtain controller to close curtain
   }
 }


 if (mySerial.available()>0)
 {
 if(mySerial.read()=='Z') // receive a signal from door controller through window/curtain controller to switch 'OFF' all the lights
 {
 digitalWrite(A0, LOW);
 digitalWrite(A1, LOW);
 digitalWrite(A2, LOW);
 digitalWrite(A3, LOW);
 digitalWrite(A4, LOW);
 digitalWrite(A5, LOW); // switch all the switches 'OFF'
 }
 }

}
Info

Project State

Public Project

Licences

Project Tags

Admins

Himanshu_S

Members

Does this project pique your interest?

Login or register to join or follow this project.

Comments
Back to top

Your comments, please!

Want to comment this ... Show more