Calibration needs to be run twice?
hoehe opened this issue · 0 comments
HW:
D1 Mini ESP8266 12T WLAN
SI1145 revision 0
SW:
MicroPython v1.17 on 2021-09-02; ESP module with ESP8266
MicroPython driver for SI1145 light I2C sensor, developer version : Version: 0.3.0 @ 2018/03/20
import machine
import si1145
i2c = machine.I2C(scl=machine.Pin(5), sda=machine.Pin(4), freq=10000)
si = si1145.SI1145(i2c=i2c)
print("without load calibration")
print("UV Index: ", si.read_uv)
print("Infrared: ", si.read_ir)
print("Proximity: ", si.read_prox)
print("Visible light: ", si.read_visible)
print("\nwith load calibration")
si._load_calibration()
print("UV Index: ", si.read_uv)
print("Infrared: ", si.read_ir)
print("Proximity: ", si.read_prox)
print("Visible light: ", si.read_visible)
Output:
without load calibration
UV Index: 256.28
Infrared: 267
Proximity: 257
Visible light: 263with load calibration
UV Index: 0.02
Infrared: 267
Proximity: 256
Visible light: 264
UV Index value of 0.02 is the correct one, obviously.
I acted on the assumption that during __init__()
_load_calibration()
is already started. But maybe a hardware/sensor issue?
Anyway, I also wrote this issue report for others who have similar problems, and this workaround might work for them, too.
BTW, thanks for putting your effort into this library, I appreciate it.