Interfacing Light Dependent Resistor (LDR) and LED, displaying automatic night lamp.
List of the items to be required.
- Arduino Uno.
- Relay Module.
- LDR.
- 12 V led light.
- Resistors pack.
- 12v adapter.
- 5V adapter for Arduino.
The following three purposes are performed by a nightlight:
- Lighting: All lights have the ability to provide illumination. A night light often features strong and weak gears as well as opening and closing gears that allow users to control the brightness. A night light's gentle lighting makes it convenient for mothers to breastfeed their children at night, and many individuals select it to dispel darkness and promote better sleep.
- Decoration: A gorgeous night light can be chosen to beautify a room because they come in a variety of shapes and colors.
- Gather components like Arduino, relay module, LDR, 10 K ohm resistor, 12 V led light, adapter, wooden sticks to make lamp.
- First of all make a night lamp using ply board sticks as shown in video.
- Take a rectangular ply board and make a stand of the night lamp.
- Place Arduino and relay module inside the stand of lamp.
- Upload the below given code in the Arduino.
- Connect 12 V led light and do connections from the circuit diagram.
- Now stand is completed.
Code:-
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("---------------");
}
}
For Videos Join Our Youtube Channel: Join Now
Tags:
b2acypher
b2adigitals
displaying automatic night lamp
Interfacing Light Dependent Resistor (LDR) and LED
mskuthar
Project to create night lamp