• Worldwide Shipping

  • 24/7 Customer Support

  • FAQ
  • Worldwide Shipping

  • 24/7 Customer Support

  • FAQ

How to use: BH1750 light module

You are a starter with Croduino? Or newbie when it comes to electronics? You fancy a specific module, but you don't know how to use it? Dont't worry, we have our How To Use series!

How to Use is a series of blog tutorials by e-radionica where you will find everything you need to  to begin working with your favorite modules. Tutorials include: technical characteristics, operating principles, instructions on how to connect the module with Croduino and basic code. Everything else is up to you and your imagination.

Introduction

BH1750 is a digital ambient light sensor ready for I2C communication. You may have noticed that our smartphones are changing the screen backlight depending on the amount of light, but they do it thanks to this sensor. Breakout that you see in the picture below has everything ready to communicate with Croduino and voltage regulator. To find out more on the light, read this comprehensive tutorial.

dsc_5391_1
Voltage: 3V-5V
Measurement range: 1-65535lx
Resolution: 0.5lx
Dimensions: 14 x 19mm

This IC is very stable and has a small deviation with respect to the light source and the change in temperature. For more, see the datasheet. For an overview of the possibilities see the average intensity of light:

night: 0001 - 00:02;
moonlight: 0.02-0.3;
Cloudy, inside: 5-50;
Cloudy, without, 50-500;
Sunny, inside: 100-1000;
direct sunlight: 1M;

optimal for reading books: 50-60;
standard TV light: 1400.

How it works?

Let's look at block diagram of the IC:

Untitled

Let's start from the left. The process starts with a photodiode (PD), which has a sensitivity about the sensitivity of the human eye. We intensify this signal with  the operational amplifier (AMP) and convert it from analog to 16-bit digital signal (ADC). The procedure ends with IIC logic that uses an internal oscillator (serves as CLK).

The duration of this process depends on the accuracy of the readings we want. We have three possibilities that give accuracy of 0.5lx, 1 lx or 4LX, and the duration time is in the order of 120ms, 120ms and 16ms. Due to prolonged measurements, some noises can be eliminated (including the 50Hz / 60Hz noise) so we get this accurate results. Otherwise, lux [lx] is the SI unit of measurement of illumination. It is equal to one lumen per square meter, whereas the Candella (symbol: cd) applies as lumen per steradian (cd = lm / sr). Much more on the light, you can read in this tutorial. It should be mentioned that the resolution of the measurements can be increased to 10k lux, which actually corresponds to the light that gives direct sunlight.

How to connect?

Untitled Sketch_bb

Arduino code

As always, the last paragraph of How To Use series contains example code modules. We will use BH1750 library. You can find help with installing and using the library here, and if this is the first time you use the Arduino IDE, definitely see this tutorial. This is an example of using the library, which in the Serial Monitor prints light in lux every 1 second.

///////////////////////////////////////////////////////////////////////////////
/*                                                                           */
/*                                                                           */
/* (c) e-radionica.com 2015 - http://e-radionica.com/hr/faq/#privatnost      */
/* [email protected]                                               */
/*                                                                           */
/*                                                                           */
/* Digital light sensor BH1750 - How To Use tutorial                         */
///////////////////////////////////////////////////////////////////////////////

/* 

 * Connection:
 *  VCC - 5V
 *  GND - gnd
 *  SCL - SCL (A5)
 *  SDA - SDA (A4)
 *  ADDR - without connection ili gnd

*/

#include "Wire.h"
#include "BH1750.h"

int lux;

BH1750 luxometer;

void setup(){
  Serial.begin(9600);
  luxometar.begin();
}

void loop() {
  lux = luxometar.readLightLevel();

  Serial.print("Light: ");
  Serial.print(lux);
  Serial.println(" lx");
  delay(1000);
}
Leave a Reply