Luminosity Sensor Variable Module(SEN040130)
The Luminosity Sensor Variable Module (SEN040130) is designed to measure the intensity of light in its environment. This sensor module is often used in projects where light levels need to be monitored or controlled, such as in automatic lighting systems, grow lights for plants, or any application where changes in light conditions need to be detected.
Specifications
- Operating Voltage: 3.3V ~ 5V
- Output Type: DO, AO
- Detection Angle: 160 degrees
Connection
The circuit utilized in the example code below.
An LED can be replaced with another module or omitted entirely.
Resistor | Luminosity Sensor | LED | Arduino | |||
VCC | 5V | |||||
GND | - | GND | ||||
Connection | + | |||||
AO | A0 | |||||
Connection | D7 |
Example Code
// Code to turn on the LED when the luminosity sensor value exceeds 470.
#define led 7
#define cds A0
float val = 0;
void setup(){
pinMode(led, OUTPUT);
digitalWrite(led, LOW);
}
void loop(){
val = analogRead(cds);
if(val > 470) digitalWrite(led, HIGH);
else digitalWrite(led, LOW);
}