mohammadsohail0008
Published © GPL3+

Automatic Night Lamp

Night lamp using LDR

BeginnerFull instructions provided44
Automatic Night Lamp

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
Relay Module (Generic)
×1
LDR, 5 Mohm
LDR, 5 Mohm
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Jumper wires (generic)
Jumper wires (generic)
×1
12v led light
×1
12v adapter
×1
5V 2.5A Switching Power Supply
Digilent 5V 2.5A Switching Power Supply
×1
Ply Board sticks
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Circuit Diagram

Code

Code

Arduino
// https://www.youtube.com/channel/UCaXI2PcsTlH5g0et67kdD6g  //
// Automatic NightLamp //
// By MOHD SOHAIL //

const int relayPin = 13;  
const int ldrPin = A0;  


void setup() {

  Serial.begin(9600);
  pinMode(relayPin, OUTPUT); 
  pinMode(ldrPin, INPUT);   
}

void loop() {

  int ldrStatus = analogRead(ldrPin);  
  

   if (ldrStatus <=400) {

    digitalWrite(relayPin, LOW);               
    Serial.println("LDR is DARK, LED is ON");
    
   }
  else {

    digitalWrite(relayPin, HIGH);         
    Serial.println("---------------");
  }
}

Credits

mohammadsohail0008

mohammadsohail0008

0 projects • 2 followers

Comments

Add projectSign up / Login