BH1750 Sensor Arduino Interfacing

Last Updated on March 16, 2024

Ambient Light Sensors are used in lighting and image related applications, BH1750FVI is an digital Ambient Light Sensor IC for I2C bus interface. This IC is the most suitable to obtain the ambient light data with wide range and High resolution. In this article BH1750 Sensor Arduino Interfacing and coding structure given with example.




BH1750 sensor has Spectral responsibility is approximately human eye response and 50Hz / 60Hz Light noise reject-function, this sensor gives Adjustable measurement result for influence of optical window and by using this sensor we can detect min. 0.11 lx, max. 100000 lx.

Ambient Light Sensor BH1750FVI

The sensor BH1750 comes in WSOF6I package and utilizing breakout board or module of BH1750 is recommended. This sensor can measure the ambient light value in continuous or one time measurement by the way six different modes of operations can be obtained.

One time Measurement

1.Low Resolution Mode – (4 lx precision, 16ms measurement time)

2.High Resolution Mode – (1 lx precision, 120ms measurement time)

3.High Resolution Mode  – (0.5 lx precision, 120ms measurement time)

The sensor takes one sample measurement data and goes into power down mode.

Continuous Measurement

4.Low Resolution Mode – (4 lx precision, 16ms measurement time)

5.High Resolution Mode – (1 lx precision, 120ms measurement time)

6.High Resolution Mode  – (0.5 lx precision, 120ms measurement time)

the following arduino example code takes ambient light data in high resolution mode.

BH1750 Sensor Arduino Wiring

Arduino BH1750 Code

BH1750 library for Arduino: https://github.com/claws/BH1750

#include <Wire.h>
#include <BH1750.h>

BH1750 lightMeter;

void setup(){

  Serial.begin(9600);

  // Initialize the I2C bus (BH1750 library doesn't do this automatically)
  // On esp8266 devices you can select SCL and SDA pins using Wire.begin(D4, D3);
  Wire.begin();

  lightMeter.begin();
  Serial.println(F("BH1750 Test"));

}

void loop() {

  uint16_t lux = lightMeter.readLightLevel();
  Serial.print("Light: ");
  Serial.print(lux);
  Serial.println(" lx");
  delay(1000);

}


Serial Monitor output

Light: 71 lx

Light: 72 lx

Light: 57 lx

Light: 318 lx

Light: 330 lx

Light: 336 lx

Light: 338 lx




Leave a Reply

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