AUTOMATIC DOOR LIGHTNING SYSTEM
by ramkumar__2003 in Circuits > Arduino
221 Views, 1 Favorites, 0 Comments
AUTOMATIC DOOR LIGHTNING SYSTEM
In this project,We will set up an automatic lighting system using arduino, so the ideas came when I tried to build automatic lighting system using arduino and PIR motion sensor but I confronted big issue because the light turn ON even if daytime,this is why I thought to use LDR in order to solve this issue.The main purpose of this project is to prevent loss of current unnecessarily during day time and make the system more efficient then before.
arduino codings
#define LAMP 8 //
choose the pin for the RELAY
#define PIR 13 //
choose the input pin (for PIR sensor)
void setup()
{ Serial.begin(9600); pinMode(LAMP, OUTPUT);
// declare lamp as output pinMode(PIR,INPUT); // declare sensor as input } void loop() { int valeur_ldr = analogRead(A4); // read LDR value int valeur_pir = digitalRead(PIR); // read input value Serial.println(valeur_ldr); Serial.println(valeur_pir); if((300>valeur_ldr) && ( valeur_pir==HIGH) ){ digitalWrite(LAMP,1); // Turn ON the light delay(6000); } else { digitalWrite(LAMP,0); // Turn OFF the light } }