Light Sensor (SKU:SEN0097)

From DFRobot Electronic Product Wiki and Tutorial: Arduino and Robot Wiki-DFRobot.com

Introduction

This is a BH1750 light intensity sensor breakout board with a 16 bit AD converter built-in which can directly output a digital signal, there is no need for complicated calculations. This is a more accurate and easier to use version of the simple foto resistor which only outputs a voltage that needs to be calculated in order to obtain meaningful data. With the BH1750 Light Sensor intensity can be directly measured by the luxmeter, without needing to make calculations. The data which is output by this sensor is directly output in Lux (Lx). When objects which are lighted in homogeneous get the 1 lx luminous flux in one square meter ,their light intensity is 1lx. Sometimes to take good advantage of the illuminant, you can add a reflector to the illuminant. So that there will be more luminous flux in some directions and it can increase the ilumination of the target surface.

For example:

Night: 0.001--0.02;
moonlightnight: 0.02--0.3;
cloudy indoor:5--50;
cloudy outdoor:50--500;
Sunny indoor:100--1000;
under the sunlight in summer afternoon: about 10*6 power;
reading books for intensity of illumination:50--60;
home video standard intensity of illumination:1400.

Specification

power supply voltage: +3 to 5Vdc
Interface: I2C
Wide range and High resolution. ( 1 - 65535 lx )
It is possible to select 2 types of I2C slave-address.
Small measurement variation (+/- 20%)
Size: 0.85*0.63*0.13"(21*16*3.3mm)

Wiring Diagram

Light Sensor Wiring diagram


Please note that the "add" Pin is to assign a different I2C address to the sensor. For our sample code this pin is not used. For more information about I2C protocol, go to Wikipedia I2C

Sample Code

/*
 Sample code for the BH1750 Light sensor
 Version 0.1
 website:www.DFRobot.com
 
 Connection:
 
 VCC-5v
 GND-GND
 SCL-SCL(analog pin 5)
 SDA-SDA(analog pin 4)
 ADD-NC
 */


#include <Wire.h> //BH1750 IIC Mode 
#include <math.h> 
int BH1750address = 0x23; //setting i2c address

byte buff[2];
void setup()
{
  Wire.begin();
  Serial.begin(57600);//init Serail band rate
}

void loop()
{
  int i;
  uint16_t val=0;
  BH1750_Init(BH1750address);
  delay(200);

  if(2==BH1750_Read(BH1750address))
  {
    val=((buff[0]<<8)|buff[1])/1.2;
    Serial.print(val,DEC);     
    Serial.println("[lx]"); 
  }
  delay(150);
}

int BH1750_Read(int address) //
{
  int i=0;
  Wire.beginTransmission(address);
  Wire.requestFrom(address, 2);
  while(Wire.available()) //
  {
    buff[i] = Wire.receive();  // receive one byte
    i++;
  }
  Wire.endTransmission();  
  return i;
}

void BH1750_Init(int address) 
{
  Wire.beginTransmission(address);
  Wire.send(0x10);//1lx reolution 120ms
  Wire.endTransmission();
}

Additional Documentation

RAR file with sample code, data sheet, and wiring diagram

Nextredirectltr.pngGo Shopping Light Sensor BH1750 (SKU:SEN0097)

Category: DFRobot > Sensors & Modules > Sensors > Light & Imaging Sensors