I’m having some problems using the second version of the Grove - Sunlight Sensor
correctly. The values it’s giving using the official library do not match a calibrated lux sensor at all. I am using this version of the official library, which supports the newer (Si1151?) sensor.
Looking at the datasheet for the sensor itself and the code used in the updated GitHub library, I’m not sure if the code is even using the sensor correctly. Like why is the infrared and visible light values taken from the same registers, but the visible light value is just divided by 3?
IR:
uint16_t Si115X::ReadHalfWord(void) {
Si115X::send_command(Si115X::FORCE);
uint8_t data[3];
data[0] = Si115X::read_register(Si115X::DEVICE_ADDRESS, Si115X::HOSTOUT_0, 1);
data[1] = Si115X::read_register(Si115X::DEVICE_ADDRESS, Si115X::HOSTOUT_1, 1);
// Si115X::send_command(Si115X::PAUSE);
// data[3] = data[0] * 256 + data[1];
return data[0] * 256 + data[1]; //* 256 + data[1];
}
Visible:
uint16_t Si115X::ReadHalfWord_VISIBLE(void) {
Si115X::send_command(Si115X::FORCE);
uint8_t data[3];
data[0] = Si115X::read_register(Si115X::DEVICE_ADDRESS, Si115X::HOSTOUT_0, 1);
data[1] = Si115X::read_register(Si115X::DEVICE_ADDRESS, Si115X::HOSTOUT_1, 1);
return (data[0] * 256 + data[1])/3;
}
Maybe I’m just not understanding it good enough.
So how do I get the sensor to output correct values? Or do I just need to calibrate it? I’m also wondering if the output value is in lux or lumens? The wiki says they are in lumens, but the Si1151 itself gives lux. Unless the code does some lux to lumen conversion using the photodiode area, which I don’t see in the code, I don’t really how it would be able to output lumens.