BH1750 ambient light sensor I2C to the cloud with an ESP32
The ubiquitous I²C light sensor breakout (GY-302 and friends), read through the gateway's generic I²C driver. It reports illuminance in lux from about 1 to 65 000.
The Synacl ESP32 gateway reads the BH1750 ambient light sensor over I²C. This catalog entry carries the register map, scaling and connection defaults below, so adding it in the app is a pick from a list rather than a form filled in from the datasheet — and it is the same data an AI agent gets from the list_catalog MCP tool.
Registers · 1 tag
| Tag | Unit | I²C address | Init byte | Bytes | Byte order | Scale |
|---|---|---|---|---|---|---|
Illuminanceilluminance_ambient | lux | 0x23 | 0x10 | 2 | big-endian | × 0.8333 |
Generic I²C: the gateway writes the init byte once, then reads the given number of bytes each poll and combines them in the stated byte order. Engineering value = raw × scale + offset.
Connection defaults
| I²C address | 0x23 |
|---|---|
| Sensor driver | generic |
| Bus pins (gateway default) | SDA GPIO 21 · SCL GPIO 22 (3.3 V) |
| Bus clock | 100 kHz |
Wiring
I²C: SDA to GPIO 21, SCL to GPIO 22 (the gateway defaults), VCC to 3.3 V, GND to GND. Leave ADDR unconnected or tied low for address 0x23. The breakout carries its own pull-ups; keep the wires short.
Notes
- Bench-verified on the platform's ESP32 gateway (the no-code ESP32 guide, 2026-09-18).
- Generic I²C driver: one init byte 0x10 (continuous high-resolution mode) is written once, then two bytes are read each poll, most-significant first. The raw count divided by 1.2 is lux — the scale factor 0.8333 does that division.
- Tie ADDR high for the alternate address 0x5C (92) when two sensors share the bus, and change i2cAddress on that tag.
- The tag key illuminance_ambient is what the firmware publishes; keep it if you rename the display label.
Set it up in three steps
- Flash the gateway from the browser
Plug an ESP32 dev board into USB, open the free web flasher in Chrome or Edge and write the Synacl gateway firmware. It asks for Wi-Fi and pairs the gateway with your account — nothing to install, about two minutes. - Add the BH1750 ambient light sensor from the catalog
In the app open Devices → Add device and choose “Start from a catalog device”, then pick BH1750 ambient light sensor. The I²C settings and every tag in the table above are filled in; choose the gateway it is wired to, change the I²C address if yours differs, and save. How the catalog picker works → - Watch the live data arrive
The gateway receives the new configuration over MQTT within seconds and starts polling. Readings show on the device page and in any dashboard widget you bind to them; add a rule for alerts, keep history for reports, or let an AI agent read it over MCP.
How this entry was verified
Bench-verified — confirmed on real hardware by Synacl.
Bench-verified means Synacl ran this entry on real hardware. Datasheet-derived means the map was transcribed from the vendor's documentation, so a register may be off by one or in the other word order on your unit — a two-line email fixes it for everyone.
Report a register mismatch · Vendor datasheet ↗ · All catalog devices
Try it on your own hardware
Synacl is free for five devices — no card, no sales call. Flash a gateway from the browser, add the BH1750 ambient light sensor from the catalog, and see live data in a few minutes.