Skip to content

7semi-solutions/7Semi-OPT3004-Digital-Ambient-Light-Sensor-Arduino-Library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

7Semi OPT3004 – Ambient Light Sensor (Lux)

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.

Features

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

Supported Platforms

Arduino Uno / Nano / Mega

ESP32

Installation

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

Hardware Connections

OPT3004 Module → MCU Connections

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.

I2C Information

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)

About

7Semi_OPT3004 is an easy-to-use Arduino and ESP-compatible library for the Texas Instruments OPT3004 digital ambient light sensor. It supports lux measurement, auto/manual range selection, single-shot and continuous modes, threshold interrupts, and raw data access, making it suitable for beginners.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages