# Resistance at certain lux

• Oct 8th 2007, 11:53 AM
Apex
Resistance at certain lux
Hi

I have a LDR (light-dependent resistor), the resistance of which falls linearly with increasing lux (light intensity) on a log-log scale.

On a log-log scale, the values increase in powers of 10, but I want to know the resistance value for each lux going up in steps of 1 (eg. 10 lux, 11 lux, 12 lux...), not it powers of 10 (eg. 10 lux, 20 lux, 30 lux, etc...)

Eg. If I want to display the light level in lux based on the LDRs resistance, the display would go something like (in lux):

0.1, 0.2, 0.3, ... ,0.9, 1.0, 2.0, 3.0, ... , 9.0, 10, 20, 30, ... ,90, 100, 200, 300..

This means when the display is reading 1000 lux, the actual light level is between 1000 to 1900 lux!

I don't think finding the gradient of the line helps, as the axes are log-log.

I want to know the resistance value (y-axis) for a given lux value (x-axis). This will allow me to display the values going up 1 lux at a time(eg. 10, 11, 12,... as oppose to 10, 20, 30....).

Thankyou :)
• Oct 8th 2007, 01:19 PM
topsquark
Quote:

Originally Posted by Apex
Hi

I have a LDR (light-dependent resistor), the resistance of which falls linearly with increasing lux (light intensity) on a log-log scale.

On a log-log scale, the values increase in powers of 10, but I want to know the resistance value for each lux going up in steps of 1 (eg. 10 lux, 11 lux, 12 lux...), not it powers of 10 (eg. 10 lux, 20 lux, 30 lux, etc...)

Eg. If I want to display the light level in lux based on the LDRs resistance, the display would go something like (in lux):

0.1, 0.2, 0.3, ... ,0.9, 1.0, 2.0, 3.0, ... , 9.0, 10, 20, 30, ... ,90, 100, 200, 300..

This means when the display is reading 1000 lux, the actual light level is between 1000 to 1900 lux!

I don't think finding the gradient of the line helps, as the axes are log-log.

I want to know the resistance value (y-axis) for a given lux value (x-axis). This will allow me to display the values going up 1 lux at a time(eg. 10, 11, 12,... as oppose to 10, 20, 30....).

Thankyou :)

I don't understand. You have the equation and are trying to make a graph? Or are you taking the data and then going to analyze a graph?

-Dan
• Oct 8th 2007, 03:50 PM
Apex
Hi

What I have is a log-log graph. The x-axis starts at 10^-1 and increases by a power of 10 until 10^4 (on a logarithmic paper). The y-axis is similar, but it ends at 10^6.

On this log graph, there is a line going from 9x10^5 to on the y-axis to 10^4 on the x-axis.

What I want to know is the y-value for any given x-value (eg. x = 1, 100, 200, 201, 203, 593, 9000, 9005 etc...)

I don't know how to work oput the respective y-values out from a log-log graph. This is what I'm asking for.

Thanks
• Oct 8th 2007, 04:18 PM
topsquark
Quote:

Originally Posted by Apex
Hi

What I have is a log-log graph. The x-axis starts at 10^-1 and increases by a power of 10 until 10^4 (on a logarithmic paper). The y-axis is similar, but it ends at 10^6.

On this log graph, there is a line going from 9x10^5 to on the y-axis to 10^4 on the x-axis.

What I want to know is the y-value for any given x-value (eg. x = 1, 100, 200, 201, 203, 593, 9000, 9005 etc...)

I don't know how to work oput the respective y-values out from a log-log graph. This is what I'm asking for.

Thanks

Ah! I think I get it now.

What you have is a line on the log-log graph. The slope-intercept form for a line is
$y = mx + b$
where m is the slope and b is the y intercept. Here x is the independent variable and y is the dependent variable.

On a log-log graph the form of the variables change a bit. Here the form of a line is
$log(y) = m \cdot log(x) + b$

If I have you correctly you have two points on either end of this line:
$(1, 9 \times 10^5)$
and
$(10^4, 1)$
(Why am I using a 1 instead of a 0? Because the axes on a log-log plot are not x = 0 and y = 0. You can't take the log(0), it doesn't exist.)

So the slope of the line is (generalizing from the standard definition):
$m = \frac{log(y_2) - log(y_1)}{log(x_2) - log(x_1)} = \frac{log(1) - log(9 \times 10^5)}{log(10^4) - log(1)} \approx -1.48856$

The y-intercept is $b = log(9 \times 10^5) \approx 5.95454$.

$log(y) = -1.48856log(x) + 5.95454$

To get the x-y relationship from this we put the intercept back into the $log(9 \times 10^5)$ format:
$log(y) = -1.48856log(x) + log(9 \times 10^5)$

$log(y) = log(x^{-1.48856}) + log(9 \times 10^5)$

$log(y) = log((9 \times 10^5)x^{-1.48856})$

Thus
$y = (9 \times 10^5)x^{-1.48856}$

-Dan
• Oct 8th 2007, 04:50 PM
Apex
I see what you're doing - thanks.

I was mistaken with the interecpt coordinates. They are (0.1, 9x10^5) and (10^4, 100)

When I work out the gradient using the respective method, I get -0.7908485019

The final equation gives incorrect values for y. Can you please write an equation (no explanation req) to make sure I'm not messing up somewhere?

Thanks.

P.S. Here's the graph:
Click to enlarge
http://img2.putfile.com/thumb/10/28021132366.jpg
• Oct 8th 2007, 06:53 PM
topsquark
Quote:

Originally Posted by Apex
I see what you're doing - thanks.

I was mistaken with the interecpt coordinates. They are (0.1, 9x10^5) and (10^4, 100)

When I work out the gradient using the respective method, I get -0.7908485019

The final equation gives incorrect values for y. Can you please write an equation (no explanation req) to make sure I'm not messing up somewhere?

Thanks.

P.S. Here's the graph:
Click to enlarge
http://img2.putfile.com/thumb/10/28021132366.jpg

Using the same method and inputting one of the points into the log(y) = m log(x) + b equation I get
$y = (145678)x^{-0.790849}$

-Dan
• Oct 9th 2007, 10:24 AM
Apex
Hi

Ty - that looks like thats giving the correct results. Two questions:
Why did the coefficient of x change from 9x10^5?
Why is it possible to just drop the 'log' function from each side?

Thanks again
• Oct 9th 2007, 02:03 PM
topsquark
Quote:

Originally Posted by Apex
Hi

Ty - that looks like thats giving the correct results. Two questions:
Why did the coefficient of x change from 9x10^5?
Why is it possible to just drop the 'log' function from each side?

Thanks again

The coefficient changed because the intercept changed (you changed your points so m and b became different.)

Also, by properties of logs:
$log(a) + log(b) = log(ab)$
and
$a~log(b) = log(b^a)$

Finally anything we do to one side of the equation we must do to the other. So if we have
$log(a) = log(b)$

Then:
[tex]10^{log(a)} = 10^{log(b)}
implies
$a = b$
(ie. just drop the logs from both sides.)

-Dan
• Oct 9th 2007, 02:50 PM
Apex
Hi

The y-intercept, b, is still 9x10^5. The gradient has changed as a result of changing coordinates, but the intercept remains unchanged. Please explain where the 145678 is from.

Thanks :)
• Oct 9th 2007, 03:27 PM
topsquark
Quote:

Originally Posted by Apex
I was mistaken with the interecpt coordinates. They are (0.1, 9x10^5) and (10^4, 100)

Quote:

Originally Posted by Apex
Hi

The y-intercept, b, is still 9x10^5. The gradient has changed as a result of changing coordinates, but the intercept remains unchanged. Please explain where the 145678 is from.

Thanks :)

x = 0.1 might be on the edge of your graph, but the y axis in this case is the line x = 1. (Or at least that's how I've been taught. This is because there can be no point at x = 0.)

Regardless of our difference in definitions:
$m = \frac{log(100) - log(9 \times 10^5)}{log(10^4) - log(0.1)} = -0.590849$
(Dagnabit! Now I'm getting a different slope from before. Let's just see where this goes.)

Then
$log(y) = m \cdot log(x) + b$

Plug in one of the points:
$log(100) = -0.590849 \cdot log(10000) + b$

$b = 4.36339$
(Different slope, implies different intercept. (sigh))

I want this in log form, so I'll be working with $4.363309 = log(10^{4.363309}) = log(23088.4)$

So
$log(y) = -0.590849 log(x) + log(23088.4)$
or
$y = 23088.4 \cdot x^{-0.590849}$

(This had better be right this time. I checked both points in the equation and they worked.)

-Dan
• Oct 12th 2007, 12:06 PM
Apex
Hi

I think the first gradient we worked out (~-0.7908...) was the correct one, as in doing the same gradient calculation you have done above I get -0.79...

It also works for log(100 / [9x10^5]) / log([10^4] / 0.1) which is abit different in method.

Baring this gradient in mind, I get b = 5.1634...

10^5.1643 gives 1.4568...x10^5 as the y-intercept.

This is 16% out of the actual value of 9x10^5, which isn't very accurate in itself (my estimate from an almost 'scale-less' graph). See the graph on page 3w here: http://docs-europe.electrocomponents...6b8001a9d6.pdf

Do you think it's a reasonable error margin?
Thanks again
• Oct 12th 2007, 12:12 PM
topsquark
Quote:

Originally Posted by Apex
Hi

I think the first gradient we worked out (~-0.7908...) was the correct one, as in doing the same gradient calculation you have done above I get -0.79...

It also works for log(100 / [9x10^5]) / log([10^4] / 0.1) which is abit different in method.

Baring this gradient in mind, I get b = 5.1634...

10^5.1643 gives 1.4568...x10^5 as the y-intercept.

This is 16% out of the actual value of 9x10^5, which isn't very accurate in itself (my estimate from an almost 'scale-less' graph). Is this a reasonable error margin for this graph?

Thanks

Bah! Now I'm back to getting the -0.79... slope. Either I had a massive brain fart in my last post or my calculator is overworked and screwing up on me. :)

Actually your method for the slope isn't any different from mine, it's just a form that exploits the log formulas.

I agree with your intercept also.

Now, what's this about errors? Do you have data points and this is a fit line for them? I had thought you were merely trying to solve the line formula on the log-log graph (between two points) and find out what the formula was without the logs?

-Dan
• Oct 12th 2007, 12:20 PM
Apex
Hi

That was what I was trying to do. Then I just plug in a lux value of my choice and get the resistance at that point :)

I've added a link in my previous post. There is a graph on the datasheet (resistance x10^3 against lux) so you can see where I estimated the intercept from.

I don't know how accurately I did it, but the intercept on their graph is 1/9 the way down that part of the grid (the square it's in), so I measured 1/9 the way down on mine and marked it. I didn't know how else to determine it.
• Oct 12th 2007, 12:29 PM
topsquark
Quote:

Originally Posted by Apex
Hi

That was what I was trying to do. Then I just plug in a lux value of my choice and get the resistance at that point :)

I've added a link in my previous post. There is a graph on the datasheet (resistance x10^3 against lux) so you can see where I estimated the intercept from.

I don't know how accurately I did it, but the intercept on their graph is 1/9 the way down that part of the grid (the square it's in), so I measured 1/9 the way down on mine and marked it. I didn't know how else to determine it.

Okay I get it now.

Bear in mind that spec sheets like this come from batches of tens, if not hundreds, of test experiments where the data were averaged. Also a graph like the one you are working with is almost certainly idealized, else they likely would have included the resistance equation so you wouldn't have to figure it out.

Is a 16% error "ignorable?" Depends on what application you are using the resistor for. I would go by the printed data over the graphical data if that is pertinent to your decision. Otherwise I can't guide you any further than that, because I exude some sort of strange field such that when I walk into a lab strange things happen to the results. (Doh)

-Dan
• Oct 12th 2007, 12:51 PM
Apex
Quote:

Also a graph like the one you are working with is almost certainly idealized, else they likely would have included the resistance equation so you wouldn't have to figure it out.
Good point.

Quote:

Otherwise I can't guide you any further than that, because I exude some sort of strange field such that when I walk into a lab strange things happen to the results.
If we analyze the effects of quarks on matter, we can find out why you affect the results the way you do :P