hey there!, in this post i will show you how to control led using ldr & arduino UNO
Component required
Arduino Uno
LED
LDR (photoresistor)
220 and 10k ohm resistors
Wires
Breadboard
![](https://static.wixstatic.com/media/8fedc5_74e9bb5d0543404295f6b595ee2f2dd5~mv2.jpg/v1/fill/w_980,h_658,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/8fedc5_74e9bb5d0543404295f6b595ee2f2dd5~mv2.jpg)
![](https://static.wixstatic.com/media/8fedc5_0b1f0e0c75c54947af1c5b18025a22cd~mv2.jpg/v1/fill/w_342,h_342,al_c,q_80,enc_auto/8fedc5_0b1f0e0c75c54947af1c5b18025a22cd~mv2.jpg)
![](https://static.wixstatic.com/media/8fedc5_d294a23cb4104b1d9ab20286d4986ad0~mv2.jpg/v1/fill/w_400,h_126,al_c,q_80,enc_auto/8fedc5_d294a23cb4104b1d9ab20286d4986ad0~mv2.jpg)
![](https://static.wixstatic.com/media/8fedc5_b8152ed527bd4c01b6c92d3012292de4~mv2.jpg/v1/fill/w_225,h_225,al_c,q_80,enc_auto/8fedc5_b8152ed527bd4c01b6c92d3012292de4~mv2.jpg)
Connection diagram of LED, LDR, & ARDUINO UNO:
![](https://static.wixstatic.com/media/8fedc5_97cb67b3a6e946b5817771b7308e35c7~mv2.jpg/v1/fill/w_980,h_535,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/8fedc5_97cb67b3a6e946b5817771b7308e35c7~mv2.jpg)
Upload the code to arduino:
const int ledPin = 13;
const int ldrPin = A0;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(ldrPin, INPUT);
}
void loop() {
int ldrStatus = analogRead(ldrPin);
if (ldr Status <=300) {
digitalWrite(ledPin, HIGH);
Serial.println("LDR is DARK, LED is ON");
}
else {
digitalWrite(ledPin, LOW);
Serial.println("---------------");
}
}
Result:
![](https://static.wixstatic.com/media/8fedc5_6f4efd386e784bba99f3a8684b08ae56~mv2.jpg/v1/fill/w_980,h_563,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/8fedc5_6f4efd386e784bba99f3a8684b08ae56~mv2.jpg)
![](https://static.wixstatic.com/media/8fedc5_5f91e2ed6318402aa7f178a8700827dc~mv2.jpg/v1/fill/w_980,h_569,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/8fedc5_5f91e2ed6318402aa7f178a8700827dc~mv2.jpg)
Comments