2. Light Sensor

pic_70

2.1. Introduction

The Light sensor use one photoresistor to detect the luminance of environment. The darker of the environment, the lower voltage will be provided.

2.2. The principle

The Light sensor also call as Light Dependent Resistor(LDR), the physical property will change under different light source as the name implied.

auto_fit

Depend on the model of different LDR, the resistance value and curves have difference, but all follow the principle:
When the Illumination is increase, the resistance of the resistor will reduce.
When the Illumination is decrease, the resistance of resistor will increase.

2.3. Specification

  • Supply Voltage: 3.3V to 5V

  • Interface: Analog

  • Output Voltage Range: 1%~90% of supply Voltage

  • Reading in the PXT(with Micro:bit): 1~100(0.04V~3.3V)

2.4. Pinout Diagram

Pin Function
G Ground
V Voltage Supply
S Signal Output(Analog)

2.5. Outlook and Dimension

pic_60

Size: 25mm X 25mm

2.6. Quick to Start/Sample

  • Connect the sensor to development board (direct plugin or using wire) auto_fit

  • Open Makecode, using the https://github.com/smarthon/pxt-smartcity PXT

    auto_fit

  • Initial the OLED and show the reading of Voltage Output auto_fit

The value will in range 0 to 100

2.7. Result

The reading of the luminance will show according to the environment. pic_60

2.8. FAQ

Q: Why the reading mostly stays in the middle range?
A: Generally, using in a in-door environment (with electric light source) will have a middle range value.
The close to limit value will only appear in the extreme cases, like under the sun/ close to light bulb, or stay in a full dark environment.