Home / Wiki / Sensor / Light
Photoresistance sensor module


Photoresistance sensor module is consists of a photoresistance, a variable resistance and a LM393. This module has four pins, two pins are used to connect the power and ground, the others are digital output and analog output. photoresistance has a feature that resistance’s value is getting lower and lower when it has been lighting by the higher light intensity. The LM393 is used to compare the threshold value and the value come from sensor then output logic high(low) if the value is higher than threshold (lower than threshold), as you can see, the LM393 is used to get the digital output. Variable resistance is used to change the threshold value.


Technical data

Working voltage: 3.3 to 5V

Analog output and digital output

Adjustable sensitivity

Provided with a fixed bolt hole, convenient to install


Good wave shape


Type of output: digital output

LM393 for comparing voltage


When photoresistance sensor module haven’t been lighted by external environment or intensity of light is lower than threshold, digital output pin will output high power,

When module is not up to the threshold in the condition without light or light intensity, the output port DO high level, when the external environment light intensity exceeds a set threshold, the module D0 output low level

Small digital output D0 with the microcontroller is connected directly, through the microcontroller to detect low level, thereby to detect environmental intensity change

Small digital output DO can directly drive the relay module, which can be composed of a photoelectric switch

Small analog output AO and our AD module, through the AD conversion, it can obtain more accurate numerical value of environmental light intensity



#define sensor A5         //define analog pin A5 as sensor

void setup() {

  // put your setup code here, to run once:

Serial.begin(9600);       //begin the serial Monitor at the Baud rate 9600



void loop() {

  // put your main code here, to run repeatedly:

int value= analogRead(sensor);  //read analog pin's value.

Serial.println(value, DEC);    //display the value.

delay(500);                     //delay 500 ms