README.rst
1.. zephyr:code-sample:: veml6046
2 :name: VEML6046 RGBIR Color Sensor
3 :relevant-api: sensor_interface
4
5 Get red, green, blue and IR light data from a VEML6046 sensor (polling
6 mode).
7
8Overview
9********
10
11 This sample measures the red, green, blue and IR light for all possible
12 combinations of sensor attributes. They are:
13
14 - integration time
15 - effective photodiode size
16 - gain
17
18 These attributes can be used to put the sensor in an optimal working area.
19 When the light value reaches the maximum raw value (0xFFFF), an error is
20 returned to indicate the out of bounds situation to the user program.
21 With this program the raw value is also printed out together with the
22 attributes to be able to select good attribute values.
23 Interrupt and trigger modes are not supported so far, but planned for future
24 development.
25
26Requirements
27************
28
29 This sample uses the VEML6046 sensor controlled using the I2C-2 interface of
30 the Olimex-STM32-E407 board on Feather connector pins PF0 and PF1.
31
32References
33**********
34
35 - VEML6046: https://www.vishay.com/docs/80173/veml6046x00.pdf
36 - Application note: https://www.vishay.com/docs/80410/designingveml6046x00.pdf
37
38Building and Running
39********************
40
41 This project outputs sensor data to the console. It requires a VEML6046
42 sensor to be connected to the desired board.
43
44 .. zephyr-app-commands::
45 :zephyr-app: samples/sensor/veml6046/
46 :goals: build flash
47 :board: olimex_stm32_e407
48
49
50Sample Output
51=============
52
53 .. code-block:: console
54
55 Test all attributes for a good guess of attribute usage away of saturation.
56 Red: 68 lx ( 51) green: 68 lx ( 84) blue: 68 lx ( 51) IR: 68 lx ( 27) it: 0 pdd: 0 gain: 0 --
57 Red: 121 lx ( 181) green: 121 lx ( 347) blue: 121 lx ( 240) IR: 121 lx ( 53) it: 0 pdd: 0 gain: 1 --
58 Red: 215 lx ( 106) green: 215 lx ( 226) blue: 215 lx ( 160) IR: 215 lx ( 19) it: 0 pdd: 0 gain: 2 --
59 Red: 201 lx ( 75) green: 201 lx ( 156) blue: 201 lx ( 112) IR: 201 lx ( 14) it: 0 pdd: 0 gain: 3 --
60 [...]
61 Test finished.
62