Product Introduction #
Light sensor is a sensor used to detect light intensity, which is used to measure the properties of light in various scenes.
Light sensor is the use of photosensitive resistance resistance will change with the change of light intensity characteristics, when the light shines on the photosensitive resistance, the resistance value is reduced; However, in low light or dark environment, the resistance value increases. By measuring the change of the resistance value, the intensity of the light can be determined.
Application reference: lighting control, photoelectric switch, solar tracking and other scenes that need to sense light.
Parameter Specification #
Parameters | Value/Description |
Operating voltage | 3.3V~5V |
Operating temperature | -10°C~+50°C |
Output signal | Analog signal |
Size | 3.16cm*2.38cm |
Wiring Diagram #
Note:Expansion board is attached to esp32 controller board.
Light Sensor | ESP32 |
VCC | 5V |
GND | GND |
Sign | Pin 32 |
Sample Code #
void setup(){
pinMode(32, INPUT);//Set pin 32 to input mode
Serial.begin(115200);//Set baud rate to 115200
}
void loop(){
Serial.println(analogRead(32));//Read the state of pin 32 and print it to the serial monitor
delay(1000);
}
Note: If you are using an Arduino board, then change the pin in the program to PIN A0, set the baud rate to 9600, and then connect the hardware pin to PIN A0 and upload the program.
Test Result #
After uploading the code to the controller board, open the serial port monitor of the Arduino IDE, set the baud rate to 115200, and switch to scroll mode.
When we block the light sensor to varying degrees, we will find that the greater the light intensity, the smaller the return value.
Related Resources #
Get One Now #
B2B Business: info@acebott.com
Official Website: ACEBOTT Photosensitive Sensor