# 📘 COMPONENT DATASHEET TEMPLATE *(Use this template to document any electronic component)* --- ## 🏷️ COMPONENT NAME: Light Sensor **Type:** **INPUT** / OUTPUT / ACTUATOR / SENSOR / OTHER --- ## 📸 PHOTO *(Insert your own pictures of the component — multiple angles recommended.)* ![image](https://hackmd.io/_uploads/rkYPE82xWl.png) --- ## 🧠 USEFUL INFO *(Explain the purpose and potential of the component.What does the component do, What can it detect, measure, or control. Strengths and limitations)* A photoresistor (also known as a light-dependent resistor, LDR, or photo-conductive cell) is a passive component that decreases resistance with respect to receiving luminosity (light) on the component’s sensitive surface. --- ## ⚙️ TECHNICAL INFO *(Summaries taken from the official datasheet.Operating voltage, Operating voltage, Operating voltage, )* ![image](https://hackmd.io/_uploads/SyxOGVInlZl.png) - **Datasheet link:** - https://learn.adafruit.com/photocells - https://components101.com/resistors/ldr-datasheet --- ## 💻 CODE EXAMPLE *(Provide a minimal working code example for interacting with the component. Something that you already tested!)* ```cpp int sensorPin = A0; // Defines a variable to store the pin number to which the LDR is connected (A0 in this case). int sensorValue = 0; // Initializes a variable to store the LDR reading, starting at 0. void setup() { Serial.begin(115200); // Initializes the serial communication at a baud rate of 115200. } void loop() { sensorValue = analogRead(sensorPin); // Reads the analog value from the LDR connected to pin A0. Serial.println(sensorValue); // Prints the LDR reading to the serial monitor. delay(50); // Adds a 50-millisecond delay before the next reading to avoid overwhelming the serial monitor. } ``` The LDR will provide an analog voltage that varies with the intensity of light falling on it. The analogRead function reads this voltage and converts it to a digital value (0-1023 on most Arduino boards), which represents the intensity of light detected by the LDR. This value is then printed to the serial monitor, allowing you to see the LDR's response to changes in light conditions in real-time. ![image](https://hackmd.io/_uploads/BJNkSUhebe.png) You can use the Arduino IDE Serial plotter to see the changes in real time: --- ## 🔌 SCHEMATIC / DIAGRAMS *(Add wiring diagrams or electrical schematics.Component symbol. Breadboard diagram. Schematic diagram...)* ![image](https://hackmd.io/_uploads/B1ClrU3lbg.png) --- ## 📝 NOTES & OBSERVATIONS - Calibration notes - Issues encountered - Safety considerations - Recommendations for future use ---