Working Principle
The Rohm BH1750 is a digital ambient light sensor that outputs illuminance directly in lux. An internal photodiode converts incoming light into current. An integrating ADC accumulates the photocurrent over a programmable measurement window, then a microcontroller scales the count to calibrated lux units.
Analogy: Think of a bucket catching raindrops (photons). After a set time, you weigh the bucket (count photons) and calculate the rainfall rate (lux). The BH1750 does this electronically and reports the number via I2C.
Electrical Characteristics
| Parameter | Value |
|---|---|
| Supply Voltage | 2.4 V – 3.6 V |
| Illuminance Range | 1 – 65535 lux |
| Resolution | 1 lux (high-res mode) / 4 lux (low-res mode) |
| Measurement Time | 120 ms (high-res) / 16 ms (low-res) |
| Spectral Response | Close to human eye (peak ~550 nm) |
| Interface | I2C (addr 0x23 or 0x5C) |
| Current | 120 µA (measurement), 0.01 µA (power-down) |
Interfacing with an MCU
The BH1750 uses I2C at address 0x23 (ADDR pin LOW) or 0x5C (ADDR pin HIGH). The GY-302 breakout module includes pull-ups and a regulator for 5 V operation.
Calibration
The BH1750 is factory-calibrated and needs no user calibration for most applications. However:
- Measurement Time Register (MTreg): Change integration time to extend or reduce the lux range (31–254, default 69).
- Filtering: Average multiple readings to reduce flicker noise from artificial lighting (50/60 Hz).
- Optical window: If placed behind glass or diffuser, apply a correction factor by measuring against a reference lux meter.
Code Example
/*
* BH1750 Ambient Light Sensor — Arduino I2C
* Requires: BH1750 library (by Christopher Laws)
* Wiring: SCL→A5, SDA→A4, VCC→3.3V, ADDR→GND
*/
#include <Wire.h>
#include <BH1750.h>
BH1750 lightMeter(0x23);
void setup() {
Serial.begin(9600);
Wire.begin();
lightMeter.begin(BH1750::CONTINUOUS_HIGH_RES_MODE);
Serial.println("BH1750 Light Sensor Ready");
}
void loop() {
float lux = lightMeter.readLightLevel();
Serial.print("Light: ");
Serial.print(lux);
Serial.println(" lux");
/* Simple ambient descriptor */
if (lux < 10) Serial.println(" → Dark");
else if (lux < 500) Serial.println(" → Indoor");
else if (lux < 10000) Serial.println(" → Overcast");
else Serial.println(" → Bright sunlight");
delay(1000);
}
Real-World Applications
Adaptive Display Backlighting
Smartphones and automotive instrument clusters use ambient light sensors (BH1750 or equivalent) to automatically adjust screen brightness. Matching backlight intensity to ambient light reduces eye strain and extends battery life by up to 30%.
Limitations
- Limited range: Maxes out at 65535 lux — direct sunlight can exceed 100,000 lux.
- No colour data: Reports total visible illuminance only; use TCS3200 or VEML6040 for colour sensing.
- IR sensitivity: Though optimised for visible light, significant IR sources (heat lamps) can add error.
- Slow update: 120 ms per measurement means maximum ~8 Hz update rate in high-res mode.