Project Name:- Automatic night lamp.
I am going to make automatic night lamp using Arduino. For this we need some hardware component named as below
This project is based on the LDR[light dependence resistor] sensor whose value is dependent on the light i.e its value is high during the night time and low during day time.
The voltage divider circuit is made in the analog input of arduino between LDR and 2.2k resistor provided 5v power supply.A voltage divider is a simple circuit which turns a large voltage into a smaller one. Using just two series resistors and an input voltage, we can create an output voltage that is a fraction of the input. Voltage dividers are one of the most fundamental circuits in electronics.
I am going to make automatic night lamp using Arduino. For this we need some hardware component named as below
- Arduino
- Computer
- Led
- LDR sensor
- Resister(2.2k)
- USB cable
This project is based on the LDR[light dependence resistor] sensor whose value is dependent on the light i.e its value is high during the night time and low during day time.
The voltage divider circuit is made in the analog input of arduino between LDR and 2.2k resistor provided 5v power supply.A voltage divider is a simple circuit which turns a large voltage into a smaller one. Using just two series resistors and an input voltage, we can create an output voltage that is a fraction of the input. Voltage dividers are one of the most fundamental circuits in electronics.
program coding
int led =13;
int ldr = A0;
void setup()
{ pinMode(led,OUTPUT);
pinMode(ldr,INPUT);
Serial.begin(9600);
}// to establish the serial communation between arduino and computer.
void loop()
{
int value = analogRead(ldr); // to read the analog value of the sensor
{
Serial.println(value);
// to print the serial value in serial monitor
if (value>500)
{
digitalWrite(led,HIGH);
}
else
{
digitalWrite(led,LOW);
}
}
}
during the day time the value of the LDR is low that means the value is less than 500 so the led is off but during the night time value of the sensor is high that means the value is greater than 500 so the led is turn on.
This is the sample of automatic night lamp.