LDR WITH ARDUINO
COMPONENTS REQUIRED:-
1. LDR:-
2. Arduino Uno:-
3. 1-Channel Relay Module:-
4. 10K resistor:-
About components
LDR:- It is Light Dependent Resistor, which means whose resistivity depends upon the amount of incident light. If the amount of light incident is HIGH, then resistance across the terminals will be LOW and if intensity of light falling on LDR is LOW, then resistance across terminals will be HIGH.
In summary:-
Resistance across terminals of LDR is inversely
proportional to Light intensity falling on it.
1-Channel Relay Module:-
Whenever we have to turn ON/OFF any electrical appliance by electronical circuits, we have to use a Relay module over there.
Pinouts:-
1. VCC- here we have to connect +5 Volts
2.GND- here we have to connect GND of Arduino
3. IN- here we have to give logic signal, if logic 1 is provided, relay will switch ON, if logic 0 is provided , relay will switch OFF.
4.NO- NO means normally open. Here we have to connect 1 terminal of or electronic device like fan, bulb, TV, etc.
5.COM- COM means Common. Here we have to connect 1 terminal of AC supply.
LDR INTERFACING WITH ARDUINO
1.One terminal of LDR is connected to a 5v pin of Arduino.
2.The other terminal of the LDR is connected to the A0 pin
3.Also attach a register of 10K with one terminal connected
4.Then connect a relay module in which VCC and GND pin are connected with a battery and GND pin of relay module and Arduino are grounded with each other.
5.Then connect IN pin of relay module with the 13th pin of Arduino
6.Then connect one terminal of AC supply to the COM(common) pin of the relay module and the other pin to the device’s(bulb, fan, etc.) one end.
7.The other terminal of the device to be connected to the NO(normally open) pin of relay module.
int daylight=0;
void setup()
{
pinMode(A0,INPUT);
pinMode(13,OUTPUT);
Serial.begin(9600);
}
void loop()
{
daylight=analogRead(A0);
if(daylight<300)
{
Serial.println("It's night outside.So lights are turned on ");
digitalWrite(13,HIGH);
}
else
{
Serial.println("It's day outside.So lights are turned off");
digitalWrite(13,LOW);
}
}
_____________________________________________________
To understand this project more in detail, then CLICK HERE or on this image to watch my tutorial
Comments
Post a Comment