Devices & Components
Arduino Uno Rev3
LDR, 5 Mohm
12v led light
5V 2.5A Switching Power Supply
Ply Board sticks
Relay Module (Generic)
12v adapter
Jumper wires (generic)
Resistor 10k ohm
Software & Tools
Arduino IDE
Project description
Code
Code
arduino
1// https://www.youtube.com/channel/UCaXI2PcsTlH5g0et67kdD6g // 2// Automatic NightLamp // 3// By MOHD SOHAIL // 4 5const int relayPin = 13; 6const int ldrPin = A0; 7 8 9void setup() { 10 11 Serial.begin(9600); 12 pinMode(relayPin, OUTPUT); 13 pinMode(ldrPin, INPUT); 14} 15 16void loop() { 17 18 int ldrStatus = analogRead(ldrPin); 19 20 21 if (ldrStatus <=400) { 22 23 digitalWrite(relayPin, LOW); 24 Serial.println("LDR is DARK, LED is ON"); 25 26 } 27 else { 28 29 digitalWrite(relayPin, HIGH); 30 Serial.println("---------------"); 31 } 32} 33
Downloadable files
Circuit Diagram
Circuit Diagram

Circuit Diagram
Circuit Diagram

Comments
Only logged in users can leave comments