The light sensor or Light Dependent Resistor (LDR) (PGM5506) is used to measure intensity of light.

When light falls on the sensor, the resistance of the LDR changes.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/163578ec-332d-4eb6-8827-95ad9852f240/Sensor_LDR.png

Examples:

  1. Automatic Light- LDR based: sensor measures natural light in the room to switch the light on/off accordingly.
  2. Alarm clock: sensor measures sunlight entering in the room to sound morning alarm.
  3. Night-light for elderly people: sensor measure when there is less light in the room to turn on a night light for elderly people who cannot switch it on manually.

Units:

Pin:

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d82aae49-dfcf-49aa-bb4f-747ac7143539/Input_Light_Sensor-01.jpg

Code