Light Unit with Photo-resistance

via M5Stack
$4.46
SKU M5-U021
Description

LIGHT is a light intensity sensor unit with an adjustable photoresistor。

A photoresistor is a light-controlled variable resistor. The resistance of a photoresistor decreases with increasing incident light intensity, and vice versa. It exhibits photoconductivity which make it possiable to detect the varies based on Voltage, and use a AD to convert the digital data.

We add some extra work to strengthen the circult, a Dual Differential Comparators LM393, compares the differntial voltage between the photoresistor and the varistor. It could offer larger and accuracy range of light intensity.

Product Features

  • 10K adjustable resistor
  • Software Development Platform: Arduino, UIFlow(Blocky,Python)
  • Two Lego-compatible holes

Kit includes

  • 1x LIGHT Unit
  • 1x Grove Cable
Learn

Example

1. Arduino IDE

The code below is incomplete. To complete code, please click here.

#include <M5Stack.h>

// declaration
uint16_t analogRead_value = 0;
uint16_t digitalRead_value = 0;

// initialization
M5.begin();
dacWrite(25, 0);// disable the speak noise
pinMode(26, INPUT);// LIGHT Pin setting

// read data
analogRead_value = analogRead(36);// read analog value of LIGHT
digitalRead_value = digitalRead(26);

2. UIFlow

To get complete code, please click here.

More information

Schematic

PinMap

M5Core(GROVE B) GPIO36 GPIO26 5V GND
LIGHT Unit AnalogSignal Pin DigitalSignal Pin 5V GND