Skip to content

adafruit/Adafruit_OPT4048

Repository files navigation

Adafruit OPT4048 Library Build StatusDocumentation

This is an Arduino library for the Adafruit OPT4048 breakout board, a high-speed, high-precision tristimulus XYZ color sensor.

About the OPT4048

The OPT4048 is a high-precision, tristimulus XYZ color sensor that provides accurate color measurements by using an integrated CIE1931 XYZ filter technology.

Key features:

  • Four-channel sensor (X, Y, Z, clear)
  • High-precision color measurements with CIE1931 filter technology
  • Wide dynamic range with auto-ranging capability
  • Programmable interrupt with high and low thresholds
  • Adjustable conversion time (600μs to 800ms per channel)
  • Measures color temperature, illuminance, and chromaticity
  • I²C interface

Dependencies

This library depends on the Adafruit BusIO library for I²C communication.

Installation

You can install this library through the Arduino Library Manager. Search for "Adafruit OPT4048" and install the latest version.

To manually install:

  1. Download the .zip file from GitHub
  2. In the Arduino IDE: Sketch -> Include Library -> Add .ZIP Library

Hardware

Examples

The library includes several examples demonstrating various features:

  • opt4048_basictest: Basic usage with continuous readings
  • opt4048_fulltest: Demonstrates all sensor configurations
  • opt4048_intpin: Using the interrupt pin for data-ready notifications
  • opt4048_oneshot: One-shot measurement mode for low power applications

Library Features

  • Initialize the sensor with custom I²C address and Wire interface
  • Configure measurement settings (range, conversion time, operating mode)
  • Set up and use the interrupt system
  • Read raw channel data from all four sensors
  • Calculate CIE color coordinates (x, y) and illuminance (lux)
  • Determine color temperature in Kelvin

Documentation

For more information on using this library, check out the examples folder.

Full documentation of the OPT4048 sensor can be found in the datasheet.

License

This library is released under an MIT license. See the included LICENSE file for details.

About

Arduino library for OPT4048 sensor

Resources

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •