-
Notifications
You must be signed in to change notification settings - Fork 10
timing
Unlike many other Light sensors, this sensor offers no time window where you can choose a sampling time in milliseconds.
Instead it uses a weird construct called MTreg.
Please read working-principle if you are not familiar with this term.
With calibrateTiming() we can calibrate the sensor, to know the exact conversion time for a measurement.
So, in the best case, we only need one query to the sensor to get the value as fast as possible.
If you play around with the sensor and do several calibrations, you will note that the timings can differ a little.
I highly recommend to execute the sketch TestSuite.ino in the example folder.
Here you can try all functions, that this library offers, while the senor is running.
The deviation is about 1 - 2 milliseconds. This is not much, but considerable.
I found out, that conversion time at darker conditions is a little bit faster!
Also strongly fluctuating brightness values shorten the conversion time.
The biggest impact has saturation. Then the sensor is much faster than usual.
We can use the last behavior, to get even brighter lux values, than the sensor normally offers.
See timing at saturation.
With a ESP8266, I get even at the same lighting condition a small deviation in sampling time.
As the accuracy of the sampling time simply depends on the polling interval I assume, the the MCU does some internally stuff, which disturbs the timing.
Useful tools, to study this behavior are the functions getTime() and getReads().
If you calibrate the sensor at light conditions, were you want to measure, the calibration is quite good. But, if you really need the fastest results, you may use the function setTimeOffset().