• Ambient Light Sensor

    Discussion pysense light
    3
    0 Votes
    3 Posts
    1k Views
    A
    @seb Ah, yes. I have the datasheet but I was searching through all of the text and missed the graphs. Wood vs.Trees! That all makes sense. many thanks.
  • 0 Votes
    4 Posts
    3k Views
    catalinC
    Regarding the light sensor (LTR-329ALS), my understanding was that it LTR329ALS01.light() gives the 2 numbers representing the lux values of 2 channels. If you left the default configuration registers (Gain 1x-> 1lux to 64k lux) then the lux values are exact the values returned. The 2 channels have a different sensitivity based on wavelength (ch0 ~450nm violet-blue and ch1 ~770nm red). I don't know what's raw2lux. Also the ratio d1/(d1+d0), is mentioned in datasheet but I did not understood the meaning. I've read the datasheet from: http://optoelectronics.liteon.com/upload/download/DS86-2014-0006/LTR-329ALS-01_DS_V1.pdf On my desk, evening, I have: '>>> lt = LTR329ALS01(py) '>>> print("Light: " + str(lt.light())) 'Light: (45, 33) 45 lux, 1.5m away (surface is sphere with 1.5m radius) -> 1272 lm, seems ok, as I have 3 bulb-lights of ~400lm. But with cellphone, 2 cm away: Light (6617, 2758) <Later edit> I've used this online tool to convert lux to lumens, as light-bulbs have specs in lumens http://www.rapidtables.com/calc/light/lux-to-lumen-calculator.htm Also with a Blue+Green LED, I've obtained values (85,7), which indicates a blue light, and lack of red light.
  • 0 Votes
    9 Posts
    1k Views
    S
    @livius I am using the official library taken from here https://github.com/pycom/pycom-libraries/blob/master/shields/lib/LTR329ALS01.py which indeed as you noticed does not contain the ALS_STATUS status register reading logic. According to the datasheet https://www.mouser.com/datasheet/2/239/Lite-On_LTR-329ALS-01 DS_ver1.1-348647.pdf Page 22 the Device operation flow chard shows indeed kind of a loop until that status register indicate a new data is available. on Page 24 it shows a pseudo code mentioning what you are suggesting (which is checking the data readiness before performing the actual read). Page 21 it describe how to perform the check of the validity of the read. I can try to patch the lib according to such information and push a PR to the official repo if this is solving the problem :-). Keep You posted and thanks for your help! Stef