Bh1750 - jimaobian/DFRobotWiki GitHub Wiki

right

Introduction

This BH1750 light sensor is .NET Gadgeteer compatible, which uses the .NET Micro Framework to make writing code for your device as easy as writing a desktop, Web or Windows Phone application.

This module carries a BH1750, which is an digital ambient light sensor with digital output in Lux (Lx) via I2C.

This module is ideal for measuring the light intensity of car headlights, flashlights, photographic lights, Portable, game machine, Digital cameras, adjusting LCD and Keypad backlight power of Mobile phone

Applications

  • Mobile phone
  • LCD TV
  • NOTE PC
  • Portable game machine
  • Digital camera
  • Digital video camera
  • Car navigation
  • PDA
  • LCD display

Specifications

  • .NET Gadgeteer Compatible
  • Power supply voltage: +3 to 5Vdc
  • 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)
  • LUX reference in lx:
  • night: 0.001-0.02
  • moonlit night: 0.02-0.3
  • cloudy indoor : 5-50
  • cloudy outdoor: 50-500
  • shinny indoor: 100-1000
  • shinny outdoor: about 1 million
  • good for reading: 50-60

Connect diagram

Light Sensor Wiring diagram

Sample Code

/*
 Sample code for the BH1750 Light sensor
 Version 0.2
 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(9600);//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.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();
}

image:nextredirectltr.pngGo shopping http://www.dfrobot.com/index.php?route=product/product&filter_name=bh1750&product_id=975 BH1750 (SKU:TOY0043)]

category: Product Manual category: SEN Series category: Sensors

⚠️ **GitHub.com Fallback** ⚠️