Simple LDR circuit
overview :
To understand the circuit and working of LDR (Light Dependent Resistor) with the help of arduino.
List of components :-
- Arduino UNO/nano
- LDR sensor
- Resister 100/220 ohm
- Breadboard
- Jumper wire ( male to male)
- Light source

Connection :
The working principle of an LDR is photoconductivity, that is nothing but an optical phenomenon. When the light is absorbed by the material then the conductivity of the material reduces. When the light falls on the LDR, then the electrons in the valence band of the material are eager to the conduction band.
In a market mostly we get a two type of LDR sensor fig is shown below

A breadboard is a rectangular plastic board with a bunch of tiny holes in it. These holes let you easily insert electronic components to prototype (meaning to build and test an early version of) an electronic circuit, like this one with a battery, switch, resistor, and an LED (light-emitting diode).

If we have a PCB LDR then
Vcc connected with 5v of Arduino and GND connected with GND.
Connect A0 with one of the analog pins. the connection is given below
Or if you have a two-pin LDR then the circuit given below

In which one terminal is connected with 5v and the other is connected with A0, the same pin is connected with resister via ground.
Add Your Heading Text Here
codding :
int sensorPin = A0; // select the input pin for LDR
int sensorValue = 0; // variable to store the value coming from the sensor
void setup() {
pinMode(sensorPin,INPUT);
Serial.begin(9600); //sets serial port for communication
}
void loop() {
sensorValue = analogRead(sensorPin); // read the value from the sensor
Serial.println(sensorValue); //prints the values coming from the sensor on the screen
delay(100);
}
you can copy past the cod given above

upload and working :
Check your COM port and upload the given above.
tool <port<com.
Once you are done with this focus light source on LDR and open serial monitor and you can see the resister value of LDR


