Skip to content

FPC-OPT3001 ​

Introduction ​

This flexible FPC ambient light sensor is based on the OPT3001DNPR chip. It uses an I2C interface with a default address of 0x44. Its accurate ambient light measurements and wide response range suit automatic brightness adjustment, light monitoring, and similar applications. The FPC-05F-6PH20 connector exposes VCC, NC, INT, SCL, SDA, and GND. SCL and SDA are the I2C clock and data lines, and INT can provide an interrupt output. The flexible FPC design fits confined spaces in smart devices, wearables, and embedded applications.

Product Specifications ​

  • Operating voltage: 1.6–3.6 V
  • Operating current: <2.5 µA
  • Measurement range: 0.01 lux to 83,000 lux
  • Interface: FPC 0.5 mm, 6-pin I2C
  • Dimensions: 30 mm (W) × 3.6 mm (H)
  • FPC pad dimensions: 0.3 mm (W) × 4 mm (H)
  • FPC pad pitch: 0.5 mm

Pinout ​

OPT3001_pinmap.png

PinNameDescription
1GNDGround
2SDAData line
3SCLClock line
4INTInterrupt
5NCNot connected
6VCCPower supply

Tutorials ​

Arduino ​

Prerequisites ​

  • Hardware

    1. A development board supported by Arduino IDE

Wiring Diagram ​

To be added

Example 1: Continuous Conversion Mode ​

Configure OPT3001 for automatic range selection and continuous conversion mode.

cpp
#include <Wire.h>

#define I2C_SDA 8
#define I2C_SCL 10

#define OPT3001_ADDRESS 0x44  // OPT3001 的 I2C 地址,根据 ADDR 引脚连接 GND
// #define OPT3001_ADDRESS 0x45    //  OPT3001 的 I2C 地址,根据 ADDR 引脚连接 VCC

// 配置寄存器值:自动量程、连续转换模式
#define OPT3001_CONFIG 0xCE10

void setup() {
  Serial.begin(115200);
  Wire.begin(I2C_SDA,I2C_SCL,100000);     // SDA SCL frequency
  // 配置 OPT3001
  Wire.beginTransmission(OPT3001_ADDRESS);
  Wire.write(0x01);  // 寄存器地址:配置寄存器
  Wire.write(OPT3001_CONFIG >> 8);  // 高字节
  Wire.write(OPT3001_CONFIG & 0xFF);  // 低字节
  Wire.endTransmission();
}

void loop() {
  float lux = readLux();
  Serial.print("光照强度: ");
  Serial.print(lux);
  Serial.println(" lx");

  delay(1000);  // 每秒读取一次
}

float readLux() {
  uint16_t result;

  // 读取结果寄存器
  Wire.beginTransmission(OPT3001_ADDRESS);
  Wire.write(0x00);  // 寄存器地址:结果寄存器
  Wire.endTransmission();

  Wire.requestFrom(OPT3001_ADDRESS, 2);  // 读取 2 字节
  if (Wire.available() == 2) {
    uint8_t high = Wire.read();
    uint8_t low = Wire.read();
    result = (high << 8) | low;
  }

  // 计算光照强度
  uint8_t exponent = (result >> 12) & 0x0F;  // 指数部分
  uint16_t mantissa = result & 0x0FFF;      // 尾数部分
  float lux = 0.01 * pow(2, exponent) * mantissa;
  return lux;
}

Example 2: Display Measurements on an OLED in Real Time ​

Display measurements on an OLED screen in real time.

Install the Adafruit_SSD1306 library using the Arduino Library Manager:

  1. Launch Arduino IDE and open the Library Manager: Sketch ➔ Include Library ➔ Manage Libraries....

  2. Search for Adafruit_SSD1306 in the Filter your search... field, then click Install.

cpp
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define I2C_SDA 8
#define I2C_SCL 10

#define OPT3001_ADDRESS 0x44  // OPT3001 的 I2C 地址,根据 ADDR 引脚连接 GND
// #define OPT3001_ADDRESS 0x45    //  OPT3001 的 I2C 地址,根据 ADDR 引脚连接 VCC
// 配置寄存器值:自动量程、连续转换模式
#define OPT3001_CONFIG 0xCE10


#define SCREEN_WIDTH 128      // OLED display width, in pixels
#define SCREEN_HEIGHT 64      // OLED display height, in pixels
#define OLED_RESET -1         // Reset pin # (or -1 if sharing Arduino reset pin)
#define SSD1306_ADDRESS 0x3C  ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32


Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

void setup() {
  Serial.begin(115200);
  Wire.begin(I2C_SDA, I2C_SCL, 100000);  // SDA SCL frequency
  // 配置 OPT3001
  Wire.beginTransmission(OPT3001_ADDRESS);
  Wire.write(0x01);                   // 寄存器地址:配置寄存器
  Wire.write(OPT3001_CONFIG >> 8);    // 高字节
  Wire.write(OPT3001_CONFIG & 0xFF);  // 低字节
  Wire.endTransmission();

  // while (!Serial)
  //   delay(10);  // will pause Zero, Leonardo, etc until serial console opens
  // // 初始化 OLED 显示屏
  if (!display.begin(SSD1306_SWITCHCAPVCC, SSD1306_ADDRESS)) {  // 0x3C 是 OLED 的 I2C 地址
    Serial.println(F("SSD1306 allocation failed"));
    for (;;)
      ;  // 进入无限循环
  }
  display.display();  // 显示启动画面
  delay(1000);
  display.setTextSize(1);   // Draw 1X-scale text
  display.setTextColor(SSD1306_WHITE); // Set OLED Text Color is White
}

void loop() {
  float lux = readLux();
  Serial.print("光照强度: ");
  Serial.print(lux);
  Serial.println(" lx");

  // Display data on OLED
  display.clearDisplay();   // Clear OLED Display
  display.setTextSize(2);   // Set Text Size
  display.setCursor(0, 0);  // Set Text Cursor (x,y) x=width y=hight
  display.printf("OPT3x 0x%02x\n",OPT3001_ADDRESS);  // 格式化为两位十六进制数
  display.setTextSize(2);                   // Set Text Size
  display.setCursor(0, 20);
  display.println("Light:");
  // display.printf("\n");
  display.setCursor(0, 25);
	display.printf("\n%.1f lux\n",lux);  
  display.display();
  delay(3000);  // 每秒读取一次
}

float readLux() {
  uint16_t result;

  // 读取结果寄存器
  Wire.beginTransmission(OPT3001_ADDRESS);
  Wire.write(0x00);  // 寄存器地址:结果寄存器
  Wire.endTransmission();

  Wire.requestFrom(OPT3001_ADDRESS, 2);  // 读取 2 字节
  if (Wire.available() == 2) {
    uint8_t high = Wire.read();
    uint8_t low = Wire.read();
    result = (high << 8) | low;
  }

  // 计算光照强度
  uint8_t exponent = (result >> 12) & 0x0F;  // 指数部分
  uint16_t mantissa = result & 0x0FFF;       // 尾数部分
  float lux = 0.01 * pow(2, exponent) * mantissa;
  return lux;
}

FAQ ​

No customer questions have been recorded for this product yet. Contact us through QQ or the forum if you need help.

Package Contents ​

More Resources ​