# Light Dependent Resistor (LDR)

**Type:** Product page · **SKU:** CE09439 · **Brand:** [Core Electronics](https://core-electronics.com.au/brands/core-electronics-australia)
**Page:** https://core-electronics.com.au/light-dependent-resistor-ldr.html ([markdown](https://core-electronics.com.au/light-dependent-resistor-ldr.html.md))

Easily measure light levels with a a photoresistor!

## Pricing

- **Price:** $0.35 (inc GST) — $0.32 AUD, exc GST
- **Quantity discounts:** 5+ $0.31 (exc GST) · 15+ $0.30 (exc GST)

## Availability & dispatch

- In stock, ships same business day if ordered before 2PM (Australia/Sydney).
- We can dispatch 259 today; more stock is typically available with a 8–12 day lead time.

## Description

This sensor changes its resistance based on the light exposure on the top face.

### How to use this sensor

- Use a resistor to create a voltage divider
- Measure the change in resistance by measuring the voltage in the middle
 
### Specifications

- Resistance @ 10 Lux = 10-20k ohms

### Examples

#### Raspberry Pi Pico - Micropython

 ```
import machine
import utime

# NOTE: REQUIRES 10K RESISTOR

ldr = machine.ADC(27)

# A handy function for mapping values
def map_range(x, in_min, in_max, out_min, out_max):
    mapped = (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
    return int(max(min(mapped, out_max), out_min))

while True:
    ldr_raw_reading = ldr.read_u16()
#     print(ldr_raw_reading)

    ldr_filtered_reading = map_range(ldr_raw_reading, 2000, 50000, 0, 100)
    print(ldr_filtered_reading)
    utime.sleep(0.5)
```

## Images

- [Product image 1](https://core-electronics.com.au/media/catalog/product/l/d/ldr.jpg)
