| 1 |
============================== |
| 2 |
OPT4060 driver |
| 3 |
============================== |
| 4 |
|
| 5 |
1. Overview |
| 6 |
============================= |
| 7 |
|
| 8 |
This driver supports the Texas Instrument RGBW high resolution color sensor over |
| 9 |
I2C. |
| 10 |
https://www.ti.com/lit/gpn/opt4060 |
| 11 |
|
| 12 |
The driver supports: |
| 13 |
- Raw values for red, green, blue and clear. |
| 14 |
- Illuminance values. |
| 15 |
- Scaled color values for red, green and blue. |
| 16 |
- IIO events for thresholds. |
| 17 |
- IIO triggered buffer using both its own data ready trigger and triggers from |
| 18 |
other drivers. |
| 19 |
|
| 20 |
2. Illuminance calculation |
| 21 |
============================= |
| 22 |
|
| 23 |
Illuminance is calculated using the wide spectrum green channel. |
| 24 |
|
| 25 |
lux = GREEN_RAW x 2.15e-3 |
| 26 |
|
| 27 |
The value is accessed from: |
| 28 |
/sys/bus/iio/devices/iio:deviceX/in_illuminance_input |
| 29 |
|
| 30 |
See section 8.4.5.2 in the data sheet for additional details. |
| 31 |
|
| 32 |
3. Color scale values |
| 33 |
============================= |
| 34 |
|
| 35 |
The sensor has different sensitivity for the different color components and |
| 36 |
compensating factors are exposed from the driver. |
| 37 |
|
| 38 |
The values are accessed from: |
| 39 |
/sys/bus/iio/devices/iio:deviceX/in_intensity_red_scale |
| 40 |
/sys/bus/iio/devices/iio:deviceX/in_intensity_green_scale |
| 41 |
/sys/bus/iio/devices/iio:deviceX/in_intensity_blue_scale |
| 42 |
|
| 43 |
A userspace application can multiply the raw values with the scale values so |
| 44 |
that for a particular test light source, typically white, the measurement |
| 45 |
intensity is the same across the different color channels. This is calculated |
| 46 |
in the following way: |
| 47 |
|
| 48 |
R = RED_RAW x SCALE_RED(2.4) |
| 49 |
G = GREEN_RAW x SCALE_GREEN(1.0) |
| 50 |
B = BLUE_RAW x SCALE_BLUE(1.3) |
| 51 |
|
| 52 |
The data sheet suggests using the scaled values to normalize the scaled R, G |
| 53 |
and B values. This is useful to get a value for the ratio between colors |
| 54 |
independent of light intensity. A userspace application can do this in the |
| 55 |
following way: |
| 56 |
|
| 57 |
R_NORMALIZED = R / (R + G + B) |
| 58 |
G_NORMALIZED = G / (R + G + B) |
| 59 |
B_NORMALIZED = B / (R + G + B) |
| 60 |
|
| 61 |
See section 8.4.5.2 in the data sheet for additional details. |