Componentes

Sensor de luz ambiente OPT3001

El TI OPT3001 mide la luz en lux como la ve el ojo humano, de 0.01 a 83865 lux, con rango autom谩tico, por I2C en 0x44.

Alias: m贸dulo OPT3001, CJMCU-3001, ClosedCube OPT3001, lux贸metro. Su filtro bloquea el infrarrojo, as铆 que coincide con el ojo donde un fotodiodo com煤n marca alto bajo luz incandescente. Una pantalla se aten煤a con 茅l; un invernadero registra datos con 茅l.

Pins

Pin Qu茅 hace
VCC, GND Alimentaci贸n, de 3 a 5 V en la placa.
SCL, SDA I2C. La placa incluye las resistencias pull-up.
INT La interrupci贸n de l铆mite o de conversi贸n lista, activa en bajo.

Propiedades

address, de 0x44 a 0x47. lux es la luz; el control deslizante la cambia.

Leerlo en un Arduino

Con la biblioteca de ClosedCube, que Mokxi incluye como ClosedCube_OPT3001.h:

#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);
}

C贸mo se comunica

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.

Lo que no modela

El conteo de fallas y la respuesta espectral: el deslizador es la lectura.

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.