adafruit / Adafruit_TCS34725

Arduino library driver for Adafruit's TCS34725 RGB Color Sensor Breakout
http://www.adafruit.com/products/1334
Other
149 stars 149 forks source link

Improved auto-scale table with better granularity #6

Closed dewi-ny-je closed 8 years ago

dewi-ny-je commented 9 years ago

The sensor internally measures with 10 bit every 2.4ms: no digital saturation (overflow) can occur below 64*2.4=153.6ms. Unless speed (and battery consumption) is a priority, there is no reason to reduce sampling time below 154ms, it's just a waste of bits and makes the measurement more sensitive to 50/60 Hz fluctuations. The original table was also jumping from 4x gain, 64 steps, to 1x gain, 1 step: too poor granularity. The new table tries to use the full 16bit scale (therefore no sampling below 154ms) all the time except for the highest setting (dimmest light), where sampling is as long as possible (700ms) and therefore it makes sense to avoid it as soon as the lux incresase.

dewi-ny-je commented 9 years ago

Of course if battery is a priority, the whole table should be modified: I simply made it coherent with the (as far as I understood) goal of accuracy.