Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Ldr reading issues

johnny78

Full Member level 4
Joined
Jun 28, 2017
Messages
209
Helped
1
Reputation
2
Reaction score
4
Trophy points
18
Activity points
1,724
hi Guys

im trying to read an Ldr resistance with ADC input of Atmega328P

i want to use it to give me 3 coditions (sunny , Cloudy , No light) But im facing two problems

1:reading is easy but i've bought 10 pieces od LDR's & each one has its different reading when im testing with the DMM
2: in sunny condition the LDR get hot & the reading is unstable
any ideas to fix this will be great

thnaks in advance
Johnny
 
Hi,

From an engineer´s perspective "no light" is no clear definition. It means zero, but you can´t detect zero because of noise.
We usually give some meaningful threshold.
Some values:
* sunny day: about 100.000 lx
* dusk: somewhere around 750 lx
* full moon light: 0.2lx (it is a factor of 3750 to "dusk" and thus needs at least an almost perfect 12 bit ADC resolution to destinguish a full moon night from dusk - for a linear sensor)
* clear new moon night: 0.001lx (which is an additional factor of 200 resulting an a 20 bit resolution ADC for the "dusk" range)
You see detecting low light levels is no simple tastk for an electronic sensor. A human eye and brain is extremely powerful in this.

****
To your issues:
1) Quite expectable. But "Different reading" tells us nothing. Different by a factor of 0.99 (1%) or by a factor of 100?
also what/how does your DMM measure it and how can you be sure the light conditions did not change form measurement to measurement?
2) Don´t know what "hot" has to do with unstable. Don´t know "how hot". Don´t know "why" hot (sun radiation or by electrical electrical power dissipation)

Temperature can be fixed using a peltier heater/cooler...or passively by a heatsink.

Klaus
 
Hi,

From an engineer´s perspective "no light" is no clear definition. It means zero, but you can´t detect zero because of noise.
We usually give some meaningful threshold.
Some values:
* sunny day: about 100.000 lx
* dusk: somewhere around 750 lx
* full moon light: 0.2lx (it is a factor of 3750 to "dusk" and thus needs at least an almost perfect 12 bit ADC resolution to destinguish a full moon night from dusk - for a linear sensor)
* clear new moon night: 0.001lx (which is an additional factor of 200 resulting an a 20 bit resolution ADC for the "dusk" range)
You see detecting low light levels is no simple tastk for an electronic sensor. A human eye and brain is extremely powerful in this.

****
To your issues:
1) Quite expectable. But "Different reading" tells us nothing. Different by a factor of 0.99 (1%) or by a factor of 100?
also what/how does your DMM measure it and how can you be sure the light conditions did not change form measurement to measurement?
2) Don´t know what "hot" has to do with unstable. Don´t know "how hot". Don´t know "why" hot (sun radiation or by electrical electrical power dissipation)

Temperature can be fixed using a peltier heater/cooler...or passively by a heatsink.

Klaus
hi Klaus
thanks for your reply

i found 2 LDR's now & i did the test again on led bulb light & the reading of one is 40k & the other is 90k at the same light level
& i need someway to calibrate this difference by software not to write new values for every ldr i use
im not interested to measuree moon light. my measurements is simple
1:Sunny
2:Cloudy
3:no Light

thankks for help
Johnny

the ldr when gets hot by sun radiation the reading is unsatable & i will try to use heatsink for it maybe it solve alittle
 
Hi,

You did not understand what I wrote:
* a factor of 2 is not a big difference in light intensity.
* and: instead of using "text" you should decide values as numbers for the according ranges. No need for exact ones, just exact enough to get a clue about the range and the thresholds, how to design the analog circuit, how to do the software.

Without numbers, just go the "trial and error" way. I cant help you with this, I'm no tinkerer, I'm an engineer.

Klaus
 
Do you have a datasheet of your LDR? What does it tell about useful light intensity range and expected type variation? What about temperature dependency?

I see a type variation of 2.5 to 3 in datasheets, your results are quite typical. An individual resistance adjustment seems necessary, at least a "one point" adjustment.

I don't see LDR specifications for light intensity above 1000 lux, doubt that usual types are well suited for direct sunlight exposure.
 
Place paper over your sensor to shield it from sun's heat. Also this automatically yields diffused light.

Your photosensor detects a sunny day primarily by seeing the sun directly. Otherwise a clear blue sky is comparatively dark. However your paper is bright on a sunny day regardless of the sun's direction, thus conveying uniform brightness to your photosensor below the paper.
 
Hi,

You did not understand what I wrote:
* a factor of 2 is not a big difference in light intensity.
* and: instead of using "text" you should decide values as numbers for the according ranges. No need for exact ones, just exact enough to get a clue about the range and the thresholds, how to design the analog circuit, how to do the software.

Without numbers, just go the "trial and error" way. I cant help you with this, I'm no tinkerer, I'm an engineer.

Klaus
hi Klaus


LDR.gif

this is how i connect the LDR & here is the sketch to read it
Code:
  //else if ((LightSensitivity) > 0) {
  LdrRes = analogRead(LDRPin) + (LightSensitivity);
  //}

  if ((LdrRes) >= 942) {//1020
    lightLevelV = 2;//full light
  }
  else if ((LdrRes) >= 920) {//980
    if ( (LdrRes) <= 942) {//1000
      Light level 1 medium light(cloudy)
      }
    }
  }
  else if ((LdrRes) < 900) {//960
     Light level 0 dark Sky
  }

this values got variation from Ldr to another & in hot weather
--- Updated ---

Do you have a datasheet of your LDR? What does it tell about useful light intensity range and expected type variation? What about temperature dependency?

I see a type variation of 2.5 to 3 in datasheets, your results are quite typical. An individual resistance adjustment seems necessary, at least a "one point" adjustment.

I don't see LDR specifications for light intensity above 1000 lux, doubt that usual types are well suited for direct sunlight exposure.
unfortunately no datasheet
--- Updated ---

Place paper over your sensor to shield it from sun's heat. Also this automatically yields diffused light.

Your photosensor detects a sunny day primarily by seeing the sun directly. Otherwise a clear blue sky is comparatively dark. However your paper is bright on a sunny day regardless of the sun's direction, thus conveying uniform brightness to your photosensor below the paper.
i will try this idea & take new reading for test

thanks
 
Hi,

instead of giving meaningful informations, we get new riddles.

No datasheet for the sensor....

So this is a more "trial and error" approach.
I can´t help you with this.

My way:
* I decide the applications requirements
* then I do the calculations according the requirements, including error calculation.
* then I design the hardware according the math results
* then I write the software
With this approach .. after step2 I know the expectable results.
If my true results don´t match the expectable ones then I´ve done something wrong.

For the last 2 decade I guess I did not use an electronics part without datasheet. It is essential for me.

For sure there is no need for you to do it my way.

Klaus
 
Your method of creating a voltage divider with the photosensor is reasonable. 10k carries small current with tiny heating effect.

Different types of LDR have different response curves. To test another LDR, place a potentiometer (say 50k) where the resistor is. Set it to one ohm value, then another, until you find a setting which gives you a usable range of readings for that LDR and that ohm value.

You can expect to revise your software whenever you change LDR's.
 
To allow adjustment in software, you can use parameters stored in internal EEPROM.

A basic problem is however, that LDR isn't well suited to measure light intensity above 1000 lux accurately. The resolution for the intended three light levels may be slightly improved by setting the reference resistor to e.g. 1k. Maximal LDR power dissipation is 2.5^2/R1, 6.25 mW is still acceptable.
 
Hi,
Your method of creating a voltage divider with the photosensor is reasonable.
I also thought so.
But the values the OP shows does by far not match my expectations.
Since we have no informations about:
* measurement setup
* light sources
* reference measurements to validate the setup
* part informations
* values of variables in software..

We need to guess a lot.
So I used the internet to get the LUX values for the the different conditions (dark, dusk, bright sunlight..)
And I used the internet to get the LUX to R information of some random LDRs.
With this values I expect an R change with a factor in the thousands... but the OP shows value deviation of about 2% only. A factor of 1.02!
It's nothing one can explain with part tolerance ... or not suitale resistor value.

This is so far from my expectation that there must be something really wrong:
* either my expectation
* or something at the OP's side

But the OP is so slow in giving meaningful informations ... and I'm not patient enough to ask again and to wait for them, thus I'll better leave this thread.

Klaus
 

LaTeX Commands Quick-Menu:

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top