SUSMIT RUDRA
Published © GPL3+

COVID-19 Ultimate Solution | TOUCHLESS Switch

The BEST Solution of COVID-19. Easily make your Contact Free Switch at home to reduce the spread of the Pandemic.

BeginnerFull instructions provided2 hours3,473
COVID-19 Ultimate Solution | TOUCHLESS Switch

Things used in this project

Story

Read more

Custom parts and enclosures

Compact Casing

Schematics

Relay Schematic

Code

Home Automation Code

Arduino
You can modify it according to your need.
/*CREARED BY- SUSMIT RUDRA
This is a very simple code used to collect required data from the app we will make and send it to the arduino.
Read the comments of each line very carefully to understand the concept.*/



#include<SoftwareSerial.h>
SoftwareSerial BT(10,11);    // CONNECT TX PIN OF HC05 TO PIN 10 OF ARDUINO and CONNECT RX PIN OF HC05 TO PIN 11 OF AEDUINO

String read_Data;

int relay1=4;              // Initialising the pin numbers with particular variable names for easy understanding
int relay2=5;
int relay3=6;
int relay4=7;

int val1=0;                // Initialising the variables to 0 value
int val2=0;
int val3=0;
int val4=0;


void setup() {    // put your setup code here, to run :
  
  BT.begin(9600);
  Serial.begin(9600);
  pinMode(relay1,OUTPUT);
  pinMode(relay2,OUTPUT);
  pinMode(relay3,OUTPUT);
  pinMode(relay4,OUTPUT);

  digitalWrite(relay1,HIGH);
  digitalWrite(relay2,HIGH);
  digitalWrite(relay3,HIGH);
  digitalWrite(relay4,HIGH);
  
  }

void loop() {
  // put your main code here, to run repeatedly:

while( BT.available())
{

delay(10);
char d=BT.read();
read_Data= read_Data+d;       // WE GET THE DATA RECEIVED FROM THE BLUETOOTH
}

if(read_Data.length()>0)
{
Serial.println(read_Data);       // WE DISPLAY THAT DATA IN OUR OUTPUT FOR MODIFICATIONS

if(read_Data=="RELAY1")
{
  val1=digitalRead(relay1);
  if(val1==0)
  {
    digitalWrite(relay1,HIGH);
    val1=1;
  }
  else
  {
    digitalWrite(relay1,LOW);
    val1=0;
  }
  delay(200);
}

if(read_Data=="RELAY2")
{
  val1=digitalRead(relay2);
  if(val2==0)
  {
    digitalWrite(relay2,HIGH);
    val2=1;
  }
  else
  {
    digitalWrite(relay2,LOW);
    val2=0;
  }
  delay(200);
}


if(read_Data=="RELAY 3")
{
  val1=digitalRead(relay3);
  if(val3==0)
  {
    digitalWrite(relay3,HIGH);
    val3=1;
  }
  else
  {
    digitalWrite(relay3,LOW);
    val3=0;
  }
  delay(200);
}


if(read_Data=="RELAY4")
{
  val1=digitalRead(relay4);
  if(val4==0)
  {
    digitalWrite(relay4,HIGH);
    val4=1;
  }
  else
  {
    digitalWrite(relay4,LOW);
    val4=0;
  }
  delay(200);
}

  read_Data="";

}
  
}

Credits

SUSMIT RUDRA

SUSMIT RUDRA

4 projects β€’ 18 followers
Currently pursuing ELECTRICAL ENGINEERING from Jadavpur University , India. Into the field of #Robotics and #Arduino.

Comments