Thu, 06 Apr 2023 20:53:06 +0200
Set the new measured deep sleep current consumption. This is half of the Wemos D1 system.
1
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | # Driver for the VEML7700 ambient light sensor |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | This is the driver for the VEML7700 ambiernt light sensor from Vishay. It is not the |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | cheapest solution but very easy to integrate, with a minimum of further components. |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | The sensor can be SMD soldered by hand on a custom PCB, but also several breakout boards |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | are available. |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | ## About the sensor |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | The VEML7700 is a high-accuracy ambient light sensor. All measurements and filtering |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | is done on the chip which makes it easy to integrate. The sensitivity can be adjusted |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | by a gain setting and by changing the integration time. The output of the sensor is a |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | count value which must be converted using the resolution value in the driver. |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | The sensor has power saving features which reduces the repetition of measurements. |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | It has also a power off feature to save even more power. |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | The ambient light sensor value is filterd very clone to the caracteristic of the |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | human eye. Besides, als the white channel with a wider wavelength spectrum. In most |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | applications, the ambient light value will do just fine. |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | ## Power consumption |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | - 0.5 μA in shut-down mode (@3.3V) |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | - down to 2 μA in power save mode 4 (@3.3V) |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | - 45 μA on 100ms integration time (@3.3V) |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | ## Communication interface |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | I2C is used as communication interface without any further interrupt pins. It has six |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | command codes for the settings and the output values. Read the datasheet or application |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | note for further information. |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | To reduce interactions with the integrated microcontroller, the interrupt feature can |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | be used. Therefore, one must configure the low and high threshold and enable the interrupt. |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
37 | ## Interrupt application examples |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
38 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
39 | If values below a certain threshold is of interest, i.e. to activate lights when its |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | getting dark outside, the low threshold should be adjusted and setting the high threshold |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
41 | to maximum (65535). |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
42 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
43 | Another application could be an automated rollershutter, then both thresholds sould be |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
44 | set to trigger the up and down movement of rollershutters. |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
45 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
46 | ## Measurement process |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
47 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
48 | The measurement takes time and the sensor should not be read out faster than the |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
49 | measurement time. Therefore the application should be adjusted to the sensor configuration |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
50 | regarting integration time and power save modes. Alternatively, the interrupt feature |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
51 | can be used by repeatetive reading of the interrupt status. |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
52 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
53 | ## Usage |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
54 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
55 | This driver uses i2cdev which must be initialized first. Then initialize the device |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
56 | decriptor, one discriptor per device. The sensor can be used without configuration, |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
57 | but has a high chance of over-saturation on sunlight. Therefore, change gain and |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
58 | integration time to your needs and configure the device. |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
59 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
60 | Then, the veml7700_ambient_light and veml7700_white_channel functions can be used |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
61 | to read out the brightness. The driver converts the counts from the device to lx using |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
62 | the configuration. |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
63 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
64 | ### Hardware configurations |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
65 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
66 | The driver supports multiple VEML7700 sensors at the same time that are |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
67 | connected to I2C. Following figure show some possible hardware |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
68 | configurations. |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
69 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
70 | First figure shows the configuration with one sensor at I2C bus 0. |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
71 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
72 | ```text |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
73 | +------------------+ +----------+ |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
74 | | ESP8266 / ESP32 | | VEML7700 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
75 | | | | | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
76 | | GPIO 14 (SCL) ----> SCL | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
77 | | GPIO 13 (SDA) <---> SDA | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
78 | +------------------+ +----------+ |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
79 | ``` |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
80 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
81 | Next figure shows a possible configuration with two I2C buses. |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
82 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
83 | ```text |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
84 | +------------------+ +----------+ |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
85 | | ESP8266 / ESP32 | | VEML7700 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
86 | | | | | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
87 | | GPIO 14 (SCL) ----> SCL | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
88 | | GPIO 13 (SDA) <---> SDA | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
89 | | | +----------+ |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
90 | | | | VEML7700 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
91 | | | | | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
92 | | GPIO 5 (SCL) ----> SCL | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
93 | | GPIO 4 (SDA) <---> SDA | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
94 | +------------------+ +----------+ |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
95 | ``` |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
96 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
97 | Only one sensor per I2C bus is possible, since it uses a unconfigurable I2C slave address. |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
98 | However, one could also use GPIO controller bus buffer to connect the bus to different |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
99 | devices. |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
100 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
101 | ## References |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
102 | [Datasheet](https://www.vishay.com/docs/84286/veml7700.pdf) |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
103 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
104 | [Application Note](https://www.vishay.com/docs/84323/designingveml7700.pdf) |