GY-302 BH1750 Digital Light Intensity Module

From Wiki
Jump to: navigation, search

Introduction

GY-302 1.jpg GY-302 2.jpg
BH1750FVI is a digital Ambient Light Sensor IC for I2C bus interface. This IC is the most suitable to receive the ambient light data for adjusting LCD and Keypad backlight power of Mobile phone. It is possible to detect wide range at High resolution.(1 – 65535 lx)

Features

1. Type: GY-302;
2. Size: 13.9mm x 18.5mm;
3. ROHM original package BH1750FVI chip;
4. Power Supply: 3~5V;
5. Date Range: 0~65535;
6. Sensor build-in 16-bit AD converter;
7. Direct digital output, omit complex calculations and calibration;
8. No ambient light distinction;
9. Dichroism close to visual sensitivity;
10. High precision determination accurate to 1 Lu for different lights.

Introduction of Pins

Introduction of Pins
GND Cathode of power supply.
VCC Anode of power supply connected to 3~5V.
SCL I²C clock
SDA I²C data
ADDR IIC address pin

Principle

BH1750FVI is possible to change sensor sensitivity. And it is possible to cancel the optical window influence by changing sensor sensitivity from default to 2 times.

Sensor sensitivity is shifted by changing the value of MTreg (measurement time register). MTreg value has to set 2 times if target of sensor sensitivity is 2 times. Measurement time is also set 2 times when MTreg value is changed from default to 2 times.

Procedure for changing target sensor sensitivity to 2 times.
Please change Mtreg from “0100_01010” (default) to “1000_1010” (default * 2).

GY-302 3.jpg

Experimental Procedures for Arduino

Step 1: Connect the circuit:

GY-302 Sunfounder Uno
VCC VCC
GND GND
SDA A4
SCL A5
ADDR

Step 1: Connect the circuit:
GY-302 4.jpg
Step 2: Compile and upload the code.

/*
 Sample code for the BH1750 Light sensor
  
 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 Serial 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.read();  // receive one byte
    i++;
  }
  Wire.endTransmission();  
  return i;
}
 
void BH1750_Init(int address) 
{
  Wire.beginTransmission(address);
  Wire.write(0x10);//1lx reolution 120ms
  Wire.endTransmission();
}

GY-302 5.jpg