{"context":{"embeds":{"length":0},"plugins":{"length":0},"scripts":{"0":{},"1":{},"2":{},"3":{},"4":{},"5":{},"6":{},"7":{},"8":{},"9":{},"10":{},"11":{},"12":{},"13":{},"14":{},"15":{},"16":{},"17":{},"18":{},"19":{},"20":{},"21":{},"22":{},"23":{},"24":{},"25":{},"26":{},"27":{},"28":{},"29":{},"30":{},"31":{},"32":{},"33":{},"34":{},"35":{},"36":{},"37":{},"38":{},"39":{},"40":{},"41":{},"42":{},"43":{},"44":{},"45":{},"46":{},"47":{},"48":{},"49":{},"50":{},"51":{},"52":{},"53":{},"54":{},"55":{},"56":{},"57":{},"58":{},"59":{},"60":{},"61":{},"62":{},"63":{},"64":{},"65":{},"66":{},"67":{},"68":{},"69":{},"70":{},"71":{},"72":{},"73":{},"74":{},"75":{},"76":{},"77":{},"78":{},"79":{},"80":{},"81":{},"82":{},"83":{},"84":{},"85":{},"86":{},"87":{},"88":{},"89":{},"90":{},"91":{},"92":{},"93":{},"94":{},"95":{},"96":{},"97":{},"98":{},"99":{},"100":{},"101":{},"102":{},"103":{},"104":{},"105":{},"106":{},"107":{},"108":{},"109":{},"length":110},"width":1264,"height":1702,"dir":"","designMode":"off","compatMode":"CSS1Compat","bgColor":"","fgColor":"","alinkColor":"","linkColor":"","vlinkColor":"","location":{"href":"https://www.instructables.com/editInstructable/publish/E1IXN4OIMDZSVAU","protocol":"http:","host":"www.instructables.com","hostname":"www.instructables.com","port":"","pathname":"/editInstructable/publish/E1IXN4OIMDZSVAU","search":"","hash":""},"jQuery110205577271075453609":1,"gtmHasClickListenerTag":true,"gtmHasLinkClickListenerTag":true,"gtmLinkClickListener":true,"b":{"sizzle-1459309977295":{"parentNode":["36575 283",60]}},"h":{}},"selector":"#editor-Object-408"}

Step 1: Materials Required

Step 2: ​Working Principle:

Light Dependant resistors as its name suggests is simply a resistor. However, there’s a catch. The LDR’s resistance changes with light. Yes, you heard it right… As the intensity of the light falling on the HEAD (the round upper part with wiggly structure) increases, the resistance of the LDR decreases. At absoulute darkness the value of resistance is very high. If you are interested, the LDRs are generally made of Cadmium Sulphide. [Who cares?]

The LDR is a passive component. But, we want voltage.[Hmm. How could we do that?] Remember, what you learnt in school. A Voltage Divider Circuit.

Step 3: Schematics and Circuit:

I know that you are smart enough to understand the above schematics. I assume some of you have even started wiring [That’s the spirit guys!!]. Anyways for some of you, here’s the text verison of the circuit:

One of the terminals of the LDR is connected to the +5V supply from the Arduino. Then the other terminal is connected to the Resistor R1. The other end of R1 is connected to the ground. From the point where the two terminals of LDR and R1 are connected; connect a wire to the Analog Input Pin 5 of Arduino (A5). Thats it on the hardware. Please note in the circuit that, the input to Arduino is an analog input measuring the value of voltage across R1.

Step 4: The Code:

he code for this project is simple and easy. Basically, we just read the analog input from the pin A5. Then we compare the value with certain threshold. If the value is below threshold, i.e. it is dark then we turn on the LED at pin 13 else we turn it off. The code can be downloaded off Github at:


Ok, that should suffice your quest for learning on interfacing LDRs with Arduino.
Coming Next : Interfacing with Ultrasonic Sensor – HCSR04

<p>Thanks for sharing!</p>

About This Instructable




More by mks2064:Working With Sensors : Working With LDR 
Add instructable to: