Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Based Light-Responsive LED Circuit

View and Edit Project In Cirkit DesignerImage of Arduino UNO Based Light-Responsive LED Circuit

Circuit Documentation

Summary of the Circuit

This circuit is designed to use an Arduino UNO to read the light intensity from a photocell (Light Dependent Resistor, LDR) and control an LED based on the light level. When the light level falls below a certain threshold, the LED is turned on, indicating low light conditions. The circuit includes a photocell, two resistors, and an LED. The Arduino UNO is programmed to read the analog value from the photocell and control the LED accordingly.

Component List

Arduino UNO

LED: Two Pin (red)

Resistor (200 Ohms)

Photocell (LDR)

Wiring Details

Arduino UNO

LED: Two Pin (red)

Resistor (200 Ohms)

Photocell (LDR)

Documented Code

// Code for Arduino UNO
int photocellPin = 0; // Analog pin A0
int ledPin = 2;       // Digital pin D2
int photocellReading;  // Variable to store the value from the photocell
const float limit = 100; // Threshold for turning the LED on

void setup() {
  Serial.begin(9600);  // Start serial communication at 9600 baud
  pinMode(ledPin, OUTPUT); // Set the LED pin as an output
}

void loop() {
  photocellReading = analogRead(photocellPin); // Read the value from the photocell
  Serial.print("Analog reading = ");
  Serial.println(photocellReading); // Print the reading to the serial monitor

  if (photocellReading < limit) {
    digitalWrite(ledPin, HIGH); // If the reading is below the limit, turn on the LED
  } else {
    digitalWrite(ledPin, LOW); // Otherwise, turn off the LED
  }
  delay(1000); // Wait for a second before reading again
}

This code is designed to be uploaded to the Arduino UNO microcontroller. It initializes the serial communication for debugging purposes and sets the LED pin as an output. In the main loop, it reads the analog value from the photocell and prints it to the serial monitor. Depending on the value read, it turns the LED on or off.