Parçalar

OPT3001 ortam ışık sensörü

TI OPT3001 ışığı lüks cinsinden gözün gördüğü şekilde ölçer, 0.01'den 83865 luksa, otomatik aralıklı, I2C üzerinden 0x44 adresinden.

Takma adlar: OPT3001 modülü, CJMCU-3001, ClosedCube OPT3001, lüks ölçer. Filtresi kızılötesini engeller, bu yüzden akkor ışık altında düz bir fotodiyodun yüksek okuduğu yerde gözle aynı fikirdedir. Bir ekran onunla karartır; bir sera onunla kayıt tutar.

Pins

Pin Ne yapar
VCC, GND Besleme, kartta 3 ila 5 V.
SCL, SDA I2C. Pull-up dirençleri kartın üzerindedir.
INT Sınır veya dönüşüm hazır kesmesi, düşük aktif.

Özellikler

address, 0x44 ila 0x47. lux ışıktır; kaydırıcı onu değiştirir.

Arduino üzerinde okumak

Mokxi'nin ClosedCube_OPT3001.h olarak sunduğu ClosedCube kütüphanesiyle:

#include <ClosedCube_OPT3001.h>
ClosedCube_OPT3001 opt3001;

void setup() {
  Serial.begin(9600);
  opt3001.begin(0x44);
  OPT3001_Config config;
  config.rawData = 0;
  config.RangeNumber = 0b1100;
  config.ModeOfConversionOperation = 0b11;
  opt3001.writeConfig(config);
}

void loop() {
  Serial.println(opt3001.readResult().lux);
  delay(500);
}

Nasıl konuşur

Sixteen-bit registers: 0x00 the result, an exponent and a twelve-bit mantissa, lux = 0.01 x 2^E x R; 0x01 the configuration (range, 100 or 800 ms, the mode and the flags); 0x02 and 0x03 the limits; 0x7E 0x5449 and 0x7F 0x3001. It powers up shut down; continuous mode converts every 100 or 800 ms and sets the conversion ready flag, which reading the configuration clears.

Modellemediği şeyler

Hata sayısı ve spektral yanıt: kaydırıcı okumadır.

Common mistakes

Reading the result before a conversion has finished: it reads zero until the first one, 100 or 800 ms after the mode is set.