7Semi_OPT3004 is an Arduino-compatible library for the Texas Instruments OPT3004 digital ambient light sensor, designed for accurate lux measurement in indoor and outdoor lighting applications.
Accurate lux measurement using 16-bit exponent + mantissa format
I2C interface (Arduino / ESP compatible)
Continuous and single-shot measurement modes
Automatic full-scale range adjustment (AUTO mode)
Manual full-scale range selection for fixed resolution
Configurable conversion time (100 ms / 800 ms)
Low and high threshold limits
Interrupt support with latch and transparent modes
Configurable interrupt polarity
Fault count filtering for noise immunity
Raw data read access (exponent + mantissa)
ESP32 / ESP8266 custom SDA/SCL pin support
Arduino Uno / Nano / Mega
ESP32
Arduino Library Manager
Open Arduino IDE
Go to Sketch → Include Library → Manage Libraries
Search for 7Semi_OPT3004
Click Install
Manual Installation
Download this repository as ZIP
Extract into your Arduino libraries folder
Restart Arduino IDE
| OPT3004 Pin | MCU Pin |
|---|---|
| VCC | 3.3V (recommended) |
| GND | GND |
| SDA | SDA |
| SCL | SCL |
| INT | Optional (interrupt output) |
⚠️ Most OPT3004 modules are 3.3V only.
Do NOT connect VCC to 5V unless your module explicitly supports it.
Default I2C address used by the library: 0x45
I2C speed: 100 kHz (default, safe)
Address may vary based on sensor pin configuration (check your module)