Automatic lighting system with Arduino


How to create a automatic lighting system with Arduino



Contents:-


1. Arduino Uno
2.LCD display 16*2
3. PIR motion sensor
4. 5V Relay
5. lithium ion battrery or any battery whuch give 5v
6.In place of battery you can also use 12v adapter,which i had used in this project 
    

Connections:-

1. See from the code


Working Mechanism:-

Fit this box on the wall at height of 6 ft approx 
when someone enters the door PIR value becomes HIGH and the condition becomes true which signals the arduino to turn the relay to LOW which makes the light on.




Code to upload:-


const int ledPin = 13;

int RELAY = 8;

int PIR=9; // output of pir sensor

#include <LiquidCrystal.h> // includes the LiquidCrystal Library 

LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // Creates an LC object. Parameters: (rs, enable, d4, d5, d6, d7) 

void setup() {

Serial.begin(9600);
pinMode(RELAY, OUTPUT);
pinMode(PIR, INPUT);// setting pir output as arduino input
pinMode(ledPin, OUTPUT);
lcd.begin(16,2); // Initializes the interface to the LCD screen, and specifies the dimensions (width and height) of the display } 

}

void loop() {

int PIRstatus = digitalRead(PIR);
Serial.println("PIRstatus =");
Serial.println(PIRstatus);
if (PIRstatus== HIGH) {

digitalWrite(ledPin, HIGH);
digitalWrite(RELAY, LOW);
Serial.println("Motion dectated,LIGHT is ON");
lcd.print("Motion Detected"); // Prints "Arduino" on the LCD 
lcd.setCursor(0,1);
lcd.print("Light is ON");
delay(900);
 lcd.clear();


}

else {

digitalWrite(ledPin, LOW);
digitalWrite(RELAY,HIGH);
Serial.println("NO one is there!,LIGHT is OFF");
lcd.print("No Motion Detectated"); // Prints "Arduino" on the LCD 
lcd.setCursor(0,1);
lcd.print("ated Lights OFF");
delay(900);
 lcd.clear();
  
}

}

See the vedio:-




Comments

  1. Thank you for giving a valuable input on lighting system. Using latest high bay led lights; we can improve our lifestyle and save energy.

    ReplyDelete

Post a Comment

Popular posts from this blog

Arduino:How to program an arduino using loop statements

Automatic Door Locking with Arduino

Arduino:How to make a RC car with arduino