Circuit Documentation
Summary
This circuit is designed to read the light intensity using an LDR (Light Dependent Resistor) module and control an LED based on the light intensity. The circuit uses an Arduino UNO microcontroller to read the analog value from the LDR module and turn the LED on or off depending on the light intensity.
Component List
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0, +, -
LDR Module 3 pin
- Description: A module with a Light Dependent Resistor to measure light intensity.
- Pins: VCC, GND, DO
Resistor
- Description: A 220 Ohm resistor.
- Pins: pin1, pin2
- Properties:
- Resistance: 220 Ohms
LED: Two Pin (red)
- Description: A red LED with two pins.
- Pins: cathode, anode
Wiring Details
Arduino UNO
- GND is connected to the cathode of the LED.
- D13 is connected to pin2 of the Resistor.
- 5V is connected to VCC of the LDR Module.
- GND is connected to GND of the LDR Module.
- A0 is connected to DO of the LDR Module.
LDR Module 3 pin
- VCC is connected to 5V of the Arduino UNO.
- GND is connected to GND of the Arduino UNO.
- DO is connected to A0 of the Arduino UNO.
Resistor
- pin1 is connected to the anode of the LED.
- pin2 is connected to D13 of the Arduino UNO.
LED: Two Pin (red)
- cathode is connected to GND of the Arduino UNO.
- anode is connected to pin1 of the Resistor.
Code Documentation
Arduino UNO Code
void setup() {
// put your setup code here, to run once:
pinMode(A0, INPUT);
pinMode(13, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int ldr = analogRead(A0);
Serial.println(ldr);
if (ldr < 500) {
digitalWrite(13, HIGH);
} else {
digitalWrite(13, LOW);
}
delay(300);
}
LDR Module 3 pin Code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
This documentation provides a comprehensive overview of the circuit, including a summary, detailed component list, wiring details, and the code used in the microcontrollers.
