Thursday, 30 January 2020

Clap controlled Home appliances project data

Code:-


int Bulb = 9;       // signal to drive relay
int soundsensor = 7;   // input from sound sensor

boolean state = false;

void setup()
{
  pinMode(Bulb, OUTPUT);
  pinMode(soundsensor, INPUT);
}

void loop()
{
  if (digitalRead(soundsensor) == LOW)
  { 
    delay(100);                     
    state = !state;               
    digitalWrite(Bulb, state);   
  }
}

Monday, 27 January 2020

Energy Saving Home Automation System Project

Circuit Diagram:-



Code:-


int PIR = 2;
int Bulb = 13;
int fan = 12;
int value = 0;

void setup()
{
pinMode(2,INPUT);
pinMode(13,OUTPUT);
pinMode(12,OUTPUT);
Serial.begin(9600);
}
void loop()
{
value=digitalRead(PIR);

if(value==HIGH)
{
digitalWrite(13,HIGH);
digitalWrite(12,HIGH);
delay(5000);
}
else
{digitalWrite(13,LOW);
digitalWrite(12,LOW);
}
}

Saturday, 25 January 2020

Smart Car Barrier System Project Data

Components

Arduino uno 
Ultrasonic sensor 
Servo SG90
Jumper Wires
9V Battery with connector
Cardboard
Paper clips



Circuit Diagram




Code

#include <Servo.h>   //servo library
Servo servo;     
int trigPin = 5;    
int echoPin = 6;   
int servoPin = 7;
long duration, dist, average;   
long aver[3];   //array for average


void setup() {       
    Serial.begin(9600);
    servo.attach(servoPin);  
    pinMode(trigPin, OUTPUT);  
    pinMode(echoPin, INPUT);  
    servo.write(0);         //close cap on power on
    delay(100);
    servo.detach(); 

void measure() {  
digitalWrite(trigPin, LOW);
delayMicroseconds(5);
digitalWrite(trigPin, HIGH);
delayMicroseconds(15);
digitalWrite(trigPin, LOW);
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);
dist = (duration/2) / 29.1;    //obtain distance
}
void loop() { 
  for (int i=0;i<=2;i++) {   //average distance
    measure();               
   aver[i]=dist;            
    delay(10);              //delay between measurements
  }
 dist=(aver[0]+aver[1]+aver[2])/3;    

if ( dist<50 ) {
//Change distance as per your need
 servo.attach(servoPin);
  delay(1);
 servo.write(0);  
 delay(3000);       
 servo.write(150);    
 delay(1000);
 servo.detach();      
}
Serial.print(dist);
}


Purchase Kit From Here:-

https://amzn.to/2FOTCao https://amzn.to/2QQH0Ws