DFRobot_Ambient_Light_Sensor_SKU_DFR0026-DFRobot

Analog Ambient Light Sensor For Arduino

Introduction

Here comes DFRobot's new Analog Ambient Light Sensor! The brand new design is much more convenient to use.This module can help you to detect the light density of your enviroment and reflect this information back via an analog voltage signal to your Arduino controller. You can set the threshold of voltage level to trigger another aspect of your project. This sensor can be applied in any project where light density is involved! For example, you can use this sensor to automatically adjust the lights in your house depending on the suns intensity.

Specification

Application

PinOut

Color Pin
GREEN S
RED VCC
BLACK GND

Tutorial

Connection Diagram

Arduino Sensor
A0 GREEN
5V RED
GND GRAY

Sample Code

For Arduino

void setup()
{
  Serial.begin(9600); // open serial port, set the baud rate to 9600 bps
}
void loop()
{
      int val;
      val=analogRead(0);   //connect grayscale sensor to Analog 0
      Serial.println(val,DEC);//print the value to serial
      delay(100);
}

For MicroPython

from machine import ADC
import time

adc0=ADC(0)

while True:
  print("adc0=",adc0.read())
  time.sleep(0.1)

Result

Open the serial port monitor, set the baud rate according to the program for 9600.The light intensity around the sensor is different, the received data is also different.The more light, the bigger the data.

FAQ

Q&A Some general Arduino Problems/FAQ/Tips
Q The unit of the output from these sensors is? How can I convert it to LUX?
A Well, it is only a simple analog sensor that could show you the relationship of the light intensity (within its detect range) and voltage (0-5V). If you want to transfer the voltage to unit in LUX, then well, it requires that you have a commercial Light Intensity Meter like this that can display LUX info, then you can match the readings to the sensor's analog reading, then you could a map to describe the relationship of voltage and ambient light density.

For any question/advice/cool idea to share, please visit DFRobot Forum.

More Documents

DFshopping_car1.png Get Gravity: Analog Ambient Light Sensor For Arduino from DFRobot Store or DFRobot Distributor.

Turn to the Top