Get Values From BH1750 Light Sensor Module Using Arduino

BH1750 light intensity sensor breakout board from rhydoLABZ is a digital Ambient Light Sensor(ALS) with IIC bus interface. This sensor is most suitable to obtain the ambient light data for adjusting LCD, Keypad backlight etc. The ALS enables automatic control of display backlight brightness over a wide range of illumination conditions from a dark environment to direct sunlight. Photo diode on BH1750 detects the light intensity, which is converted as voltage output with the help of an integration OP-AMP. The built in ADC finally gives out the 16-bit digital data. Internal logic of BH1750 avoids the need for any complicated calculations, as it directly outputs meaningful digital data in lux (lx). BH1705 has 3 measurement modes corresponding to different sensitivity levels (0.5lx, 1lx and 4lx). The H-Resolution Mode is recommended as it provides the best noise rejection.

Features

  • IIC bus Interface
  • SCL Clock Frequency: 400kHz max
  • Photo diode with approximate human eye response
  • Select between 2 types of I2C slave-address
  • Internal logic for ambient light calculation
  • Digital Output data in lux
  • Wide range and High resolution. ( 1 – 65535 lx )
  • Low Current Consumption by power down function
  • 50Hz / 60Hz Light Noise rejection
  • Very little light source dependency
  • Influence of infrared is very small.
  • Selectable output level (3V3 & 5V)
  • Breadboard compatible

Hardware overview

BH1750 uses I2C protocol for communication. The light sensor module has on-board level conversion circuit, which allows you to interface the board with 3V3 or 5V microcontrollers as selected by the jumper J2

The address of the device depends on the logic state of the address pin. There is an on board pull down on the address pin, so with no connection it defaults to the low address (0×23).  PCB jumper J1 allows easy configuration of the address pin. If it is shorted, the address pin will be pulled high and the address will be 0x5C. Address of the module can also be controlled by the input signal on ADD pin, keeping J1 open.

BH1750 internal block diagram

The typical digital output ambient light sensor has a 16-bit digital I2C output. In addition to amplification for the photodiode, the IC’s integrated ADC converts the photosensor’s output to an I2C signal for direct connection to the I2C communication bus of an MCU or baseband processor.
  • PD :- Photo diode with approximately human eye response.
  • AMP :-  Integration-OPAMP for converting from PD current to Voltage.
  • ADC :-  AD converter for obtainment Digital 16bit data.
  • Logic + I2C Interface :-  Ambient Light Calculation and I2C BUS Interface. It is including below register.
    Data Register →  This is for registration of Ambient Light Data. Initial Value is “0000_0000_0000_0000″.
    Measurement Time Register →  This is for registration of measurement time. Initial Value is “0100_0101″.
  • OSC :- Internal Oscillator ( typ. 320kHz ). It is CLK for internal logic.

Interfacing with Arduino

Breakout board from rhydoLABZ is ready to use with a MCU instead of connecting BH1750 and supporting circutry on  bread board. The breakout pins are as shown below,

  • VCC → 5V/3V3
  • GND → GND
  • SCL  → A5 (or SCL for R3 version of Arduino)
  • SDA → A4 (or SDA for R3)
  • ADD → Slave Address is 2 types, it is determined by ADD Terminal
    ADD = ‘H’       ( ADD    ≧  0.7VCC )  →  “1011100“(0X5C)
    ADD = ‘L’       ( ADD     ≦  0.3VCC )  →  “0100011“ (0X23)
  • DVI is I2C bus reference voltage terminal. And it is also asynchronous reset terminal. It is necessary to set to ‘L’ after Vcc is supplied. In DVI ‘L’ term, internal state is set to Power Down mode.

You can download the sample code and  library files from Github. To add the library to your Arduino sketchbook, open the IDE, navigate to Sketch > Include Library > Add .ZIP Library… and select the ZIP folder you just downloaded. Open the sample code and flash it to your Arduino. Open the serial monitor and you can see the output as follows.

Dimension

Resources

Shop with us



 


Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">