You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-1Lines changed: 12 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,14 +6,25 @@ Library for M5Stack light-related units using [M5UnitUnified](https://github.com
6
6
M5UnitUnified is a library for unified handling of various M5 units products.
7
7
8
8
### SKU:U136
9
-
Unit DLight is a digital ambient light detection sensor that uses the BH1750FVI illuminance sensor IC (I2C interface). It has a built-in 16-bit AD converter supporting illuminance value detection ranging from 1 to 65535 lx. It is characterized by its small size and low power consumption, making it suitable for various illuminance detection and light control adjustment scenarios.
9
+
Unit DLight is a digital ambient light detection sensor. The hardware uses a BH1750FVI illuminance sensor IC (I2C interface), with built-in 16-bit AD conversion supporting (1 ~ 65535 lx) illuminance value detection. It features a small size and low power consumption, making it suitable for various illuminance detection and light control adjustment scenarios.
10
10
11
11
### SKU:U134
12
12
Hat DLight is a digital ambient light detection sensor compatible with the M5StickC/C Plus series. The hardware uses the BH1750FVI illuminance sensor IC (I2C interface), with a built-in 16-bit AD converter, supporting illuminance value detection from 1 to 65535 lx. It features a small size and low power consumption, making it suitable for various illuminance detection and light control adjustment scenarios.
13
13
14
14
### SKU:U021
15
15
Unit Light is a light intensity detection sensor. It integrates a photoresistor and a 10K adjustable resistor, capable of detecting light intensity and setting a light intensity threshold. The resistance of the photoresistor decreases as the incident light intensity increases, thus detecting the change in voltage, and obtaining light intensity data through AD conversion. To achieve more accurate light intensity measurements, this Unit also adopts the LM393 dual differential comparator, used to compare the differential voltage between the photoresistor and the varistor.
16
16
17
+
#### Analog reading notes (chip-generation dependent)
18
+
19
+
Raw ADC values from `unit.analog()` are **not directly comparable across boards** because ESP32 ADC characteristics differ by chip generation:
20
+
21
+
-**ESP32 classic** (Core / Fire / StickCPlus 等): ATTEN_DB_11 is non-linear above ~2.45 V; dark readings tend to saturate near 4095 due to ADC compression, not true full-scale.
22
+
-**ESP32-C6 / -H2 / -S3 / -P4** (NanoC6 / NanoH2 / CoreS3 / StickS3 / Tab5): ATTEN_DB_12 is linear across 0–3.3 V; the same physical light level yields a lower raw value (~3900) than on ESP32 classic — this is the more accurate reading.
23
+
24
+
Reference: [Espressif Developer Blog — Comparing ADC Performance of Espressif SoCs (2025-08)](https://developer.espressif.com/blog/2025/08/adc-performance/)
25
+
26
+
**Always calibrate per board** via `unit.calibrateDark()` / `unit.calibrateBright()` (BtnA click / hold in `PlotToSerial` example) so that `unit.normalized()` returns a portable 0–100 % value regardless of chip.
27
+
17
28
## Related Link
18
29
See also examples using conventional methods here.
0 commit comments