Source: https://mokxi.com/parts/bh1750
Updated: 2026-11-10

Part

# Light sensor, BH1750

A light meter on I2C that answers in lux: the count is lux times 1.2, with no calibration.

See every part

- 5 pins
- In 2 projects
- In 3 lessons

Drawn live by the editor's own code, at the size you see it.

At a glance

## The Light sensor, BH1750 in brief

What it is, and where it sits on the bench.

The BH1750FVI is ROHM’s ambient light sensor, bought as the GY-302 module with five pins: VCC, GND, SCL, SDA and ADDR. The module has a 3.3 V regulator and pull-ups, so VCC takes 3 to 5 V, and SDA and SCL go to A4 and A5 on an Uno or GPIO 21 and 22 on an ESP32. ADDR low or open is 0x23, high is 0x5C. It answers in lux, not in a voltage: there are no registers, only one-byte commands, and each read is the last measurement, a count of lux times 1.2. Mokxi models every command, the three resolutions with 120 ms or 16 ms measurements, one-time modes that power down after one reading, MTreg from 31 to 254 with 69 at power-on, and saturation at 65535, which is 54612 lx in high resolution. The slider runs logarithmically from 0 to 100 000 lux. The classic mistake is reading before the first measurement finishes and getting 0, or reading a one-time mode twice. The spread of the 1.2 ratio between real parts and the spectral response to different light sources are not modeled.

Family

Sensors

Pins

5

Pins

## 5 pins

Named as the editor names them, so a wire lands where you expect it.

Pin

What it does

VCC

Supply, 3 V to 5 V. The module has a 3.3 V regulator for the chip.

GND

Ground.

SCL

I2C clock. The module carries the pull-ups.

SDA

I2C data.

ADDR

Low or open: 0x23. High: 0x5C, for a second sensor on the same bus.

How to use it

## How to use the BH1750 light sensor with an Arduino

VCC to 5 V, GND to GND, SDA to SDA and SCL to SCL, which on an Uno are the same signals as A4 and A5; the GY-302 has its own regulator and pull-ups. Leave ADDR open for 0x23. The lux night lamp adds an LED on pin 9 through 220 ohms that fades up as the light falls from 500 lux to 20.

With the BH1750 library, call Wire.begin(), then lightMeter.begin(), and read only when measurementReady() says the 120 ms measurement is done; before the first one the reading is 0. The example uses readLightLevelCentis(), hundredths of a lux as a whole number, because the Uno sketch does its fade in integers. Drag the slider: it is logarithmic, and past 54612 lux the reading stops climbing.

Part pin

Board pin

VCC

5 V

GND

GND

SDA

SDA (A4)

SCL

SCL (A5)

On an ESP32, power it from 3.3 V with SDA on GPIO 21 and SCL on 22. Tie ADDR high on a second sensor so it answers at 0x5C.

Click to open it in the editor

This is the simulator itself, running here. Click anything to open it in the editor.

Open this project in the editor Read the full tutorial

Lux, from the night lamp

How it is modeled

## What is true about the Light sensor, BH1750, here

In its help article’s own words: what the simulation gets right, and where it stops.

### Modeled

From the ROHM BH1750FVI datasheet (Rev.D): the address and its pin, every command,
the three resolutions, one-time and continuous modes with the power down after a
one-time measurement, the reset that works only while powered on, the typical
measurement times, MTreg and its effect on both time and count, and the saturation at
65535.

### Not modeled

The spread of the 1.2 ratio between parts (0.96 to 1.44 in the sheet), the spectral
response and light-source dependence (a slider's lux is the eye's lux), and the
sheet's maximum measurement times (180 ms and 24 ms), which the library waits for.
How the chip drops the low bits in low resolution is not in the sheet; the model
rounds down to a multiple of 4.

From BH1750 light sensor, in full.

Projects

## See the Light sensor, BH1750 in a project

2 built-in projects use it. Each opens in the editor, already wired.

Lessons

## Where it turns up in a lesson

3 lessons place it in their own circuits.

### Learn articles

3 lessons

- Home Assistant and ESPHome Devices on an ESP32
- Arduino BH1750 Light Sensor: Lux, Wiring, Code
- Tinkercad ESP32 Simulator: A Free Alternative

Boards

## The boards it is shown on

Each of these 2 boards has a built-in project with the Light sensor, BH1750 in it.

- Arduino Uno R3
- ESP32-C3-DevKitM-1

Libraries

## Arduino libraries for the Light sensor, BH1750

Built in, so the sketch compiles with nothing to install. Each page has the calls, the wiring and an example to run.

- BH1750

More parts

## The rest of the bench

Every one of these is drawn and simulated the same way.

Full-size breadboard

A real 0.1 inch grid with the rails and the center channel, 63 columns wide.

Jumper wires

Drag from any pin or hole to any other. Corners snap, and you can drag them.

Power

A supply rail at the voltage you choose.

Ground

The other end of every circuit.

LED

Lights when current flows. Five colors, and the brightness is what your eye would see.

Filament lamp

A tungsten bulb in a holder: an inrush when it is switched on cold, tens of milliseconds to warm up, and dim on half its voltage.

Resistor

Any value you like, with the color bands drawn to match.

ESP32-C3-DevKitM-1

A RISC-V board that runs your firmware at 160 MHz on the real memory map.

Pushbutton

A 12 mm tactile switch. Hold it while the simulation runs.

Raspberry Pi Pico

The RP2040 board on our own Cortex-M0+ core. Pick a program and press Run.

Raspberry Pi Pico W

Raspberry Pi Pico W (RP2040). The same board and the same pinout as a Pico, with the CYW43439 on it. The WiFi is simulated (no radio; real internet through the Cloud panel’s switch), and the on-board LED, which hangs off that chip rather than off GP25, is driven through the same path. Everything else is the Pico.

Raspberry Pi 4 Model B

Raspberry Pi 4 Model B: the 40-pin header, driven by main.py with RPi.GPIO or gpiozero.

See every part

## Wire up the Light sensor, BH1750

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.

Start building free Open the editor
