Skip to main content
lowpowermcu
Associate III
April 10, 2012
Question

Brightness measurement using ADC

  • April 10, 2012
  • 22 replies
  • 3826 views
Posted on April 10, 2012 at 17:48

Hi all,

I want to measure the brightness using a light dependent resistor ''LDR'' uisng the stm32l15x devices. I an thinking to use the ADC to measure the ldr output but the the curve of the resistance vs illumination flux shows a logarithmic function.

Is there somebody who did it?

Thnaks & Regards,

 

MCU Lüfter
    This topic has been closed for replies.

    22 replies

    Tesla DeLorean
    Guru
    April 11, 2012
    Posted on April 11, 2012 at 16:14

    It's used on the STM32L152D-EVAL

    See page 43 for schematic

    http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/USER_MANUAL/DM00049334.pdf

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    raptorhal2
    Lead
    April 11, 2012
    Posted on April 11, 2012 at 16:22

    You haven't said what range of light intensities you wish to measure. I will assume sunlight on a photo grey card to dark.

    A voltage divider with reference feeding a 100K programmable resister connected to the light sensor then to ground will work. A buffer amp will be required for the ADC signal from the resister. The programmable resister is required to get an acceptable signal over the full LDR range. Software logic will be required to hunt for an acceptable programmable resister setting.

    The LDR offset can be up to +/- 50%, so you will need to calibrate using a known light source. Reading a photo grey card illuminated at high noon will probably suffice. The offset can be either a trimming resister on each board, or a constant in each mcu load.

    If your objective is lowest cost, Erik's recommendation of an integrated and calibrated chip instead of a three or four component solution is the way to go.

    Cheers, Hal

    emalund
    Associate III
    April 11, 2012
    Posted on April 11, 2012 at 17:20

    I want to use the ldr VT9ON1 and the stm32l152 device.

     

    I want a low cost solution, with acceptable accuracy.

     

    not that low cost, to use a LDR you need an OP-amp between the resistor and the A/D ot you will get nothing really useable. (the input leakage of a port pin is very temperature dependent combined with the high resistance of the LDR it will be very imprecise).

    can you live with 10% drift, tolerance, ... say so

    If it is that you are doing a one-off with the eval board, say so.

    are you aware that with the LDR it takes a minimum of 50 milliseconds to measure the light, say so

    ''acceptable accuracy'' is not a design criteria, be precise and say so

    what are you measuring daylight, TV output, ... say so

    Erik

    emalund
    Associate III
    April 11, 2012
    Posted on April 11, 2012 at 17:28

    It's used on the STM32L152D-EVAL

     

     

    See page 43 for schematic

     

    good enough for ''playing with the ADC, not good enough for a production unit if better than ''quite light'' vs ''quite dark'' is to be measured. Just visualize the effect  the port pin leakage (which is just about the most variable, unstable spec for a chip) will have in this high resistance region.

    Erik

    lowpowermcu
    Associate III
    April 12, 2012
    Posted on April 12, 2012 at 10:51

    Hi Erik,

    Regarding tolerance, I can accept a 10%.

    Regarding the response time of the LDR, I can accept 50ms and even 100ms

    In fact I am measuring daylight.

    After some research on the net, I think it is not a good solution to use an LDR :(

    That is my own conclusion :(

    Herzlich,

     

    MCU Lüfter

    Tesla DeLorean
    Guru
    April 12, 2012
    Posted on April 12, 2012 at 12:08

    Yeah, basically only seen them used here to determine if Sun is up/down, or if it is light/dark, so mainly exterior lighting or panel illumination. Might be viable to measure/log solar exposure on a roof for a solar panel installation.

    Erik : I mainly cited the schematic to quickly illustrate the part choice driver, and how the circuit was wired. Pretty sure it's ''science project'' grade rather than targeting more serious application. The part you cited seems a lot more fun/applicable.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    emalund
    Associate III
    April 12, 2012
    Posted on April 12, 2012 at 16:02

    Erik : I mainly cited the schematic to quickly illustrate the part choice driver, and how the circuit was wired.

     

    Clive,

    no offense, I just wanted to point out that the trap many fall in ''since the manufacturer does it, it MUST be GREAT'' was in place here.

     Pretty sure it's ''science project'' grade rather than targeting more serious application.

     

    the problem with many posts is that this is rarely stated; however, ''low cost'' made me think it could be a 'real' project.

     

    The part you cited seems a lot more fun/applicable.

     

    It is, indeed I have used 10,000s

    Have fun,

    Erik

    ingwmeier
    Senior
    April 12, 2012
    Posted on April 12, 2012 at 17:36

    beware: TI production status is set to Obsolete..

    emalund
    Associate III
    April 12, 2012
    Posted on April 12, 2012 at 18:00

    yes, obsolete from TI,they sold the line, I just grabbed the datasheet from the olden days

    here is the manufacturer where they are non-obsolete

    http://www.taosinc.com/productfamily.aspx?id=8&SD=als

    Erik

    ingwmeier
    Senior
    April 13, 2012
    Posted on April 13, 2012 at 09:29

    Thanks Erik, this link helps me too. I should find a economic solution for Lux measurement for lighting control at work environments.